Integrating CI/CD tools with Astra ensures that your security vulnerabilities are automatically scanned during your development pipeline, helping keep your projects secure with minimal effort.

Available CI/CD Integrations

  1. GitHub

  2. GitLab

  3. Jenkins

  4. Bitbucket

  5. Azure

  6. CircleCI

If you use a a different CI/CD tool, you can refer to the generic steps for starting audits via a simple API call via curl

You can configure your CI/CD pipeline to fail if high severity vulnerabilities are found

Step-by-Step Guide to CI/CD Integration

To get started with an integration:

  1. Login to your Astra Dashboard

  2. Navigate to the Pentest menu item, and open the project you want to audit from your CI/CD

  3. Go to the Integrations, and click on the icon of the CI/CD tool you use

  4. Activate the Integration, and follow the steps on the screen (or below)

GitHub

  1. Select GitHub app

  2. Choose the mode for the audit - Automated or Manual

  3. Sign in to your GitHub account and open the repository for the chosen project

  4. Go to Settings, select secrets and click on New repository secret

  5. Set name as ASTRA_ACCESS_TOKEN = and set the value as the token you copied from the dashboard

  6. Add a new step in your YAML file. We recommend to add this after the deploy step:

- shell: bash
  name: Run an Astra Pentest
  env:
    ASTRA_ACCESS_TOKEN: ${{ secrets.ASTRA_ACCESS_TOKEN }}
    ASTRA_PROJECT_ID: COPY-FROM-DASHBOARD
    ASTRA_AUDIT_MODE: automated
  run: |
    wget -O - https://git.io/JSHtC | bash

Gitlab

  1. Select the GitLab app

  2. Choose the mode for the audit - Automated or Manual

  3. Sign in to your GitLab account and open the repository for the chosen Astra project

  4. Go to Settings & choose CI/CD from the left navigation bar

  5. Go to Variables, click on Expand and click on Add variable

  6. Set ASTRA_ACCESS_TOKEN = and ASTRA_PROJECT_ID = variables, uncheck Mask Variable & Protect variable both

  7. Add the following step in your YAML file

pentest-job:
  stage: .post
  variables:
    ASTRA_AUDIT_MODE: automated
  script:
    - wget -O - https://git.io/JSHtC | bash

Jenkins

  1. Select the Jenkins app

  2. Choose the mode for the audit - Automated or Manual

  3. Add the following variables and stages to the Jenkins file of your repository (replace the values in ASTRA_PROJECT_ID and ASTRA_ACCESS_TOKEN as seen in the dashboard):

pipeline {
  agent any
  environment {
    ASTRA_PROJECT_ID = 'redacted'
    ASTRA_ACCESS_TOKEN = 'redacted'
    ASTRA_AUDIT_MODE = 'automated'
  }
  stages {
    stage('build') {
      steps {
        sh 'wget -O - https://git.io/JSHtC | bash'
      }
    }
}
}

BitBucket

  1. Select the BitBucket app

  2. Choose the mode for the audit - Automated or Manual

  3. Sign in to your Bitbucket account

  4. Click on Repositories and open the repository for the chosen project

  5. Click on Repository settings. Then, scroll down in the left navbar till Pipelines & click on Repository variables

  6. Add ASTRA_ACCESS_TOKEN = and ASTRA_PROJECT_ID = variables, uncheck Secured for both

  7. Add a new step in the pipeline YAML file. We recommend to add this after the deploy stage.

- step:
    name: 'Astra Pentest Job'
    script:
      - export ASTRA_AUDIT_MODE="automated"
      - wget -O - https://git.io/JSHtC | bash

Azure

  1. Select the Azure app

  2. Choose the mode for the audit - Automated or Manual

  3. Go to https://dev.azure.com and sign in to your account

  4. Choose your organization and choose your project from the Projects tab

  5. Click on Pipelines in the left navbar, and click on the pipeline for which you want to set up the pentest. Then Click on Edit

  6. In the pipeline YAML page, click on Variables

  7. Add ASTRA_ACCESS_TOKEN = and ASTRA_PROJECT_ID = variables, do not select Keep this value secret

  8. Add a new step in the pipeline YAML file. We recommend to add this after the deploy stage.

variables:
  ASTRA_AUDIT_MODE: "automated"
steps:
  - script: |
      wget -O - https://git.io/JSHtC | bash
    displayName: 'Run an Astra Pentest'

CircleCI

  1. Select the CircleCI app

  2. Choose the mode for the audit - Automated or Manual

  3. Sign in to your CircleCI account and open the repository for the chosen Astra project

  4. Add the environment variables to the CircleCI project, as provided in the Astra dashboard.

  1. Configure your config.yml in .circleci folder as follows:

astra-pentest-trigger:
    machine:
      image: ubuntu-2004:202008-01
    environment:
      ASTRA_AUDIT_MODE: automated
    steps:
        - run:
            command: wget -O - https://git.io/JSHtC | bash

Example:

workflows:
    version: x
    workflow-name:
        jobs:
            - job 1
            - job 2
            - astra-pentest-trigger

Need Advanced CI/CD Configuration?

To customize how your pipeline behaves after triggering a scan—such as failing on high-severity vulnerabilities or tuning polling intervals—refer to our detailed guide:

📄 Astra CI/CD scan configuration reference for DevSecOps pipelines

Includes details on ASTRA_JOB_EXIT_STRATEGY, refetch intervals, scan types, and more.