trigger: branches: include: - '*' tags: include: - '*' pr: branches: exclude: - '*' resources: - repo: self variables: tag: '$(Build.BuildId)' vmImage: 'ubuntu-latest' stages: - stage: Build displayName: Build jobs: - job: Build timeoutInMinutes: 120 displayName: Build pool: vmImage: $(vmImageName) name: Test-Rafael steps: - pwsh: .\build.ps1 name: build_images displayName: 'Build images' env: REGISTRY_USER: $(REGISTRY_USER) REGISTRY_PWD: $(REGISTRY_PWD) REGISTRY_PATH: $(REGISTRY_PATH) IMAGE_VERSION: $(Build.SourceBranchName) - pwsh: .\build.ps1 -RunTests name: run_tests displayName: 'Run tests' env: REGISTRY_USER: $(REGISTRY_USER) REGISTRY_PWD: $(REGISTRY_PWD) REGISTRY_PATH: $(REGISTRY_PATH) IMAGE_VERSION: $(Build.SourceBranchName) TESTDIR: '$(System.DefaultWorkingDirectory)/Tests' - task: PublishTestResults@2 name: publish_tests_results displayName: 'Publish Test Results' condition: and(not(canceled()), not(contains(variables['Build.SourceVersionMessage'], '[notest]'))) inputs: testResultsFormat: 'JUnit' # 'JUnit' | 'NUnit' | 'VSTest' | 'XUnit' | 'CTest'. Alias: testRunner. Required. Test result format. Default: JUnit. testResultsFiles: '**/*.xml' # string. Required. Test results files. Default: **/TEST-*.xml. searchFolder: '$(System.DefaultWorkingDirectory)/Tests' # string. Search folder. Default: $(System.DefaultWorkingDirectory). # mergeTestResults: true failTaskOnFailedTests: true failTaskOnFailureToPublishResults: true failTaskOnMissingResultsFile: true testRunTitle: Pester # Advanced #buildPlatform: # string. Alias: platform. Build Platform. #buildConfiguration: # string. Alias: configuration. Build Configuration. publishRunAttachments: true - pwsh: .\build.ps1 -Push name: push_containers displayName: 'Push images' # Only push if this is a tag, and the tests passed condition: or(and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')), contains(variables['Build.SourceVersionMessage'], '[push]')) env: REGISTRY_USER: $(REGISTRY_USER) REGISTRY_PWD: $(REGISTRY_PWD) REGISTRY_PATH: $(REGISTRY_PATH) IMAGE_VERSION: $(Build.SourceBranchName)