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:
- Go to your GitLab project → Settings → CI/CD → Variables
- Click Add variable
- Key:
CRITICAL_JOURNEY_SERVICE_ACCOUNT_KEY - Value: paste your service account key from the fore ai Settings page
- 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.
| Variable | Required | Default | Description |
|---|---|---|---|
TEST_ID | No* | ID of the test to run. Provide either this or TEST_SUITE_ID. | |
TEST_SUITE_ID | No* | ID of the test suite to run. | |
SERVICE_ACCOUNT_KEY | Yes | Your fore ai service account key. | |
WAIT_TIMEOUT_SECONDS | No | 300 | Max seconds to wait for completion. Must be between 30 and 900. |
WEBSITE_URL_OVERRIDE | No | Override the base website URL used during test execution. | |
PARAMS_OVERRIDE | No | Override default parameter values. Must be a valid JSON string with string keys and values. | |
BROWSER_TYPE_OVERRIDE | No | chromium | Browser engine: chromium, firefox, or webkit. |
CREATE_ISSUE_ON_FAILURE | No | false | If true, creates a GitLab issue on test failure. Requires GITLAB_TOKEN. |
* Either TEST_ID or TEST_SUITE_ID must be provided.