Skip to content

Commit

Permalink
Merge branch 'release/v1' into use-image-relocation-fork
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs authored Aug 30, 2022
2 parents 0f7a720 + ec1428f commit 547fa73
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 0 deletions.
85 changes: 85 additions & 0 deletions build/azure-pipelines.pr-automatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ pool:

variables:
GOVERSION: "1.18"
# Cache go modules and the results of go build/test
# Increment the version number prefix of the key and restoreKey to clear the cache
GOCACHE: $(Pipeline.Workspace)/.cache/go-build/
GOCACHE_KEY: 'v3 | go-build | "$(Agent.OS)" | go.sum'
GOCACHE_RESTOREKEYS: |
v3 | go-build | "$(Agent.OS)"
v3 | go-build | "$(Agent.OS)" | go.sum
# Use separate cache for the xbuild jobs, since they generate different outputs
GOXCACHE_KEY: 'v3 | go-xbuild | "$(Agent.OS)" | go.sum'
GOXCACHE_RESTOREKEYS: |
v3 | go-xbuild | "$(Agent.OS)"
v3 | go-xbuild | "$(Agent.OS)" | go.sum
GOMODCACHE: /home/vsts/go/pkg/mod
GOMODCACHE_KEY: 'v4 | go-pkg | "$(Agent.OS)" | go.sum'
GOMODCACHE_RESTOREKEYS: |
v4 | go-pkg | "$(Agent.OS)"
v4 | go-pkg | "$(Agent.OS)" | go.sum
stages:
- stage: Setup
Expand All @@ -34,6 +51,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: "$(GOVERSION)"
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage build
Expand All @@ -51,6 +80,19 @@ stages:
displayName: "Set Go Version"
inputs:
version: "$(GOVERSION)"
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
# Use special cache keys just for cross-compiled binaries
key: "$(GOXCACHE_KEY)"
restoreKeys: $(GOXCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage XBuildAll
Expand All @@ -68,6 +110,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: "$(GOVERSION)"
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage TestUnit
Expand All @@ -79,6 +133,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: "$(GOVERSION)"
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage Vet
Expand Down Expand Up @@ -110,6 +176,7 @@ stages:
windows:
poolName: "windows"
vmImage: ""
GOMODCACHE: "C:/Users/porterci/go/pkg/mod"
linux:
poolName: "Azure Pipelines"
vmImage: "ubuntu-latest"
Expand All @@ -127,6 +194,24 @@ stages:
displayName: "Set Go Version"
inputs:
version: "$(GOVERSION)"
# On windows, restoring the cache fails because go wrote the files as readonly, undo that before restoring the cached go mod directory
- task: CmdLine@2
displayName: Windows Cache Prep
condition: eq(variables.poolName, 'windows')
inputs:
script: "attrib -r $(GOMODCACHE)/*.* /s"
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent UseXBuildBinaries
displayName: "Configure Agent"
- script: mage -v TestSmoke
Expand Down
116 changes: 116 additions & 0 deletions build/azure-pipelines.release-template.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
variables: # these are really constants
vmImage: "ubuntu-latest"
GOVERSION: "1.18"
# Cache go modules and the results of go build/test
# Increment the version number prefix of the key and restoreKey to clear the cache
GOCACHE: $(Pipeline.Workspace)/.cache/go-build/
GOCACHE_KEY: 'v3 | go-build | "$(Agent.OS)" | go.sum'
GOCACHE_RESTOREKEYS: |
v3 | go-build | "$(Agent.OS)"
v3 | go-build | "$(Agent.OS)" | go.sum
# Use separate cache for the xbuild jobs, since they generate different outputs
GOXCACHE_KEY: 'v3 | go-xbuild | "$(Agent.OS)" | go.sum'
GOXCACHE_RESTOREKEYS: |
v3 | go-xbuild | "$(Agent.OS)"
v3 | go-xbuild | "$(Agent.OS)" | go.sum
GOMODCACHE: /home/vsts/go/pkg/mod
GOMODCACHE_KEY: 'v4 | go-pkg | "$(Agent.OS)" | go.sum'
GOMODCACHE_RESTOREKEYS: |
v4 | go-pkg | "$(Agent.OS)"
v4 | go-pkg | "$(Agent.OS)" | go.sum
parameters:
- name: goVersion
Expand Down Expand Up @@ -30,6 +48,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage build
Expand All @@ -49,6 +79,19 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
# Use special cache keys just for cross-compiled binaries
key: "$(GOXCACHE_KEY)"
restoreKeys: $(GOXCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage XBuildAll
Expand All @@ -68,6 +111,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage Vet
Expand All @@ -84,6 +139,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent
displayName: "Configure Agent"
- bash: mage TestUnit
Expand All @@ -105,6 +172,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent SetBinExecutable
displayName: "Configure Agent"
- script: mage -v TestIntegration
Expand All @@ -118,6 +197,7 @@ stages:
windows:
poolName: "windows"
vmImage: ""
GOMODCACHE: "C:/Users/porterci/go/pkg/mod"
linux:
poolName: "Azure Pipelines"
vmImage: "ubuntu-latest"
Expand All @@ -135,6 +215,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- script: go run mage.go ConfigureAgent UseXBuildBinaries
displayName: "Setup Bin"
- script: mage -v TestSmoke
Expand All @@ -153,6 +245,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- task: DownloadPipelineArtifact@2
displayName: "Download Cross-Compiled Porter Binaries"
inputs:
Expand All @@ -176,6 +280,18 @@ stages:
displayName: "Set Go Version"
inputs:
version: ${{parameters.goVersion}}
- task: Cache@2
displayName: Cache Go Packages
inputs:
key: "$(GOMODCACHE_KEY)"
restoreKeys: $(GOMODCACHE_RESTOREKEYS)
path: $(GOMODCACHE)
- task: Cache@2
displayName: Cache Go Build
inputs:
key: "$(GOCACHE_KEY)"
restoreKeys: $(GOCACHE_RESTOREKEYS)
path: $(GOCACHE)
- task: DownloadPipelineArtifact@2
displayName: "Download Cross-Compiled Porter Binaries"
inputs:
Expand Down

0 comments on commit 547fa73

Please sign in to comment.