Skip to main content

Jenkins

The minimum

flow export jenkins > Jenkinsfile
pipeline {
agent { docker { image 'node:24' } }
stages {
stage('FlowWright') {
steps {
sh 'npx @flowwright/cli run'
}
}
}
}

A realistic Jenkinsfile

pipeline {
agent { docker { image 'node:24' } }
environment {
CI = 'true'
}
stages {
stage('FlowWright') {
steps {
sh 'corepack enable'
sh 'pnpm install --frozen-lockfile'
sh 'pnpm exec flow run -j 4 --junit report.xml'
}
}
}
post {
always {
junit 'report.xml'
archiveArtifacts artifacts: 'dist/**', allowEmptyArchive: true
}
}
}

post { always { … } } is the equivalent of the other providers' "upload even on failure" — put junit there, not in steps, or a failing run publishes nothing.

There is no Jenkins reporter

Jenkins gets the plain ci reporter — the same layout as your terminal, with color off — plus JUnit XML. That's the entire integration. There are no annotations and no summary page, because Jenkins has no equivalent of those APIs to target.

Setting CI = 'true' in environment is what selects it. Jenkins doesn't set that variable itself, so without it you get the pretty reporter and ANSI escape codes in your console log. You can also be explicit:

sh 'pnpm exec flow run --reporter ci --junit report.xml'

Test reports

The junit step is where per-stage detail shows up — the Jenkins test results page lists one test per FlowWright stage, and a failure carries the command and exit code:

<testcase name="test" classname="acme-api" time="0.022">
<failure message="stage failed">command: node -e process.exit(2)
exit code: 2</failure>
</testcase>

Caching

Jenkins has no built-in cache action. What works depends on your agent:

  • A long-lived agent with a persistent workspace.flowwright/cache survives between builds by itself. Nothing to configure.
  • A fresh container per build — the workspace is gone each time. Either mount a volume at .flowwright/cache, or use a plugin such as jobcacher.

See the overview for what's in that directory and why prefix restores are safe.

Migrating an existing Jenkinsfile

flow migrate jenkinsfile ./Jenkinsfile

Reads a declarative Jenkins pipeline and suggests a pipeline.ts. It's a regex scan over Groovy, not a parser — treat the output as a first draft and read every line. Details on Project setup.

The usual path is to migrate the body into pipeline.ts and leave a Jenkinsfile that does nothing but check out, install and call flow run — which is the minimal file at the top of this page.

Authored from source, not from a running pipeline

FlowWright's own repository has no Jenkinsfile outside a test fixture. The Groovy above is written from Jenkins' documented declarative syntax; the reporter and JUnit output are captured from real runs. If something doesn't match your Jenkins version, trust the Jenkins docs.