Azure DevOps Integration

Follow this guide to integrate Lintify with your Azure DevOps repository using Azure Pipelines.

Configuration Steps

1. Add Azure Pipeline Configuration

Create a new file called azure-pipelines.yml in your repository with the following content:

trigger:
- '*'

pr:
  branches:
    include:
      - '*'

jobs:
- job: LintifyAnalysis
  displayName: Run Lintify
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - checkout: self
    fetchDepth: 0
  - script: |
      git fetch origin $(System.PullRequest.TargetBranch)
      git diff origin/$(System.PullRequest.TargetBranch) -- > diff.txt
  - task: Docker@2
    displayName: Run Lintify Docker Container
    inputs:
      command: run
      container: lintify-image:latest
      arguments: >
        -e PLATFORM=azure
        -e API_TOKEN=$(System.AccessToken)
        -e REPOSITORY=$(Build.Repository.Name)
        -e PULL_REQUEST_ID=$(System.PullRequest.PullRequestId)
        -v $(Build.SourcesDirectory)/diff.txt:/app/diff.txt
        analyze --diff /app/diff.txt

2. Configure Pipeline Permissions

The pipeline uses the following built-in variables and permissions:

  • System.AccessToken - Automatically provided by Azure Pipelines
  • System.PullRequest.PullRequestId - Pull request identifier
  • Build.Repository.Name - Your repository name

Important: Make sure to enable the "Contribute to pull requests" permission for your build service account in Project Settings → Repositories → Security.

3. Enable Pipeline

  1. Go to Pipelines in your Azure DevOps project
  2. Click "New Pipeline"
  3. Select your repository
  4. Choose "Existing Azure Pipelines YAML file" and select your configuration file
  5. Review and run the pipeline

How It Works

  1. When a pull request is created or updated, the pipeline automatically triggers.
  2. The pipeline checks out your code and generates a diff between the PR branch and the target branch.
  3. Lintify analyzes the changes and posts comments directly on your pull request.

Troubleshooting

Common issues and their solutions:

Pipeline permission issues

Ensure the build service account has sufficient permissions to comment on pull requests.

Docker task failures

Verify that the Docker task is correctly configured and the Lintify image is accessible.

Need More Help?

If you're experiencing issues with the Azure DevOps integration, our support team is here to help.