Skip to content

GitLab Custom Runner

The vHaaS GitLab Custom Runner integrates hardware Assemblies directly into GitLab CI/CD pipelines. A job tagged vHaaS is picked up by the runner, which books an Assembly, connects to its Execution Environment, runs the job script on that Execution Environment with hardware access, and releases the Assembly when the job finishes.

The runner is hosted by vHaaS, so no installation is required. The executor can also be run in a self-managed environment; see Self-hosted GitLab Runner.

Setting up your first pipeline?

For a step-by-step walkthrough, see Basic CI Integration. For a conceptual overview of how the runner books, connects, runs and releases, see CI Integration.

Job routing

The runner only picks up jobs that carry the vHaaS tag:

tags:
  - vHaaS

Jobs without this tag are ignored by the vHaaS runner and handled by the project's other runners as usual.

CI/CD variables

Set these as CI/CD variables on the project/Group or under the job's variables:. The names are matched exactly.

Variable Required Description
VEHAAS_TOKEN ✓ A vHaaS Access Token used to book the Assembly and read the Execution Environment credentials. Store it as a masked, protected CI/CD variable. Needs at least the group_user role on the Assembly.
ASSEMBLY_REF ✓ One Assembly ref, or several as a comma-separated list. The refs are tried in order and the first available one is used (e.g. "ASSEMBLY-1004" or "ASSEMBLY-1, ASSEMBLY-2").
SESSION_DURATION ✓ Booking duration in minutes. The Session is force-ended after this time.
SESSION_TIMEOUT ✓ Maximum time in minutes to wait for a free Assembly before the job fails.
VEHAAS_ORGANIZATION_ID ✓ The vHaaS Organization ID.
VEHAAS_HOST — Base URL of the vHaaS service. Defaults to https://vhaas.vector.cloud and does not normally need to be set.

Token security

Never commit VEHAAS_TOKEN to the repository. Always use a masked and protected GitLab CI/CD variable.

Job environment

In addition to the standard GitLab CI/CD predefined variables and any user-defined variables, the runner exposes the booked Execution Environment to the job script:

Variable Description
SESSION_ID ID of the vHaaS Session backing this job.
VM_ID ID of the Execution Environment the job is running on.
VM_HOSTNAME DNS name of the Execution Environment.
VM_USERNAME Username the job script runs as.
VM_PASSWORD Password for that user. Treat as a secret — do not print it.
VM_IP IP address of the Execution Environment. Empty when the Execution Environment is reached through a tunnel.
VM_SSH_HOSTNAME Public SSH hostname of the Execution Environment when it is reached through a tunnel.

Naming

Execution Environments were previously called Virtual Machines. The job variables keep the old name in their VM_* prefix (VM_ID, VM_HOSTNAME, …).

Execution environment

The repository is checked out on the Execution Environment and the script runs from the checkout directory, so artifacts are collected from there as usual. Hardware interfaces are available as configured in the Assembly Profile.

PowerShell semantics

The Assembly's default GitLab-runner Execution Environment runs Windows, so each line of the script, before_script and after_script sections executes in PowerShell on that Execution Environment. Commands must use PowerShell syntax — Bash/POSIX constructs will not work — and variables are referenced the PowerShell way, e.g. $env:VM_HOSTNAME:

script:
  - Write-Host "Running on $env:VM_HOSTNAME (session $env:SESSION_ID)"
  - Get-Location

Troubleshooting

Symptom Likely cause Solution
Job stays in pending No runner with the vHaaS tag is available to the project Confirm the project can reach the vHaaS runner; for external projects contact Support
Job fails asking for VEHAAS_ORGANIZATION_ID The variable is unset Set VEHAAS_ORGANIZATION_ID to the Organization ID
"Assembly not available" The Assembly is in use or access is missing Check availability in the web UI; add fallback refs ("ASSEMBLY-1, ASSEMBLY-2"); raise SESSION_TIMEOUT
Authentication failed Invalid or expired VEHAAS_TOKEN Verify the variable is set, not expired, and has at least the group_user role
Job fails mid-run SESSION_DURATION elapsed before the job finished Increase SESSION_DURATION or shorten the job
Commands fail with syntax errors Script written for Bash, not PowerShell Rewrite the script in PowerShell syntax (see PowerShell semantics)