How to Migrate from Jenkins to GitHub Actions or GitLab CI/CD
How a Jenkinsfile maps to YAML, what GitHub's importer converts and what it leaves to you, how to replace plugins, shared libraries and agents, and the order to cut over in.
Published November 30, 2026 · HostingX Solutions LLC
Short answer
For GitHub Actions, run GitHub Actions Importer against your Jenkins instance.
auditsizes the migration,forecastestimates runner usage from build history,dry-runwrites converted workflows, andmigrateopens a pull request.The importer handles Declarative pipelines and freestyle jobs, fully or partly. Scripted pipelines, secrets, self-hosted runners and unknown plugins need manual work, and Jenkinsfile
matrix,options,parametersandinputsare listed as unsupported.GitLab publishes a concept mapping and a list of plugin replacements, but no converter. Its JenkinsFile Wrapper can run a Jenkins pipeline inside a GitLab job while you migrate, though it's unsupported.
The hard parts are Jenkins-specific: Groovy shared libraries, plugins with no built-in equivalent, and agents that have tools installed by hand. Inventory them before you convert anything.
Cut over in five phases: inventory, pilot, parallel run, cutover, decommission. Rotate every credential Jenkins stored, and replace long-lived cloud keys with OIDC.
What Changes When You Leave Jenkins?
GitHub's migration guide sums up the main difference: Jenkins pipelines are written in one of two Groovy-based syntaxes, Declarative or Scripted, and “Jenkins deployments are typically self-hosted.” GitHub Actions and GitLab CI/CD use YAML and offer hosted runners, with self-hosted runners as an option. In practice that means five changes:
Groovy becomes YAML. A Declarative pipeline translates fairly directly. A Scripted pipeline is a Groovy program, so loops, functions and dynamic stages have to be redesigned rather than translated.
Stages become jobs, and jobs don't share a workspace. Jenkins stages run in sequence on one workspace. In GitHub Actions each job runs on its own runner, so consecutive stages that share files usually become steps in one job, or pass files as artifacts.
Plugins have to be replaced. Each plugin a pipeline calls becomes a GitHub action, a GitLab built-in feature, or a script.
Shared libraries have to be rewritten. Groovy loaded with
@Librarybecomes reusable workflows or composite actions on GitHub, and CI/CD components on GitLab. Neither vendor documents a conversion for them.Agents become runners. Tools installed by hand on a Jenkins agent move into container images or setup steps, so builds no longer depend on what one machine happens to have.
The phases, parallel running and pitfalls of moving any CI system are in our CI/CD migration playbook. This guide covers what is specific to Jenkins. If you're also moving off CircleCI, see how to migrate from CircleCI.
Jenkins to GitHub Actions and GitLab CI/CD: Concept Mapping
This table combines GitHub's and GitLab's Jenkins migration guides. It uses Declarative syntax, since Scripted pipelines don't have a fixed structure to map:
| Jenkins | What it does | GitHub Actions | GitLab CI/CD |
|---|---|---|---|
| Pipeline file | Jenkinsfile in Groovy, Declarative or Scripted syntax | One YAML file per workflow in .github/workflows/ | One .gitlab-ci.yml in the repository root |
agent | Where the pipeline or stage runs: a label, a node or a Docker image | runs-on to pick a runner, container to run the job in an image | image for the container; runner tags to pick a runner |
stages / stage | Stages run in sequence on one workspace | jobs; each job gets its own runner, ordered with needs | Top-level stages and a stage per job; several jobs can share a stage |
steps | Pipeline steps such as sh | jobs.<id>.steps | script: an array of commands run in order |
post | always, success, failure blocks after a stage or pipeline | No direct equivalent in GitHub's mapping; use steps or jobs with if: always() or if: failure() | after_script, or jobs in the .post stage |
when | Conditions on branch, environment or expressions | if on a job or step | rules |
environment | Pipeline or stage variables | env at workflow, job or step level | variables, globally, per job or in the UI |
parameters / input | Build parameters and manual input steps | workflow_dispatch inputs; approvals through environments with required reviewers | CI/CD variables set at run time; when: manual for approvals |
options | Timeouts, retries, build discarders | timeout-minutes, strategy, strategy.fail-fast | Job keywords such as timeout and retry |
tools | Tool installations configured on the controller | Software preinstalled on GitHub-hosted runners, or setup actions | Container images; install extras in before_script |
| Triggers | cron, SCM polling, upstream projects | on.schedule, on.push, on.pull_request; upstream projects become needs | Pipeline schedules in project settings; rules; the trigger keyword for downstream pipelines |
parallel / matrix | Parallel stages; a matrix with axes | Jobs without needs run in parallel; strategy.matrix | Jobs in a stage run in parallel by default; parallel: matrix: |
| Credentials | Credentials plugin and withCredentials | Repository, organization and environment secrets; OIDC for cloud access | Masked and protected CI/CD variables, external secrets integrations, OIDC |
| Shared libraries | Groovy in vars/ and src/, loaded with @Library | Reusable workflows and composite actions (manual rewrite) | CI/CD components and templates (manual rewrite) |
Two details trip up converted pipelines. Jenkins cron accepts H, a hash that spreads jobs across the hour; standard cron doesn't, so GitHub's example turns H/15 * * * 1-5 into */15 * * * 1-5. And on GitLab, “Jenkins runs the matrix sequentially,” while GitLab runs matrix jobs in parallel, so check that matrix cells don't depend on each other.
Before and After: One Jenkinsfile on Both Platforms
Here is a typical Declarative pipeline for a Maven project. It runs in a container, builds and tests on a weekday schedule and on every push, publishes JUnit results, and deploys from main after a manual approval, using a stored credential:
Jenkinsfile
pipeline {
agent { docker { image 'maven:3.9-eclipse-temurin-21' } }
options { timeout(time: 30, unit: 'MINUTES') }
triggers { cron('H 2 * * 1-5') }
environment { MAVEN_OPTS = '-Xmx1g' }
stages {
stage('Build and test') {
steps { sh 'mvn -B verify' }
post {
always { junit 'target/surefire-reports/*.xml' }
}
}
stage('Deploy') {
when { branch 'main' }
input { message 'Deploy to production?' }
steps {
withCredentials([string(credentialsId: 'deploy-token', variable: 'DEPLOY_TOKEN')]) {
sh './scripts/deploy.sh'
}
}
}
}
}The same pipeline in GitHub Actions
.github/workflows/build-test-deploy.yml
name: build-test-deploy
on:
push:
schedule:
- cron: '0 2 * * 1-5' # Jenkins H becomes a fixed minute
permissions:
contents: read
env:
MAVEN_OPTS: -Xmx1g
jobs:
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 30
container: maven:3.9-eclipse-temurin-21
steps:
- uses: actions/checkout@v7
- run: mvn -B verify
# Replaces post { always { junit ... } }
- uses: actions/upload-artifact@v7
if: always()
with:
name: test-reports
path: target/surefire-reports/
deploy:
needs: build-and-test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# Required reviewers on this environment replace the input step
environment: production
steps:
- uses: actions/checkout@v7
- run: ./scripts/deploy.sh
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}The
postblock becomes a step withif: always(). GitHub Actions has no built-in JUnit report page like the Jenkins JUnit plugin, so this example keeps the reports as an artifact. Add a test-report action if you need results shown in the run.The
inputstep becomes theproductionenvironment with required reviewers. On GitHub Free, Pro and Team plans, required reviewers work only in public repositories, so check your plan first.The
deploy-tokencredential becomes a secret. If it was a cloud key, replace it with OIDC instead: addid-token: writeto the job's permissions and assume a role, as shown in our CircleCI migration guide.The example references actions by major version for readability. GitHub recommends pinning actions to a full-length commit SHA.
The same pipeline in GitLab CI/CD
.gitlab-ci.yml
stages:
- build
- deploy
default:
image: maven:3.9-eclipse-temurin-21
timeout: 30m
variables:
MAVEN_OPTS: -Xmx1g
build-and-test:
stage: build
script:
- mvn -B verify
artifacts:
when: always
reports:
junit: target/surefire-reports/*.xml
deploy:
stage: deploy
environment: production
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: manual
script:
# DEPLOY_TOKEN is a masked, protected CI/CD variable
- ./scripts/deploy.shGitLab replaces the JUnit plugin with JUnit report artifacts, and when: manual replaces the input step. The weekday schedule isn't in the file: GitLab defines scheduled pipelines in the project settings. GitLab's guide is explicit that you should “never store secrets as variables in your .gitlab-ci.yml file.”
How Do You Convert Jenkins Pipelines Automatically?
GitHub Actions Importer is an extension to the GitHub CLI that runs in a container. It doesn't need to run on the Jenkins server. You need Docker, the GitHub CLI, a GitHub personal access token (classic) with the workflow scope (and repo for opening pull requests), a Jenkins API token that can read every job you're migrating, the Jenkins username and the Jenkins URL. The forecast command also needs the Paginated Builds plugin installed on Jenkins.
gh extension install github/gh-actions-importer
# Prompts for the GitHub token, Jenkins token, username and URL
gh actions-importer configure
gh actions-importer update
# 1. Audit every pipeline on the Jenkins instance
gh actions-importer audit jenkins --output-dir tmp/audit
# 2. Forecast runner usage from build history (last 7 days by default)
gh actions-importer forecast jenkins --output-dir tmp/forecast
# 3. Convert one job and write the files, without a pull request
gh actions-importer dry-run jenkins --output-dir tmp/dry-run \
--source-url my-jenkins-project
# 4. Convert and open a pull request in the target repository
gh actions-importer migrate jenkins --output-dir tmp/migrate \
--target-url https://github.com/octo-org/octo-repo \
--source-url my-jenkins-project--source-url is the Jenkins job URL. To convert a Jenkinsfile without fetching it from source control, pass --source-file-path; for multibranch pipelines, --config-file-path points to a YAML file that maps each repository to its path and branches. The audit report lists the manual tasks it found, such as secrets to create and self-hosted runner labels to define.
What the importer converts, and what it doesn't
| Jenkinsfile construct | GitHub Actions | Status |
|---|---|---|
docker | jobs.<id>.container | Supported |
stage | jobs.<id> | Supported |
agent, environment, stages, steps, triggers, when | Runners, env, jobs, steps, on, if | Partially supported |
inputs, matrix, options, parameters | inputs, strategy.matrix, strategy | Unsupported |
| Scripted pipelines, secrets, self-hosted runners, unknown plugins, mandatory build tools | — | Manual migration |
Freestyle jobs are covered too: the Docker template is supported, while build steps, build environment, build triggers and general settings are partially supported. Which plugins the importer understands is listed in the github/gh-actions-importer repository. Anything it doesn't know becomes a manual task, or a custom transformer if you have many pipelines with the same pattern.
The importer also rewrites Jenkins' built-in variables:
| Jenkins variable | GitHub Actions expression |
|---|---|
BUILD_ID | ${{ github.run_id }} |
BUILD_NUMBER | ${{ github.run_id }} |
BUILD_TAG | ${{ github.workflow }}-${{ github.run_id }} |
BUILD_URL | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
JENKINS_URL | ${{ github.server_url }} |
JOB_NAME | ${{ github.workflow }} |
WORKSPACE | ${{ github.workspace }} |
Note that BUILD_NUMBER becomes github.run_id, which is unique but not a counter. Scripts that use the build number as a sequential version need github.run_number, which starts at 1 for a workflow's first run and increments.
GitLab: map by hand, or wrap while you migrate
GitLab's guide recommends moving repositories with its importers, then adding a .gitlab-ci.yml to each project and converting jobs by hand. For pipelines that can wait, the JenkinsFile Wrapper runs a full Jenkins instance, plugins included, inside a GitLab CI/CD job. GitLab notes that it isn't packaged with GitLab and is outside its support scope, so treat it as a bridge, not a destination. GitLab also lists native replacements for common plugins:
| Jenkins plugin | GitLab CI/CD replacement |
|---|---|
| Build Timeout | timeout keyword |
| JUnit | JUnit test report artifacts (artifacts:reports:junit) |
| Cobertura / Code Coverage API | Built-in code coverage features |
| Mailer | Pipeline notification emails |
| Parameterized Trigger | trigger keyword and downstream pipelines |
| Role-based Authorization Strategy | GitLab permissions and roles |
| Timestamper | Job logs are timestamped by default |
| Code-scanning plugins | Built-in templates, for example Jobs/SAST.gitlab-ci.yml |
Shared Libraries, Plugins and Agents: The Manual Work
Shared libraries
A Jenkins shared library is Groovy code that many pipelines call. Start by listing the global functions in its vars/ directory and counting how many pipelines use each one. Rewrite the most-used ones first: as a reusable workflow when the function is a whole pipeline shape, as a composite action when it's a group of steps, or as a CI/CD component on GitLab. Functions that only wrap shell commands are often easier to move into a script in the repository.
Plugins
Export the list of installed plugins from Manage Jenkins, then search your Jenkinsfiles and job configurations for the steps each one provides. Many plugins exist only to add something GitHub Actions and GitLab already do, such as timestamps, timeouts, matrix builds or credentials binding. The rest need an action, a GitLab feature or a script. Plugins that integrate with an external system, such as a deploy target or ticketing tool, are usually where you find hidden behavior.
Agents and runners
GitLab's guide converts an agent by uninstalling the Jenkins agent, then installing and registering a GitLab runner, with tags to route jobs to it. On GitHub, a hosted runner covers most Linux builds. For builds that need private network access or special hardware, Actions Runner Controller (ARC) is “a Kubernetes operator that orchestrates and scales self-hosted runners for GitHub Actions,” installed with Helm charts, with runners that can be ephemeral and container-based. Whatever you choose, move tools that were installed by hand on agents into images, so a rebuilt runner produces the same result.
What Will It Cost?
The open-source Jenkins server has no license fee; its cost is the controller and agents you run and the time spent patching them and their plugins. Hosted CI turns that into a per-minute bill. At list prices on November 29, 2026, a standard 2-vCPU Linux runner on GitHub Actions cost $0.006 a minute in private repositories, after the plan's included amount. GitLab.com sells extra compute minutes at $10 per 1,000, which is $0.01 a minute on its small Linux runner. Jobs on your own runners don't draw from GitHub's included amount or GitLab's compute minutes. Our CircleCI migration guide has the full price table by runner size.
To estimate your own bill, run the importer's forecast on real history. It reports job count, execution time, queue time and concurrent jobs, broken down by Jenkins runner queue. Execution minutes tell you the hosted cost, and concurrency tells you how many runners you need.
A Five-Phase Cutover Plan
Inventory. Run
audit. List Scripted pipelines, shared libraries and the functions each pipeline calls, installed plugins, credentials and their scopes, agents and what's installed on them, scheduled jobs, upstream and downstream triggers, and webhooks that point at Jenkins.Pilot. Convert three representative pipelines: a simple build-and-test, one that deploys with an approval, and the one that depends most on a shared library. Build the images, secrets or OIDC roles and reusable workflows the rest will need.
Parallel run. Run Jenkins and the new pipelines on the same commits, with deployments still coming only from Jenkins. Compare results, durations and test counts.
Cutover. Move deployments to the new platform, switch required status checks in branch protection to the new job names, and disable the Jenkins jobs for each migrated project.
Decommission. Keep the Jenkins controller read-only for as long as you need its build history, then shut it down. Rotate every credential it stored: cloud keys, registry tokens, SSH keys and API tokens. Remove its webhooks and its access to source control.
For where the rotated secrets should live afterwards, see our comparison of HashiCorp Vault and AWS SSM Parameter Store.
Pitfalls to Plan For
Scripted pipelines hide logic. A Scripted Jenkinsfile can generate stages in a loop or read files to decide what to run. Rebuild that as a matrix, separate workflows or a script, and test it in the pilot.
Upstream and downstream jobs. Jenkins jobs that trigger each other become
needsinside one workflow on GitHub, or downstream pipelines with thetriggerkeyword on GitLab. Draw the job graph before you split or merge anything.Credentials get copied instead of replaced. Recreating every Jenkins credential as a secret carries long-lived keys forward. Use OIDC for cloud access on both platforms, and keep secrets only for systems that can't federate.
Self-hosted runners need a security review. GitHub warns that self-hosted runners should almost never be used for public repositories, because they aren't guaranteed to be clean between jobs. Prefer ephemeral runners, such as ARC's container-based runners.
Third-party actions replace plugins. Every action runs with the job's permissions. Pin actions to commit SHAs, set
permissionsexplicitly as in the example above, and prefer actions published by the vendor of the tool they wrap.
Where Does This Fit With the Rest of Your Pipeline?
A CI migration is a good time to move security checks into pull requests; our guide to migrating legacy SAST to CI/CD pipeline scanning covers GitHub Actions and GitLab. If you deploy to Kubernetes, the pipeline can stop deploying directly and hand off to GitOps, as described in GitOps compliance with Argo CD. For the stages a modern pipeline should have, see our CI/CD pipeline automation guide.
Frequently Asked Questions
Can GitHub Actions Importer convert a Jenkinsfile?
Yes, for Declarative pipelines, with gaps. Docker agents and stages are supported, and most other sections are partially supported. Jenkinsfile matrix, options, parameters and inputs are unsupported, and Scripted pipelines, secrets, self-hosted runners and unknown plugins need manual migration. Run dry-run and review the output before migrate opens a pull request.
Is there a Jenkins to GitLab converter?
GitLab's migration guide maps Jenkins concepts to GitLab CI/CD and lists plugin replacements, but doesn't include a converter. The JenkinsFile Wrapper can run existing Jenkins pipelines inside GitLab jobs during the migration; GitLab says it's outside its support scope.
What replaces Jenkins shared libraries?
Reusable workflows and composite actions on GitHub, and CI/CD components on GitLab. Neither platform converts Groovy, so rewrite the most-used functions first and move simple shell wrappers into scripts.
What happens to Jenkins credentials?
Neither platform imports them. Recreate the ones you still need as GitHub secrets or GitLab masked and protected variables, replace cloud keys with OIDC, and rotate everything Jenkins held once you decommission it.
Should we migrate everything at once?
No. Pilot a few representative pipelines, run old and new side by side on the same commits, and move deployments last. On GitLab, the JenkinsFile Wrapper can keep lower-priority pipelines running while you migrate the rest.
Planning a move off Jenkins?
We plan and run Jenkins migrations to GitHub Actions and GitLab CI/CD for US businesses: inventory, shared-library rewrites, runners, OIDC for cloud access, parallel runs and cutover. The first 30-minute consultation is free.
Related Articles
CI/CD Migration Playbook
Assessment, parallel running and cutover for any CI platform.
How to Migrate from CircleCI
Orbs, contexts and per-minute costs on GitHub Actions and GitLab.
CI/CD Pipeline Automation Guide
The stages of a modern pipeline, from lint to deploy.
Migrating Legacy SAST to CI/CD Scanning
Pull request scans that gate only on new findings.
See also: DevOps automation services · Vault vs SSM Parameter Store · GitOps compliance with Argo CD
Services
Subscribe to our newsletter
Get monthly email updates about improvements.
© 2026 HostingX Solutions LLC. All Rights Reserved.
LLC No. 0008072296 | Est. 2026 | New Mexico, USA
Terms of Service
Privacy Policy
Acceptable Use Policy