Go (With Modules)
Example Go (With Modules) Pipeline
Example Yaml configuration for a project building a Go binary with Go modules.
Scenario
User is looking to create a pipeline that builds an artifact on any event or branch pushed to source control.
Steps
The following pipeline concepts are being used in the pipeline below:
Note:
Pipeline must be stored in base of repository as .vela.yml
or .vela.yaml
It is recommended to pin image:
versions for production pipelines
version: "1"
steps:
- name: install
image: golang:latest
pull: always
environment:
CGO_ENABLED: '0'
GOOS: linux
commands:
- go get ./...
- name: test
image: golang:latest
pull: always
environment:
CGO_ENABLED: '0'
GOOS: linux
commands:
- go test ./...
- name: build
image: golang:latest
pull: always
environment:
CGO_ENABLED: '0'
GOOS: linux
commands:
- go build
Stages
The following pipeline concepts are being used in the pipeline below:
Note:
Pipeline must be stored in base of repository as .vela.yml
or .vela.yaml
It is recommended to pin image:
versions for production pipelines
version: "1"
stages:
install:
steps:
- name: install
image: golang:latest
pull: always
environment:
CGO_ENABLED: '0'
GOOS: linux
commands:
- go get ./...
test:
needs: [ install ]
steps:
- name: test
image: golang:latest
pull: always
environment:
CGO_ENABLED: '0'
GOOS: linux
commands:
- go test ./...
build:
needs: [ install ]
steps:
- name: build
image: golang:latest
pull: always
environment:
CGO_ENABLED: '0'
GOOS: linux
commands:
- go build
Last modified June 3, 2021: refactor: replace concepts with tour (#207) (aa0aceac)