Skip to main content

Azure DevOps

This section describes how to use the ConfigCat CLI in Azure DevOps Pipelines to scan your source code for feature flag and setting usages and upload the found code references to ConfigCat.

Configuration

  1. Create a new ConfigCat Management API credential and store its values in Azure DevOps Pipeline Variables with the following names: CONFIGCAT_API_USER, CONFIGCAT_API_PASS.

  2. Get your selected Config's ID.

  3. Create a new or open your existing azure-pipelines.yml file, and add the following job to your jobs definition.
    Don't forget to replace the PASTE-YOUR-CONFIG-ID-HERE value with your actual Config ID.

    - job: configcat_scan_and_upload
    container: configcat/cli:azure-devops-1.3.0
    pool:
    vmImage: ubuntu-latest
    steps:
    - checkout: self
    persistCredentials: true
    - script: configcat scan $(Build.Repository.LocalPath)
    --config-id=PASTE-YOUR-CONFIG-ID-HERE
    --repo=$(Build.Repository.Name)
    --branch=$(Build.SourceBranchName)
    --file-url-template="$(Build.Repository.Uri)?path={filePath}&version=GC{commitHash}&line={lineNumber}&lineStartColumn=1&lineEndColumn=1"
    --commit-url-template="$(Build.Repository.Uri)/commit/{commitHash}"
    --runner="ConfigCat Azure DevOps Job"
    --upload
    --non-interactive
    name: scan_repository
    env:
    CONFIGCAT_API_PASS: $(CONFIGCAT_API_PASS)
    CONFIGCAT_API_USER: $(CONFIGCAT_API_USER)
    info

    If you are using a different VCS than Azure DevOps' Git, you should set the --file-url-template and --commit-url-template according to your VCS provider.

  4. Commit & push your changes.

Scan reports are uploaded for each branch of your repository that triggers the job.