azure-pipelines.yml in r10k-3.3.0 vs azure-pipelines.yml in r10k-3.3.1
- old
+ new
@@ -1,80 +1,80 @@
+# Don't run Azure when a branch is updated, only when a PR is updated.
+# Prevents double builds when a PR is made from the main repo and not a fork.
+trigger: none
+pr:
+ autoCancel: true
+ branches:
+ include:
+ - '*'
+
pool:
- # self-hosted agent on Windows 10 1709 environment
+ # self-hosted agent on Windows 10 1903 environment
# includes newer Docker engine with LCOW enabled, new build of LCOW image
- # includes Ruby 2.5, Go 1.10, Node.js 10.10, hadolint
+ # includes Ruby 2.5, Go 1.10, Node.js 10.10
name: Default
variables:
NAMESPACE: puppet
+ CONTAINER_NAME: r10k
+ CONTAINER_BUILD_PATH: .
+ LINT_IGNORES: DL3008 DL3018 DL4000 DL4001 DL3028
+workspace:
+ clean: resources
+
steps:
-- checkout: self
- clean: true
+- checkout: self # self represents the repo where the initial Pipelines YAML file was found
+ clean: true # whether to fetch clean each time
+
- powershell: |
- $line = '=' * 80
- Write-Host "$line`nWindows`n$line`n"
- Get-ComputerInfo |
- select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer |
- Out-String |
- Write-Host
- #
- # Azure
- #
- $assetTag = Get-WmiObject -class Win32_SystemEnclosure -namespace root\CIMV2 |
- Select -ExpandProperty SMBIOSAssetTag
- if ($assetTag -eq '7783-7084-3265-9085-8269-3286-77')
- {
- Write-Host "`n`n$line`nAzure`n$line`n"
- Invoke-RestMethod -Headers @{'Metadata'='true'} -URI http://169.254.169.254/metadata/instance?api-version=2017-12-01 -Method Get |
- ConvertTo-Json -Depth 10 |
- Write-Host
- }
- #
- # Docker
- #
- Write-Host "`n`n$line`nDocker`n$line`n"
- docker version
- docker images
- docker info
- sc.exe qc docker
- #
- # Ruby
- #
- Write-Host "`n`n$line`nRuby`n$line`n"
- ruby --version
- gem --version
- gem env
- bundle --version
- #
- # Environment
- #
- Write-Host "`n`n$line`nEnvironment`n$line`n"
- Get-ChildItem Env: | % { Write-Host "$($_.Key): $($_.Value)" }
+ $gemfile = Join-Path -Path (Get-Location) -ChildPath 'docker/Gemfile'
+ $gempath = Join-Path -Path (Get-Location) -ChildPath 'docker/.bundle/gems'
+ bundle config --local gemfile $gemfile
+ bundle config --local path $gempath
+ bundle install
+ displayName: Fetch Dependencies
+ name: fetch_deps
+
+- powershell: |
+ . "$(bundle show pupperware)/ci/build.ps1"
+ Write-HostDiagnostics
displayName: Diagnostic Host Information
name: hostinfo
+
- powershell: |
- . ./docker/ci/build.ps1
- Lint-Dockerfile -Path ./docker/r10k/Dockerfile
- displayName: Lint r10k Dockerfile
+ . "$(bundle show pupperware)/ci/build.ps1"
+ Lint-Dockerfile -Name $ENV:CONTAINER_NAME -Ignore ($ENV:LINT_IGNORES -split ' ')
+ displayName: Lint $(CONTAINER_NAME) Dockerfile
name: lint_dockerfile
+
- powershell: |
- . ./docker/ci/build.ps1
- Build-Container -Namespace $ENV:NAMESPACE
- displayName: Build r10k Container
- name: build_r10k_container
+ . "$(bundle show pupperware)/ci/build.ps1"
+ Build-Container -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE -PathOrUri $ENV:CONTAINER_BUILD_PATH
+ displayName: Build $(CONTAINER_NAME) Container
+ name: build_container
+
- powershell: |
- . ./docker/ci/build.ps1
- Invoke-ContainerTest -Namespace $ENV:NAMESPACE
- displayName: Test r10k
- name: test_r10k
+ . "$(bundle show pupperware)/ci/build.ps1"
+ Initialize-TestEnv
+ displayName: Prepare Test Environment
+ name: test_prepare
+
+- powershell: |
+ . "$(bundle show pupperware)/ci/build.ps1"
+ Invoke-ContainerTest -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE
+ displayName: Test $(CONTAINER_NAME)
+ name: test_container
+
- task: PublishTestResults@2
- displayName: Publish r10k test results
+ displayName: Publish $(CONTAINER_NAME) test results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'docker/TEST-*.xml'
- testRunTitle: r10k Test Results
+ testRunTitle: $(CONTAINER_NAME) Test Results
+
- powershell: |
- . ./docker/ci/build.ps1
- Clear-ContainerBuilds -Name r10k
+ . "$(bundle show pupperware)/ci/build.ps1"
+ Clear-BuildState -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE
displayName: Container Cleanup
+ timeoutInMinutes: 3
condition: always()