Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Migrate from GitHub Actions to Harness CI

Learn how to migrate your existing GitHub Actions workflows to Harness CI.

Harness CI and GitHub Actions both allow you to create workflows that automatically build, test, publish, release, and deploy code.

Go to What makes Harness CI unique to see the key differences.

Harness does not require scripting, and configurations are passed to pipelines securely and pragmatically. In contrast, GitHub Actions provides third-party actions that you use with semi-plug-and-play functionality.

You can also use plugins to include GitHub Actions, Bitrise Workflow Steps, Jira updates, and more in your Harness CI pipelines.

GitHub Actions plugins

Harness CI offers built-in support for GitHub Actions. You can use the GitHub Action step in pipelines that use Harness Cloud build infrastructure. For other build infrastructures, you can use the GitHub Actions Drone plugin in a Plugin step.

Other advantages

Harness CI offers the following additional advantages over GitHub Actions:

  • Harness offers a variety of build infrastructure options, including Apple silicon and Linux arm64 options.

  • Harness supports both Terraform and CloudFormation infrastructure provisioning with simpler structures and configurations than their corresponding GitHub Actions.

  • GitHub Actions does not provide a native Accelerate metrics dashboard, whereas Harness offers both a dedicated dashboard and the ability to configure alerts.

Comparison: workflow architecture

Both Harness CI and GitHub Actions use workflows to organize builds. In Harness CI, these workflows are called pipelines. In both products, workflows are divided into major segments, which are called stages in Harness CI and jobs in GitHub Actions. Each stage or job includes one or more steps or individual commands.

In GitHub Actions, if a job has a lot of steps, those steps might be organized into groups, which are called stages. Similarly, in Harness CI, you can use step groups to group steps within a stage.

The following truncated examples provide a simple comparison of stage and step structure in GitLab CI and Harness CI.

jobs:
  job_1:
   name: job_1
   runs-on: ubuntu-latest
   steps:
      -  name: compile code
         container:
               image: python:3.10.6-alpine
         run: |
           python -m compileall ./
  stages:
    - stage:
        name: stage1
        ...
        spec:
          ...
          platform:
            os: Linux
            arch: Amd64
          ...
          execution:
            steps:
              - step:
                  type: Run
                  name: compile code
                  identifier: compile_code
                  spec:
                    connectorRef: myDockerHubConnector
                    image: python:3.10.6-alpine
                    shell: Sh
                    command: python -m compileall ./

Go to the CI key concepts for Harness terminology, features, and pipeline components.

Both Harness CI and GitHub Actions workflows are written in YAML. Whereas GitHub Actions workflow configurations are always stored in the .github/workflows directory in your code repo, 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.

Complete workflow comparison

Here are YAML examples of complete workflows in GitHub Actions and Harness CI.

ROOT AND NON-ROOT USERS

Steps run as the root user, generally. For example, with Harness Cloud build infrastructure, steps run directly on the host and, therefore, run as the root user.

For services running on containers (which are steps where you specify a Container Registry and Image to use to execute the step's commands), you can use the Run as User setting to specify a user to use for that container.

With Kubernetes cluster build infrastructure, you can use the Run as User setting to specify a user to use for individual steps, or you can set a default user for all steps and then override the default user as needed for individual steps.

Comparison: clone a codebase

GitHub Actions workflows are inherently associated with a code repo because the workflow YAML exists in the .github/workflows directory in the target code repo. The workflow can use actions/checkout in a step to clone the associated codebase into the workflow workspace.

In Harness CI, each pipeline has a codebase specification that identifies the code repo (input) that the pipeline uses to build an artifact (output). Codebase configuration has two components:

  • The codebase connector, such as a GitHub connector, that specifies the codebase URL and required credentials to access your code repos.

  • A series of settings describing how you want the pipeline to clone and build the repo.

When you create a Harness CI pipeline, you specify a default codebase to use for all stages in the pipeline. By default, each stage automatically clones the designated code repo from your Git provider into the stage's build infrastructure when the pipeline runs.

WHAT ARE CONNECTORS?

Harness integrates with many different types of repositories and providers. A connection from Harness to other platforms is called a connector. Connectors can connect to source control providers, cloud providers, container registries, and more.

In addition to codebase configuration, you can also use connectors in individual steps to specify Docker images or even clone additional codebases in the same pipeline.

For example, in the following YAML example, the connectorRef references a Docker connector. Docker connectors are platform-agnostic and can be used to connect to any Docker container registry.

Comparison: access Docker

To log in to Docker Hub in a GitHub Actions workflow, you use docker/login-action in a step. You then use other docker actions in other steps to pull images, push images, and so on.

To interact with Docker registries in Harness, you use a Docker connector. In the following YAML example, the connectorRef references a Docker connector and the image indicates the image to pull. You do not need an extra step to connect to Docker - Harness handles the login/connection through the connector configuration.

In the previous example, a Docker connector was used to pull an image for a script. You can also use Docker connectors to do other Docker-related actions, such as building and pushing images to Docker registries.

Comparison: environment variables

In GitHub Actions, you can use predefined environment variables, define custom variables within a single workflow, or define custom variables at the organization, account, and environment levels. You can use predefined environment variables or define custom variables.

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 GitHub Actions example defines environment variables at the workflow and job levels.

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.

Go to the following for defining and fetching variables:

Comparison: matrix jobs

In both Harness CI and GitHub Actions, you can define matrix strategies for your jobs to iterate over a series of inputs. In both products, you define a matrix strategy and then call the strategy by its tag or other identifier when you want to use it in a command or step.

In Harness, matrix looping strategies are one of several looping execution strategies. To learn about the looping strategies available in Harness, go to Use looping strategies

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

In GitHub Actions, triggers are defined in the workflow based on Git events against specified branches or conditions.

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. Go to the following for creating triggers:

This GitHub Actions trigger listens for specific words in the name of pull requests against the main branch.

This Harness CI example shows a cron trigger on the main branch.

Next steps

Last updated

Was this helpful?