Migrate from Jenkins CI to Harness CI
Learn how to migrate your existing Jenkins pipelines to Harness CI.
Harness CI and Jenkins both allow you to create pipelines that automatically build, test, publish, release, and deploy code.
This guide describes the important differences between Harness CI and Jenkins so that you can migrate your existing Jenkins pipelines to Harness CI.
What makes Harness CI unique?
Harness CI provides proprietary technologies, like Cache Intelligence and Test Intelligence, which make Harness CI four times faster than other leading CI tools.
Harness Test Intelligence (TI) is a proprietary technology that accelerates test cycles by running only the tests necessary to confirm the quality of the code changes that triggered a build. Visualizations show which code changes caused which tests to be selected, and TI can help you identify gaps in your test plan. TI also detects negative trends and provides actionable insights to improve quality. With TI, it's possible to reduce build cycle times by up to 90% without compromising application quality.
Harness Cache Intelligence is a proprietary technology that reduces pipeline execution time by automatically caching well-known directories for languages like Java and Node.js.
In addition, you can use plugins to include GitHub Actions, Bitrise Workflow Steps, Jira updates, and more in your Harness CI pipelines.
Harness CI is part of The Harness Platform, which is a self-service CI/CD platform that enables end-to-end software delivery. The Harness Platform includes features, functionality, and additional modules to help you build, test, deploy, and verify software. For example:
Secrets management through the Harness secrets manager or an external secrets manager.
Role-Based Access Control (RBAC) helps you control user and group access to Harness resources according to users' roles. Using RBAC increases security and improves efficiency.
Harness Policy as Code is a centralized policy management and rules service that leverages the Open Policy Agent (OPA) to meet compliance requirements across software delivery and enforce governance policies.
The Harness Enterprise Ready Self-Managed Edition is an end-to-end solution for continuous, self-managed delivery. You can install and update Harness Self-Managed Enterprise Edition using online or offline (air-gapped) methods.
Comparison: Pipeline architecture
Both Harness CI and Jenkins use pipelines to organize builds. In both products, pipelines are made up of one or more stages, which represent major segments of the workflow. Each stage includes one or more steps, which in turn contain individual commands.
In Jenkins, pipelines are defined using either Declarative or Scripted Pipeline syntax in a Jenkinsfile. In Harness CI, pipelines are defined in YAML and can be stored inline or in Git repositories.
The following truncated examples provide a simple comparison of stage and step structure in Jenkins and Harness CI.
For more information about Harness terminology, features, and pipeline components, go to the CI key concepts.
Stages and steps
Stages in Jenkins are similar to stages in Harness CI. In both products, stages contain steps with commands. An important difference is that Jenkins Declarative Pipeline runs stages sequentially by default (unless using parallel blocks), similar to Harness CI where stages and steps also run sequentially by default. However, you can enable parallelism and other looping strategies in Harness CI.
Scripts in pipelines
Both Harness CI and Jenkins support running scripts or shell commands in steps. In Jenkins, you use sh, bat, or powershell steps to run scripts.
In Harness CI, scripts are supplied in the command key, and can be supplied for any step type that supports command. You specify the shell type using the shell key.
Writing pipelines
Jenkins pipelines are written in Groovy-based DSL (either Declarative or Scripted syntax) and are stored in a Jenkinsfile in your code repository. Harness CI pipelines are written in YAML, and Harness provides you a choice of inline pipeline storage or importing pipelines from Git. Harness also provides both visual and code-based pipeline editors.
The Harness YAML editor includes schema validation and auto-complete recommendations to simplify and expedite pipeline configuration.
The Harness visual editor provides a guided experience that enables anyone to easily build, debug, and run pipelines.
You can switch back and forth between editors.
Comparison: Specify a Docker image
In Jenkins, you can specify Docker images using the agent directive with a docker block, for example:
In Harness CI, you specify connectors and images for each step, if necessary. Depending on the step type, the commands you are running, and your build infrastructure, you may not need to specify an image. For example, if a binary is already available on your build farm, you may not need to pull an image for that binary.
For example, the following step includes a connectorRef referencing a Docker connector. Docker connectors are platform-agnostic and can be used to connect to any Docker container registry.
Comparison: Define a multi-stage pipeline
Both Jenkins and Harness CI execute pipeline stages in a specific order based on the configuration.
The following examples compare Jenkins and Harness CI pipelines with multiple stages.
Comparison: Environment variables
In Jenkins, you can use environment variables to control the behavior of stages and pipelines, store values you want to reuse, or avoid hard-coding values in your Jenkinsfile. You can use predefined environment variables (like BUILD_NUMBER, JOB_NAME), define custom variables in the environment block, or use credentials.
This range of variable definition is also possible in Harness CI. In addition to built-in variables, you can define variables within individual pipelines, stages, and steps as well as at the project, organization, and account levels.
This Jenkins example demonstrates use of pre-defined and custom variables.
To reference project, organization, and account variables, you use variable expressions formatted as: <+variable.[scope].[variable_id]>. Here are the syntax formats for variables declared at different levels:
Account-level variable reference:
<+variable.account.[var_id]>Organization-level variable reference:
<+variable.org.[var_id]>Project-level variable reference:
<+variable.[var_id]>
In this example, a step references a project-level environment variable called ENV_VAR.
Within a single pipeline, you can define variables at the step, stage, and pipeline levels. For example, this step includes environment variable definitions.
To learn more about defining and fetching variables go to:
Comparison: Matrix and parallelism
In Jenkins, you can use the matrix directive for matrix builds and parallel blocks for parallel execution. In Harness CI, steps and stages run sequentially unless you enable parallelism. For example, this Harness CI YAML example shows a pipeline with two stages that run in parallel, as indicated by - parallel, and two stages that run sequentially after the two parallel stages.
In addition to parallelism, you can use Harness CI's looping strategies to make your pipelines more dynamic and versatile. These strategies allow your pipelines to execute the same set of tasks multiple times for several different configurations without requiring you to intentionally create unique steps or stages for each iteration. This is achieved by mentioning user-defined tags and referencing them in the pipeline using the following expression syntax: <+matrix.usertag>
As in Jenkins, you also can combine parallelism and matrix strategies in Harness CI, as shown in the following examples.
The following example describes a stage in a Harness CI pipeline that includes one step with matrix and parallelism strategies. The looping strategies are defined in strategy at the stage level. One matrix strategy, called testparam, is defined in matrix and parallelism is defined by maxConcurrency: 3. The script in the Run step calls the inputs from the matrix strategy by using the expression <+matrix.testparam>.
Comparison: Triggers
Both Jenkins and Harness CI support various methods to trigger pipeline execution.
In Jenkins, pipelines can be triggered through:
SCM polling
Webhooks
Timer/cron triggers (using
triggers { cron(...) })Manual triggers
Upstream/downstream project triggers
Harness CI supports webhook, artifact, manifest and schedule triggers. The two most commonly used triggers are webhook triggers based on Git events and scheduled triggers based on cron expressions. To learn more about creating a trigger, go to Triggers.
Comparison: Plugins and shared libraries
Jenkins uses plugins and shared libraries to extend functionality. Harness CI uses plugins to add functionality to pipelines.
In Jenkins, you can:
Install plugins through the Jenkins Plugin Manager
Use shared libraries for reusable pipeline code
Use community-contributed plugins for various integrations
In Harness CI:
You can use plugins to include GitHub Actions, Bitrise Workflow Steps, Jira updates, and more
Drone plugins are supported natively
Custom plugins can be created using Docker containers
Comparison: Agents and build infrastructure
In Jenkins, you define where jobs run using agent directives, which can specify:
any- Run on any available agentnone- No global agent; each stage must define its ownlabel- Run on an agent with a specific labeldocker- Run inside a Docker containerkubernetes- Run in a Kubernetes pod
In Harness CI, you configure the build infrastructure at the stage level using the platform and runtime settings. Harness supports several build infrastructure options:
Harness Cloud: Harness-managed infrastructure
Kubernetes cluster: Your own Kubernetes cluster
Local runner: Docker runner on your own machine
Self-managed VMs: AWS, GCP, or Azure VMs
See also
Review the following information before proceeding with migration:
Last updated
Was this helpful?