2018-01-22 03:53:05 +00:00
|
|
|
stages:
|
2020-04-06 04:04:28 +00:00
|
|
|
- status-pre
|
2020-04-06 04:42:31 +00:00
|
|
|
- test
|
2018-01-22 03:53:05 +00:00
|
|
|
- build
|
2020-04-06 03:56:05 +00:00
|
|
|
- image
|
2020-04-06 04:04:28 +00:00
|
|
|
- status-post
|
2018-01-22 03:53:05 +00:00
|
|
|
|
2020-04-06 04:07:01 +00:00
|
|
|
.build-base:
|
2020-12-31 18:39:22 +00:00
|
|
|
image: apextoaster/base:1.4
|
2020-04-06 03:56:05 +00:00
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
2018-03-31 14:52:12 +00:00
|
|
|
|
2020-04-06 04:42:31 +00:00
|
|
|
.build-go:
|
2020-04-06 04:07:01 +00:00
|
|
|
extends:
|
|
|
|
- .build-base
|
|
|
|
stage: build
|
2020-04-06 04:42:31 +00:00
|
|
|
image: apextoaster/golang:1.14-master
|
2018-03-31 14:35:30 +00:00
|
|
|
variables:
|
|
|
|
GOPATH: /build
|
2020-04-06 04:42:31 +00:00
|
|
|
BUILD_OPTS: -a -v -x
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- make go-clean
|
2018-03-31 14:35:30 +00:00
|
|
|
|
2018-01-22 03:53:05 +00:00
|
|
|
artifacts:
|
|
|
|
expire_in: 1 hour
|
2020-04-06 04:42:31 +00:00
|
|
|
paths:
|
|
|
|
- bin/
|
|
|
|
|
|
|
|
cache: &go-cache
|
2018-03-31 14:52:12 +00:00
|
|
|
paths:
|
|
|
|
- vendor
|
2020-04-06 04:42:31 +00:00
|
|
|
policy: pull
|
2018-03-31 14:52:12 +00:00
|
|
|
|
2020-04-06 04:42:31 +00:00
|
|
|
test-go:
|
|
|
|
extends:
|
|
|
|
- .build-go
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- make go-test
|
|
|
|
cache:
|
|
|
|
<<: *go-cache
|
|
|
|
policy: pull-push
|
|
|
|
|
|
|
|
build-go-darwin-x86:
|
|
|
|
extends:
|
|
|
|
- .build-go
|
|
|
|
script:
|
|
|
|
- GOOS=darwin GOARCH=386 make go-build
|
|
|
|
- GOOS=darwin GOARCH=amd64 make go-build
|
|
|
|
|
|
|
|
build-go-linux-arm:
|
|
|
|
extends:
|
|
|
|
- .build-go
|
|
|
|
script:
|
|
|
|
- GOOS=linux GOARCH=arm make go-build
|
|
|
|
- GOOS=linux GOARCH=arm64 make go-build
|
|
|
|
|
|
|
|
build-go-linux-x86:
|
|
|
|
extends:
|
|
|
|
- .build-go
|
|
|
|
script:
|
|
|
|
- GOOS=linux GOARCH=386 make go-build
|
|
|
|
- GOOS=linux GOARCH=amd64 make go-build
|
|
|
|
|
|
|
|
build-go-windows-x86:
|
|
|
|
extends:
|
|
|
|
- .build-go
|
|
|
|
script:
|
|
|
|
- GOOS=windows GOARCH=386 make go-build
|
|
|
|
- GOOS=windows GOARCH=amd64 make go-build
|
|
|
|
|
|
|
|
# always build an image (tagged by branch), publish tags to latest
|
|
|
|
.build-docker:
|
2020-04-06 04:07:01 +00:00
|
|
|
extends:
|
|
|
|
- .build-base
|
2020-04-06 03:56:05 +00:00
|
|
|
image: apextoaster/docker:18.09
|
2018-01-22 03:53:05 +00:00
|
|
|
services:
|
2020-04-06 03:56:05 +00:00
|
|
|
- apextoaster/docker-dind:18.09
|
2020-04-06 04:42:31 +00:00
|
|
|
variables: &vars-docker
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
DOCKER_HOST: tcp://localhost:2375
|
2020-04-06 03:56:05 +00:00
|
|
|
|
2018-03-31 14:35:30 +00:00
|
|
|
before_script:
|
2020-04-06 03:56:05 +00:00
|
|
|
- mkdir ${HOME}/.docker
|
|
|
|
- echo "${DOCKER_SECRET}" | base64 -d > ${HOME}/.docker/config.json
|
2018-03-31 14:35:30 +00:00
|
|
|
script:
|
2020-04-06 04:42:31 +00:00
|
|
|
- ./scripts/docker-build.sh --push --default
|
2020-04-06 03:56:05 +00:00
|
|
|
after_script:
|
|
|
|
- rm -rfv ${HOME}/.docker
|
|
|
|
|
2020-04-06 04:42:31 +00:00
|
|
|
build-image:
|
|
|
|
extends:
|
|
|
|
- .build-docker
|
|
|
|
stage: image
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
- build-go-linux-x86
|
2018-01-22 03:53:05 +00:00
|
|
|
variables:
|
2020-04-06 04:05:21 +00:00
|
|
|
IMAGE_ARCH: ubuntu
|
2020-04-06 04:04:28 +00:00
|
|
|
|
2020-04-06 04:42:31 +00:00
|
|
|
build-binary:
|
|
|
|
extends:
|
|
|
|
- .build-base
|
|
|
|
stage: image
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- tags
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
- build-go-darwin-x86
|
|
|
|
- build-go-linux-arm
|
|
|
|
- build-go-linux-x86
|
|
|
|
- build-go-windows-x86
|
|
|
|
|
|
|
|
script:
|
|
|
|
- make bundle-all
|
|
|
|
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
paths:
|
|
|
|
- bin/
|
|
|
|
|
2020-04-06 04:04:28 +00:00
|
|
|
github-pending:
|
|
|
|
stage: status-pre
|
|
|
|
extends:
|
|
|
|
- .build-base
|
|
|
|
script:
|
|
|
|
- ./scripts/github-status.sh pending
|
|
|
|
|
|
|
|
github-failure:
|
|
|
|
stage: status-post
|
|
|
|
extends:
|
|
|
|
- .build-base
|
|
|
|
when: on_failure
|
|
|
|
script:
|
|
|
|
- ./scripts/github-status.sh failure
|
|
|
|
|
|
|
|
github-success:
|
|
|
|
stage: status-post
|
|
|
|
extends:
|
|
|
|
- .build-base
|
|
|
|
when: on_success
|
|
|
|
script:
|
|
|
|
- ./scripts/github-status.sh success
|