Skip to content

Basic CI integration

The veHaaS custom GitLab runner provides seamless integration of hardware assemblies into your CI/CD pipelines. This runner automatically handles the booking, connection, and execution of CI jobs on veHaaS virtual machines.

Setup Instructions

  1. Create veHaaS Access Token

  2. Configure GitLab CI Variables:

    In your GitLab project, go to SettingsCI/CDVariables and add a new variable (GitLab CI Variables):

    Variable Description
    VEHAAS_TOKEN The token to authenticate with the veHaaS API.
  3. Configure Your CI Job

    Add the following configuration to your .gitlab-ci.yml file:

    your-job-name:
    tags:
      - vehaas # This tag routes the job to the veHaaS runner
    variables:
      ASSEMBLY_REF: "YOUR-ASSEMBLY-ID"
      SESSION_DURATION: 30
      SESSION_TIMEOUT: 10
    script:
      -  # Your test commands here
    

Configuration Variables

Variable Description Example
ASSEMBLY_REF Specifies which assemblies to use (First available of list gets selected) "ASSEMBLY-1004" or "ASSEMBLY-1, ASSEMBLY-2"
SESSION_DURATION Duration to book the assembly in minutes 30
SESSION_TIMEOUT Maximum time to wait for assembly availability in minutes 10

Examples

Basic Example

test:
  tags:
    - vehaas
  variables:
    SESSION_DURATION: 30
    SESSION_TIMEOUT: 10
    ASSEMBLY_REF: "ASSEMBLY-1004"
  script:
    - echo "Test running on assembly $ASSEMBLY_REF"
    - sleep 60
  rules:
    - if: $CI_COMMIT_SHA

Advanced Example with Multiple Assemblies

hardware-test:
  tags:
    - vehaas
  variables:
    SESSION_DURATION: 45
    SESSION_TIMEOUT: 15
    ASSEMBLY_REF: "ASSEMBLY-1004, ASSEMBLY-1005, ASSEMBLY-1006"
  script:
    - echo "Running on assembly: $ASSEMBLY_REF"
    -  # Install dependencies
    - apt-get update && apt-get install -y python3-pip
    - pip3 install -r requirements.txt
    -  # Run tests
    - python3 -m pytest tests/
    -  # Generate reports
    - coverage report
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml
    expire_in: 1 week
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Functionality Overview

Overview of custom gitlab runner functionality:

  • The runner claims all jobs submitted with the vehaas tag
  • The specified assembly is automatically booked using the veHaaS API
  • A secure SSH connections is established to the allocated veHaaS VM using the credentials provided by the veHaaS service
  • The CI script is directly executed on the veHaaS VM connected to the assembly
  • After job completion the assembly session is automatically released

create-assembly-upload-profile