|
| 1 | +# Go |
| 2 | +# Build your Go project. |
| 3 | +# Add steps that test, save build artifacts, deploy, and more: |
| 4 | +# https://docs.microsoft.com/azure/devops/pipelines/languages/go |
| 5 | + |
| 6 | +trigger: |
| 7 | +- master |
| 8 | + |
| 9 | +pool: |
| 10 | + vmImage: 'ubuntu-latest' |
| 11 | + |
| 12 | +variables: |
| 13 | + GOBIN: '$(GOPATH)/bin' # Go binaries path |
| 14 | + GOROOT: '/usr/local/go1.11' # Go installation path |
| 15 | + GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path |
| 16 | + modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code |
| 17 | + |
| 18 | +steps: |
| 19 | +- script: | |
| 20 | + mkdir -p '$(GOBIN)' |
| 21 | + mkdir -p '$(GOPATH)/pkg' |
| 22 | + mkdir -p '$(modulePath)' |
| 23 | + shopt -s extglob |
| 24 | + shopt -s dotglob |
| 25 | + mv !(gopath) '$(modulePath)' |
| 26 | + echo '##vso[task.prependpath]$(GOBIN)' |
| 27 | + echo '##vso[task.prependpath]$(GOROOT)/bin' |
| 28 | + displayName: 'Set up the Go workspace' |
| 29 | + |
| 30 | +- script: | |
| 31 | + go version |
| 32 | + if [ -f Gopkg.toml ]; then |
| 33 | + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh |
| 34 | + dep ensure |
| 35 | + fi |
| 36 | + cd $(GOPATH) |
| 37 | + mkdir -p src/github.com/xenserver/ |
| 38 | + cd src/github.com/xenserver |
| 39 | + git clone https://github.com/xenserver/packer-builder-xenserver.git |
| 40 | + cd packer-builder-xenserver |
| 41 | + go get github.com/mitchellh/go-vnc |
| 42 | + go get github.com/mitchellh/gox |
| 43 | + ./build.sh |
| 44 | + workingDirectory: '$(modulePath)' |
| 45 | + displayName: 'Get dependencies, then build' |
| 46 | + |
| 47 | +- task: PublishPipelineArtifact@1 |
| 48 | + inputs: |
| 49 | + targetPath: '$(Pipeline.Workspace)' |
| 50 | + artifact: 'xs' |
| 51 | + publishLocation: 'pipeline' |
0 commit comments