# Gitlab

# Pre-requisites

  • Ensure Docker is installed and Docker-in-Docker (dind) is configured in your GitLab runner.
  • Make sure your GitLab runner has permissions to pull Docker images from public ECR repositories.

# Setup Instructions

# 1. Create a .gitlab-ci.yml file in your repository root.

# 2. Insert this snippet for running tests using KushoAI:

stages:
  - test

variables:
  TEST_SUITE_UUID: ""
  ENVIRONMENT_ID: ""
  API_KEY: $KUSHOAI_API_KEY
  EMAIL: ""

test_kushoai:
  stage: test
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker pull public.ecr.aws/y5g4u6y7/kusho-jenkins-runner:latest
    - docker run --rm \
        -e TEST_SUITE_UUID="${TEST_SUITE_UUID}" \
        -e ENVIRONMENT_ID="${ENVIRONMENT_ID}" \
        -e API_KEY="${API_KEY}" \
        -e EMAIL="${EMAIL}" \
        public.ecr.aws/y5g4u6y7/kusho-jenkins-runner:latest

# 3. Add your API Key to GitLab CI/CD:

Navigate to your GitLab repository's Settings -> CI/CD -> Variables. Add a new variable named KUSHOAI_API_KEY with your KushoAI API key.

# 4. Add your Test Suite UUIDs to the snippet:

Navigate to Test Suites. Copy the UUIDs of the test suites you want to run and replace "" in the script. You can paste multiple comma-separated UUIDs to run multiple test suites.

# 5. Add comma-separated emails to receive the test report:

Update the EMAIL variable in the script to include the email addresses where you want the report sent. For multiple emails, simply add them in a comma-separated format, e.g., email1@example.com,email2@example.com. This is optional. If you don't provide an email, the report won't be sent via email.