> For the complete documentation index, see [llms.txt](https://docs.simplifyqa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.simplifyqa.ai/marketplace/integrating-with-ci-cd-tools/gitlab.md).

# Gitlab

SimplifyQA pipeline execution through GitLab CI/CD enables seamless test automation integrated into your DevOps workflow. This setup uses Docker containers to run SimplifyQA pipelines in a consistent and isolated environment.

### Setting up GitLab Runners

#### Step 1: Install a GitLab Runner

1. Log in to your runner machine.&#x20;
2. Download and install the GitLab Runner:&#x20;

```
curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
chmod +x /usr/local/bin/gitlab-runner 
```

3. Register the runner:

```
gitlab-runner register
```

* URL: Enter the GitLab instance URL (e.g., [https://gitlab.com](https://gitlab.com/) or self-hosted URL).&#x20;
* Registration Token: Obtain it from Settings → CI/CD → Runners in your GitLab project.&#x20;
* Description: Provide a meaningful name for the runner.&#x20;
* Executor: Choose docker as the executor.&#x20;

**Step 2: Configure the Runner**

1. Edit the configuration file (/etc/gitlab-runner/config.toml) and update the executor with Docker configuration:

```
concurrent = 4 
[[runners]] 
name = "gitlab-ci-demo" 
url = "https://gitlab.devopsark.com" 
id = 10 
token = "glrt-Dp-dHWyCxGzZ1ZmNbxTn" 
token_obtained_at = 2025-01-20T11:30:48Z 
token_expires_at = 0001-01-01T00:00:00Z 
executor = "docker" 
[runners.docker] 
  tls_verify = true 
  image = "registry.devopsark.com/simplifyqa/pipeline-executor/v2:latest" 
  privileged = true 
  disable_entrypoint_overwrite = false 
  oom_kill_disable = false 
  disable_cache = false 
  volumes = [ 
    "/cache", 
  ] 
  shm_size = 0 
  [runners.docker.volume_driver_ops] 
    "size" = "50G" 
  [runners.docker.auth_config] 
    "username" =  
    "password" =  
```

2. Restart the runner to apply the changes:

```
gitlab-runner restart
```

3. To start the gitlab runner:

```
gitlab-runner run
```

### Creating a Pipeline in SimplifyQA

* Log in to your SimplifyQA account and navigate to the Pipelines section from the left-hand panel. Click on the **+Pipeline** button to create a new pipeline.&#x20;
* Provide a meaningful and descriptive name for the pipeline to ensure easy identification.&#x20;
* Choose whether you want to execute a Test Case or a Suite, and specify the corresponding Test Case ID or Suite ID.&#x20;
* Select the appropriate Version and Execution Type for the pipeline.&#x20;
* Configure additional details:&#x20;
  * Machine Name: Specify the machine where the execution will take place.&#x20;
  * Environment: Choose the desired testing environment.&#x20;
  * Release and Sprint: Define the release and sprint for which you want to execute the pipeline.&#x20;
* Once all details have been filled in, click Save to finalize and create the pipeline.&#x20;

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FNHFqbHhP1ewuFw6MOnwC%2F0.jpg?alt=media&amp;token=d36e5e56-844d-4f67-9610-e4502f165a8f" alt=""><figcaption></figcaption></figure>

Configuring Variables for Pipeline Execution

* **INPUT\_PIPELINEID:** The ID of the pipeline to execute in SimplifyQA.&#x20;
* **INPUT\_APIKEY:** Your SimplifyQA key for authentication.&#x20;
  * Click on Manage account from by clicking on your profile dropdown&#x20;
  * Go to Security  -> Create & Manage API Token
  * Click **Generate Token**, name your token, and click **Save**.
  * Copy the generated API key and paste it into the configuration.
* **INPUT\_APIURL:** The URL of the SimplifyQA instance.&#x20;
* **INPUT\_THRESHOLD:** The threshold for execution results.&#x20;
* **INPUT\_VERBOSE:** Toggle for detailed logs (true or false).&#x20;

### Modify and Execute the Pipeline in GitLab

* Navigate to the project in GitLab.&#x20;
* If a new branch is required:&#x20;
  * Click on the **+** icon dropdown and select New Branch.&#x20;
  * Create the branch as needed.&#x20;
* Click on the **Edit** icon and choose **Web IDE** to open the editor.&#x20;

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FaLFKpSjKHsNTayNAv0GW%2Fgitlab.png?alt=media&amp;token=44d13fd9-2f48-4e63-bb0f-88bb8ba49700" alt=""><figcaption></figcaption></figure>

* The editor will redirect you to the .gitlab-ci.yml file.

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2F8H66Bu8poFdljJlAhYzY%2F2.jpg?alt=media&amp;token=546081b7-e691-49c1-ab95-145f6f0c7128" alt=""><figcaption></figcaption></figure>

* Make the necessary changes to the .gitlab-ci.yml file.&#x20;

**Below is a breakdown:**&#x20;

**Global Configuration**

* Stages: Defines the stage in which the job will execute:

```
simplifyqa-pipeline-execution-v2 
```

* Variables: Specifies global environment variables for Docker setup:

```
DOCKER_DRIVER: overlay2  
	DOCKER_TLS_CERTDIR: ' ' 
	DOCKER_HOST: tcp://docker:2375  
	DOCKER_IMAGE: registry.devopsark.com/simplifyqa/pipeline-executor/v2:latest 
```

* Services: Configures Docker-in-Docker (docker:dind) for containerized builds:

```
name: docker:dind 
alias: docker 
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FZCIm3vrIAmGDYU3nhsld%2F3.jpg?alt=media&amp;token=833d452e-8ad4-40fb-8dd9-c0765fae3a29" alt=""><figcaption></figcaption></figure>

**Pipeline Execution Jobs**

Job: \[Job ID]&#x20;

Runs a SimplifyQA pipeline with specific variables:&#x20;

\[Job ID]:

```
stage: simplifyqa-pipeline-execution-v2  
	image: docker:latest  
before_script:  
	- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --		password-stdin "$CI_REGISTRY" - docker pull $DOCKER_IMAGE  
script:  
	- docker run --rm  
	-e INPUT_PIPELINEID="$INPUT_PIPELINEID"  
	-e INPUT_APIKEY="$INPUT_APIKEY"  
	-e INPUT_APIURL="$INPUT_APIURL"  
	-e INPUT_THRESHOLD="$INPUT_THRESHOLD"  
	-e INPUT_VERBOSE="$INPUT_VERBOSE"  
	"$DOCKER_IMAGE"  
variables:  
	INPUT_PIPELINEID: [Job ID]  
	INPUT_APIKEY: [SimplifyQA Key] 
	INPUT_APIURL: [Simplifyqa URL] 
	INPUT_THRESHOLD: 100  
	INPUT_VERBOSE: true 
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2Fsrn0UQSw30l78kfUbrwi%2F4.jpg?alt=media&amp;token=7f856c61-75b9-4ce8-958e-04409e7a0cb0" alt=""><figcaption></figcaption></figure>

* Once changes are complete:&#x20;
  * Click on **Source Control.**&#x20;
  * Select **Commit** and push the changes to the respective branch.&#x20;
* Return to the GitLab project page.&#x20;
* From the left panel, navigate to **Build > Pipeline**.&#x20;
* The pipeline will run automatically on this page.&#x20;
* To view the job log, click on the **Status** of the pipeline.&#x20;

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FKtRPUTBTilC0q8x6Y95Z%2Fcicd%20-1.jpg?alt=media&amp;token=2e84bc49-32e3-485d-90ba-d335e68e24f6" alt=""><figcaption></figcaption></figure>

* To check the pipeline status with individual logs, click on the respective pipeline entry.

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FqcnohecATiXNFdzuVYnu%2F6.jpg?alt=media&amp;token=12085dce-4452-4b68-a878-09b1f1ed5bcf" alt="" width="241"><figcaption></figcaption></figure>

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2F4O7GQMeW3UJHiFFQGMaD%2F7.jpg?alt=media&amp;token=200b3881-3bf1-40f2-8b61-31e2226d8bc8" alt=""><figcaption></figcaption></figure>

* If needed, you can rerun the pipeline by clicking the Rerun icon.

### Frequently Asked Questions (FAQs)

<details>

<summary>Can I run test suites automatically on code push?</summary>

Yes. You can configure GitLab pipelines to trigger SimplifyQA test runs when code is pushed, a merge request is created, or a build is deployed.

</details>

<details>

<summary>How do I authenticate SimplifyQA in GitLab?</summary>

Use a SimplifyQA API token, which should be stored as a GitLab CI/CD secret variable for secure access. This token will be used in the API request to trigger the test execution.

</details>

<details>

<summary>Do I need a specific GitLab version or tier for integration?</summary>

No specific tier is required. Integration works with any GitLab CI/CD-enabled repository, including self-hosted and GitLab.com.

</details>

<details>

<summary>What happens if a test fails during the pipeline?</summary>

If a test fails:

* The pipeline step can be configured to fail the entire job
* Defects can be auto-logged to tools like Jira (if integrated)
* Notifications can be sent to the relevant stakeholders

</details>
