2019-06-16 04:08:12 +00:00
|
|
|
stages:
|
|
|
|
- status-pre
|
|
|
|
- build
|
|
|
|
- image
|
|
|
|
- publish
|
|
|
|
- status-post
|
|
|
|
|
|
|
|
# template jobs
|
|
|
|
|
|
|
|
.branch-deploy: &branch-deploy
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
|
|
|
|
.build-curl: &build-curl
|
|
|
|
image: apextoaster/base:1.2
|
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
|
|
|
|
|
|
|
.build-climate: &build-climate
|
|
|
|
image: apextoaster/code-climate:0.6
|
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
|
|
|
allow_failure: false
|
|
|
|
variables:
|
|
|
|
CI_BRANCH: "${CI_COMMIT_REF_NAME}"
|
|
|
|
GIT_BRANCH: "${CI_COMMIT_REF_NAME}"
|
|
|
|
GIT_COMMIT_SHA: "${CI_COMMIT_SHA}"
|
|
|
|
|
|
|
|
.build-codecov: &build-codecov
|
|
|
|
image: apextoaster/codecov:3.1
|
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
|
|
|
allow_failure: false
|
|
|
|
|
|
|
|
.build-docker: &build-docker
|
2019-10-30 23:53:44 +00:00
|
|
|
stage: image
|
2019-09-08 19:33:23 +00:00
|
|
|
image: docker:18.09.9
|
2019-06-16 04:08:12 +00:00
|
|
|
services:
|
2019-09-08 19:33:23 +00:00
|
|
|
- docker:18.09.9-dind
|
2019-06-16 04:08:12 +00:00
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
|
|
|
allow_failure: false
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
# prep secrets
|
|
|
|
- mkdir ${HOME}/.docker
|
|
|
|
- echo "${DOCKER_SECRET}" | base64 -d > ${HOME}/.docker/config.json
|
|
|
|
- docker info
|
2019-07-01 01:36:04 +00:00
|
|
|
script:
|
2019-10-30 23:53:44 +00:00
|
|
|
- docker build -f Dockerfile.${IMAGE_ARCH} -t ${IMAGE_TAG}-${IMAGE_ARCH} .
|
|
|
|
- docker push ${IMAGE_TAG}-${IMAGE_ARCH}
|
2019-11-01 10:05:09 +00:00
|
|
|
- |
|
2019-11-01 10:30:13 +00:00
|
|
|
if [[ "${DEFAULT_ARCH:-false}" = "true" ]];
|
|
|
|
then
|
|
|
|
docker tag ${IMAGE_TAG}-${IMAGE_ARCH} ${IMAGE_TAG}
|
2019-11-01 10:05:09 +00:00
|
|
|
docker push ${IMAGE_TAG}
|
2019-11-01 10:30:13 +00:00
|
|
|
fi
|
2019-11-01 10:05:09 +00:00
|
|
|
|
2019-06-16 04:08:12 +00:00
|
|
|
after_script:
|
|
|
|
- rm -rfv ${HOME}/.docker
|
|
|
|
|
2019-10-30 23:53:44 +00:00
|
|
|
dependencies:
|
|
|
|
- build-node
|
2019-06-16 04:08:12 +00:00
|
|
|
variables: &vars-docker
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
DOCKER_HOST: tcp://localhost:2375
|
2019-11-01 10:28:47 +00:00
|
|
|
DEFAULT_ARCH: "false"
|
2019-06-16 04:08:12 +00:00
|
|
|
|
|
|
|
.build-node: &build-node
|
2019-06-29 01:37:58 +00:00
|
|
|
image: apextoaster/node:11.15
|
2019-06-16 04:08:12 +00:00
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
|
|
|
allow_failure: false
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- echo "${NPM_SECRET}" | base64 -d > ${HOME}/.npmrc
|
|
|
|
|
|
|
|
.build-sonar: &build-sonar
|
|
|
|
image: apextoaster/sonar-scanner:3.3
|
|
|
|
tags:
|
|
|
|
- platform:k8s
|
|
|
|
- runner:shared
|
|
|
|
allow_failure: false
|
|
|
|
|
|
|
|
# build jobs
|
|
|
|
build-node:
|
|
|
|
<<: [*build-node]
|
|
|
|
stage: build
|
|
|
|
|
|
|
|
variables:
|
|
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
|
|
script:
|
2019-07-01 00:43:35 +00:00
|
|
|
- make clean-target build test
|
2019-06-16 04:08:12 +00:00
|
|
|
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week
|
|
|
|
paths:
|
2019-07-01 00:12:37 +00:00
|
|
|
- out/*.js
|
|
|
|
- out/*.js.map
|
2019-06-16 04:08:12 +00:00
|
|
|
cache:
|
|
|
|
key: "${CI_COMMIT_REF_SLUG}"
|
|
|
|
policy: pull-push
|
|
|
|
paths:
|
|
|
|
- node_modules
|
2019-07-01 00:12:37 +00:00
|
|
|
- out/cache
|
2019-06-16 04:08:12 +00:00
|
|
|
|
2019-10-31 12:34:39 +00:00
|
|
|
build-image-alpine-branch:
|
2019-06-16 04:08:12 +00:00
|
|
|
<<: [*build-docker]
|
2019-07-01 01:36:04 +00:00
|
|
|
except:
|
|
|
|
- tags
|
|
|
|
variables:
|
|
|
|
<<: [*vars-docker]
|
2019-11-01 10:05:09 +00:00
|
|
|
DEFAULT_ARCH: "true"
|
2019-10-30 23:53:44 +00:00
|
|
|
IMAGE_ARCH: alpine
|
2019-07-01 01:36:04 +00:00
|
|
|
IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_REF_SLUG}"
|
|
|
|
|
2019-10-31 12:34:39 +00:00
|
|
|
build-image-alpine-tag:
|
2019-07-01 01:36:04 +00:00
|
|
|
<<: [*build-docker]
|
|
|
|
only:
|
|
|
|
- tags
|
2019-10-30 23:53:44 +00:00
|
|
|
variables:
|
|
|
|
<<: [*vars-docker]
|
2019-11-01 10:05:09 +00:00
|
|
|
DEFAULT_ARCH: "true"
|
2019-10-30 23:53:44 +00:00
|
|
|
IMAGE_ARCH: alpine
|
|
|
|
IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_TAG}"
|
2019-07-01 01:36:04 +00:00
|
|
|
|
2019-10-30 23:53:44 +00:00
|
|
|
build-image-stretch-branch:
|
|
|
|
<<: [*build-docker]
|
|
|
|
except:
|
|
|
|
- tags
|
|
|
|
variables:
|
|
|
|
<<: [*vars-docker]
|
|
|
|
IMAGE_ARCH: stretch
|
|
|
|
IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_REF_SLUG}"
|
|
|
|
|
|
|
|
build-image-stretch-tag:
|
|
|
|
<<: [*build-docker]
|
|
|
|
only:
|
|
|
|
- tags
|
2019-07-01 01:36:04 +00:00
|
|
|
variables:
|
|
|
|
<<: [*vars-docker]
|
2019-10-30 23:53:44 +00:00
|
|
|
IMAGE_ARCH: stretch
|
2019-07-01 01:36:04 +00:00
|
|
|
IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_TAG}"
|
2019-06-16 04:08:12 +00:00
|
|
|
|
|
|
|
# publish jobs
|
|
|
|
publish-npm:
|
|
|
|
<<: [*build-node]
|
|
|
|
stage: publish
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
- build-node
|
|
|
|
script:
|
|
|
|
- npm publish
|
|
|
|
|
|
|
|
# commit status
|
|
|
|
github-pending:
|
|
|
|
<<: [*build-curl]
|
|
|
|
stage: status-pre
|
|
|
|
script:
|
|
|
|
- ./scripts/github-status.sh pending
|
|
|
|
|
|
|
|
github-failure:
|
|
|
|
<<: [*build-curl]
|
|
|
|
stage: status-post
|
|
|
|
when: on_failure
|
|
|
|
script:
|
|
|
|
- ./scripts/github-status.sh failure
|
|
|
|
|
|
|
|
github-success:
|
|
|
|
<<: [*build-curl]
|
|
|
|
stage: status-post
|
|
|
|
when: on_success
|
|
|
|
script:
|
|
|
|
- ./scripts/github-status.sh success
|