name: Instrumented Tests
trigger:
- main


pool:
 name: DockerBuildAgents

workspace:
  clean: all
steps:
- script: |
    docker --version
    echo =============================================
    echo Kill all running containers if existing
    echo =============================================
    docker container kill $(docker ps -q)
    echo =============================================
    echo Run unit and instrumented inside docker container
    echo =============================================
    docker run --privileged --cpus="3" --memory="12g" -v "$PWD":/home/gradle/ -w /home/gradle/ authclient.azurecr.io/samples/dbi-instrumented-api30 sh scripts/run-instrumented-tests.sh
  displayName: 'Build and test inside docker container'
- script: |
    echo =============================================
    echo Cleaning up build output that is owned by docker user rather than agent user
    echo =============================================
    docker run --privileged --cpus="3" --memory="12g" -v "$PWD":/home/gradle/ -w /home/gradle/ authclient.azurecr.io/samples/dbi-instrumented-api30 gradle clean
    echo =============================================
    echo prune containers to avoid running out of disk space - shutdown containers still exist on disk
    echo =============================================
    docker system prune -f
    echo =============================================
    echo Dump environment variables for build agent
    echo =============================================
    env
  condition: always()
  displayName: 'Cleanup'

Set up CI with Azure Pipelines
Set up CI with Azure Pipelines

[skip ci]