Skip to content

CI/CD: GitLab CI

Run your test suite in GitLab CI and upload the results to Sulu with suluctl — no test-framework plugins needed.

This is the same job the in-app Set up reporting dialog (Jobs page) generates, prefilled with your backend URL and project id.

Minimal example

yaml
# .gitlab-ci.yml
stages: [test]

test:
  stage: test
  variables:
    SULU_URL: "<your Sulu base URL>"
    SULU_PROJECT_ID: "<your project id>"
    SULU_LAUNCH_NAME: "CI · $CI_COMMIT_REF_NAME"
    # Add SULU_TOKEN as a masked CI/CD variable: Settings -> CI/CD -> Variables
  script:
    - <your test command>   # produce allure-results/ (or JUnit XML)
    - curl -fsSL https://raw.githubusercontent.com/ellyZz/suluctl/main/install.sh | sh
    - suluctl upload --results ./allure-results
    # tip: move the upload into after_script to also report failed test runs

Token storage

In your project's Settings → CI/CD → Variables, add a masked variable named SULU_TOKEN with an API token from Sulu (Profile → API keys). The job picks it up from the environment — never paste the token into the YAML.

Linking the launch back to the run

Include an executor.json file in your results directory; Sulu reads it during import and renders its buildUrl as the launch's external-run link:

yaml
  script:
    - <your test command>
    - |
      cat > allure-results/executor.json <<EOF
      {
        "name": "GitLab CI",
        "type": "gitlab",
        "buildName": "$CI_JOB_NAME #$CI_PIPELINE_IID",
        "buildUrl": "$CI_PIPELINE_URL"
      }
      EOF
    - curl -fsSL https://raw.githubusercontent.com/ellyZz/suluctl/main/install.sh | sh
    - suluctl upload --results ./allure-results

Runs dispatched from a Sulu Job get the CI run link automatically — no executor.json needed.

Per-MR launch names

SULU_LAUNCH_NAME is free text — compose it from GitLab's predefined variables, e.g. "CI · $CI_COMMIT_REF_NAME" per branch or "$CI_MERGE_REQUEST_TITLE" per merge request.

Streaming results live

Swap the separate test + upload lines for suluctl watch to see results appear in Sulu while the suite is still running:

yaml
  script:
    - curl -fsSL https://raw.githubusercontent.com/ellyZz/suluctl/main/install.sh | sh
    - suluctl watch --results ./allure-results -- <your test command>

watch always exits with your test command's exit code, so it's safe as the main test step. See Live streaming for what it does.

Sulu Test Management System