← All comparisons

runner vs GitLab CI/CD

Runner can build and deploy locally from your code on GitLab.

What it does well

  • Repository, registry, CI and environments on the same platform.
  • Resource groups, protected environments and prevention of outdated deploy jobs.

Same goal, two paths

See how to do each task with both tools. The examples assume the setup described in each case; adapt names, credentials and infrastructure.

01 / USE CASE

Ship a new version

The shop app is already registered in both tools, with source access and the server configured. On the Runner side, commands run on a Linux server with Docker and Traefik already set up.

With GitLab CI/CD

  1. Keep a job in .gitlab-ci.yml with a script that deploys the approved artifact and declares the matching environment. Configure access to the target and artifact retention.
  2. Push the change to the pipeline's branch and run the deploy job; if it is manual, select Run. Check the result in the environment and the logs.
source: GitLab · deployments ↗

With runner

  1. Publish the new version to the configured source. In the Git + Dockerfile path, the Runner fetches the code and builds on the server, without pushing the app image to a registry.
  2. With polling configured, the pipeline runs automatically. To trigger it now, run the commands below on the server and check the status and history.
Examplebash · example
runner preflight shop
runner deploy shop
runner status shop
runner logs history shop

The Runner works on one server at a time. Host-published ports and shared writable volumes may require a downtime window. The Runner can build locally from the repository. Producing the image in GitLab is an option; keep the tests and approvals your team requires.

02 / USE CASE

Roll back a version

The shop app is already registered in both tools, with source access and the server configured. On the Runner side, commands run on a Linux server with Docker and Traefik already set up.

With GitLab CI/CD

  1. In Operate > Environments, open the environment and select Rollback environment next to a previous successful deployment.
  2. GitLab runs the deployment jobs. The script must restore that version; if it depends on artifacts built in another job, run the required jobs as well. Check the application.
source: GitLab · roll back a deployment ↗

With runner

  1. List the retained versions and confirm the previous one still has its code and image available.
  2. Roll back to the previous version and check the application. To pick a different retained version, use --version with the listed identifier.
Examplebash · example
runner versions shop
runner rollback shop
runner status shop
runner logs history shop

A rollback changes code/image; it does not undo migrations, databases or persistent files. Check that the current configuration is compatible with the previous version.

03 / USE CASE

Change configuration

The shop app is already registered in both tools, with source access and the server configured. On the Runner side, commands run on a Linux server with Docker and Traefik already set up.

With GitLab CI/CD

  1. In Settings > CI/CD > Variables, add LOG_LEVEL with the value info and a scope that fits the environment. Review variables with the same name in the YAML or in other scopes.
  2. Run the deploy pipeline. Your script must pass LOG_LEVEL to the container and recreate it; the CI variable alone does not configure the server.
source: GitLab · CI/CD variables ↗

With runner

  1. In this example, shop already uses env_sync: skip in the reviewed manifest, which preserves the local environment; LOG_LEVEL is not pinned under environment in the manifest.
  2. Write the non-secret variable on the server and force the container to be recreated. Check the log level in the application's behavior.
Examplebash · example
runner env set shop LOG_LEVEL info
runner deploy shop --force
runner status shop

The application must read LOG_LEVEL at runtime. Pipeline variables only reach the container if the deploy process passes them along.

Documented reports and historical context
  • An SSH key in a CI variable needs care: if it shows up in the log, it is not masked.

    source: GitLab · SSH keys ↗

    On the server, cron polls the source and runs the deploy. This path removes the need for an inbound SSH key from CI; credentials to read the repository are still required.

  • GitLab rollback depends on the process written in the job script.

    source: GitLab · deployments ↗

    runner reuses a version and image retained locally. Check retention before going back: data and schema migrations are not reverted.

  • Builds with a shared Docker daemon give jobs sensitive access to the host.

    source: GitLab · Docker build ↗

    You can separate the CI job from the deploy and build on the target or pull a ready-made image. Building on the target runs your Dockerfile and requires trusting the code; it offers no isolation against malicious code.

When to stay with the tool

  • Stay with GitLab's security controls, approvals and test jobs when they are part of your process. Runner can take over the Docker build and the deploy on the server; your team's tests and approval rules still need to be defined.

How to evaluate the deploy step

The commands use shop as the example app. Adjust the identifier and instance to the generated manifest. Only remove the previous deploy after validating the new path.

  1. Keep the tests and approvals your team requires. For a local build, commit the Dockerfile and manifest and give the server access to the repository. If you'd rather keep building on GitLab, check the published image and registry access. Move protected variables carefully.

  2. Prepare a Linux server with compatible Docker and Traefik, DNS and a persistence strategy. Back up your data with your backup tool and test the restore. Install and initialize the runner following the start guide.

    Example with runnerbash · example
    curl -sL https://get.runnerci.com/init.sh | sudo bash
    runner init
  3. In the app folder with a Dockerfile or image, generate and review the manifest. Check network, healthcheck, secrets and version. The wizard does not deploy on its own.

    Example with runnerbash · example
    runner wizard --path .
    runner validate --path .deploy.yml
  4. Example for a GitHub repository: commit the reviewed manifest to the main branch before registering. Replace my-org/shop with your repo, main with the published branch and production with the reviewed instance; set up read access to the private repo first. On the server, register, review the preflight and only then deploy.

    Example with runnerbash · example
    runner add --repo my-org/shop --branch main --instance production --ckey v2
    runner preflight shop
    runner deploy shop
    runner status shop
    runner logs history shop
  5. Validate the domain and the app's behavior before turning off the previous deploy. Disable the old trigger to avoid two deployers on the same app. Set up polling to automate the pipeline on the server. If you prefer an external build, configure the source of the image or artifact produced by CI. The start guide covers the prerequisites.