# 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="/files/7nL1pPvuzJq0Qc2mWVfM" 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="/files/qhq3pcf6XXXlyRsWc7Hq" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/gRsna1dYGNi6RWu4iemW" 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="/files/CRUnFJYE5TXyIXzpJEUP" 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="/files/SEaG7j7JEbwE4o3Lm0yI" 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="/files/bIRmtRJtJ86qy97VwdMS" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/7SU0hJWt8DQICk4u82oh" alt="" width="241"><figcaption></figcaption></figure>

<figure><img src="/files/yKZc3eLa6sNAKywCL3Ef" 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.simplifyqa.ai/marketplace/integrating-with-ci-cd-tools/gitlab.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
