Skip to main content

GitLab CI/CD

The fore ai GitLab CI/CD component runs fore ai tests using the GitLab CI/CD component catalog.

Component catalog: gitlab.com/explore/catalog/foreai-co/cj-action

Prerequisites

Add your fore ai service account key as a GitLab CI/CD variable:

  1. Go to your GitLab project → SettingsCI/CDVariables
  2. Click Add variable
  3. Key: CRITICAL_JOURNEY_SERVICE_ACCOUNT_KEY
  4. Value: paste your service account key from the fore ai Settings page
  5. Enable Mask variable to keep the value out of job logs

Run a single test

include:
- component: gitlab.com/foreai-co/cj-action/critical-journey@<version>

run-critical-journey:
variables:
TEST_ID: "my-test-id"
SERVICE_ACCOUNT_KEY: $CRITICAL_JOURNEY_SERVICE_ACCOUNT_KEY

Run a test suite

include:
- component: gitlab.com/foreai-co/cj-action/critical-journey@<version>

run-critical-journey:
variables:
TEST_SUITE_ID: "my-test-suite-id"
SERVICE_ACCOUNT_KEY: $CRITICAL_JOURNEY_SERVICE_ACCOUNT_KEY
WAIT_TIMEOUT_SECONDS: "360"
WEBSITE_URL_OVERRIDE: "https://beta-dev.my-awesome.com/2"
PARAMS_OVERRIDE: '{ "param1": "value1", "param2": "value2" }'

Auto-create a GitLab issue on failure

When CREATE_ISSUE_ON_FAILURE is enabled, the component automatically creates a GitLab issue when the test run fails. You must provide a GITLAB_TOKEN with sufficient permissions to create issues in your project.

include:
- component: gitlab.com/foreai-co/cj-action/critical-journey@<version>

run-critical-journey:
variables:
TEST_SUITE_ID: "my-test-suite-id"
SERVICE_ACCOUNT_KEY: $CRITICAL_JOURNEY_SERVICE_ACCOUNT_KEY
CREATE_ISSUE_ON_FAILURE: "true"
GITLAB_TOKEN: $GITLAB_TOKEN

Available inputs

Pass these as CI/CD variables in your job's variables block.

VariableRequiredDefaultDescription
TEST_IDNo*ID of the test to run. Provide either this or TEST_SUITE_ID.
TEST_SUITE_IDNo*ID of the test suite to run.
SERVICE_ACCOUNT_KEYYesYour fore ai service account key.
WAIT_TIMEOUT_SECONDSNo300Max seconds to wait for completion. Must be between 30 and 900.
WEBSITE_URL_OVERRIDENoOverride the base website URL used during test execution.
PARAMS_OVERRIDENoOverride default parameter values. Must be a valid JSON string with string keys and values.
BROWSER_TYPE_OVERRIDENochromiumBrowser engine: chromium, firefox, or webkit.
CREATE_ISSUE_ON_FAILURENofalseIf true, creates a GitLab issue on test failure. Requires GITLAB_TOKEN.

* Either TEST_ID or TEST_SUITE_ID must be provided.