resources:
- repo: self

jobs:
- job: coverity
  displayName: 'Coverity'
  pool:
    vmImage: 'ubuntu-18.04'
  steps:
  - script: |
     cd $(Build.SourcesDirectory)/azure-pipelines/docker
     docker build -t libgit2/xenial --build-arg BASE=ubuntu:xenial -f xenial .
    displayName: 'Build Docker image'
  - task: Docker@0
    displayName: Analyze
    inputs:
      action: 'Run an image'
      imageName: libgit2/xenial
      volumes: |
       $(Build.SourcesDirectory):/home/libgit2/source
       $(Build.BinariesDirectory):/home/libgit2/build
      envVars: |
       COVERITY_TOKEN=$(COVERITY_TOKEN)
      workDir: '/home/libgit2/build'
      containerCommand: '/home/libgit2/source/azure-pipelines/coverity.sh'
      detached: false
