1 # -*- coding: utf-8 -*-
4 ###############################################################################
5 # Define all YAML node anchors
6 ###############################################################################
8 # `only` (also used for `except` where applicable)
9 only_branch_master_parent_repo: &only_branch_master_parent_repo
10 - 'master@saltstack-formulas/arvados-formula'
12 stage_lint: &stage_lint 'lint'
13 stage_release: &stage_release 'release'
14 stage_test: &stage_test 'test'
16 image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
17 image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
18 image_precommit: &image_precommit
19 name: 'myii/ssf-pre-commit:2.9.2'
20 entrypoint: ['/bin/bash', '-c']
21 image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
23 services_docker_dind: &services_docker_dind
26 # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
27 # https://bundler.io/v1.16/bundle_config.html
28 variables_bundler: &variables_bundler
29 BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
30 BUNDLE_WITHOUT: 'production'
32 cache_bundler: &cache_bundler
33 key: '${CI_JOB_STAGE}'
35 - '${BUNDLE_CACHE_PATH}'
37 ###############################################################################
38 # Define stages and global variables
39 ###############################################################################
45 DOCKER_DRIVER: 'overlay2'
47 ###############################################################################
48 # `lint` stage: `commitlint` & `pre-commit`
49 ###############################################################################
52 image: *image_commitlint
54 # Add `upstream` remote to get access to `upstream/master`
55 - 'git remote add upstream ${CI_PROJECT_URL}.git'
57 # Set default commit hashes for `--from` and `--to`
58 - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
59 - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
60 # `coqbot` adds a merge commit to test PRs on top of the latest commit in
61 # the repo; amend this merge commit message to avoid failure
63 if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
64 && [ "${CI_COMMIT_BRANCH}" != "master" ]; then
65 git commit --amend -m \
66 'chore: reword coqbot merge commit message for commitlint'
67 export COMMITLINT_TO=HEAD
70 - 'commitlint --from "${COMMITLINT_FROM}"
71 --to "${COMMITLINT_TO}"
76 image: *image_precommit
77 # https://pre-commit.com/#gitlab-ci-example
79 PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
83 - '${PRE_COMMIT_HOME}'
85 - 'pre-commit run --all-files --color always --verbose'
87 ###############################################################################
88 # Define `test` template
89 ###############################################################################
92 image: *image_dindruby
93 services: *services_docker_dind
94 variables: *variables_bundler
97 # TODO: This should work from the env vars above automatically
98 - 'bundle config set path "${BUNDLE_CACHE_PATH}"'
99 - 'bundle config set without "${BUNDLE_WITHOUT}"'
102 # Alternative value to consider: `${CI_JOB_NAME}`
103 - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
105 ###############################################################################
106 # `test` stage: each instance below uses the `test` template above
107 ###############################################################################
108 ## Define the rest of the matrix based on Kitchen testing
109 # Make sure the instances listed below match up with
110 # the `platforms` defined in `kitchen.yml`
111 # api-debian-10-tiamat-py3: {extends: '.test_instance'}
112 # keepstore-debian-10-tiamat-py3: {extends: '.test_instance'}
113 # shell-debian-10-tiamat-py3: {extends: '.test_instance'}
114 # workbench-debian-10-tiamat-py3: {extends: '.test_instance'}
115 # api-debian-9-tiamat-py3: {extends: '.test_instance'}
116 # keepstore-debian-9-tiamat-py3: {extends: '.test_instance'}
117 # shell-debian-9-tiamat-py3: {extends: '.test_instance'}
118 # workbench-debian-9-tiamat-py3: {extends: '.test_instance'}
119 # api-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
120 # keepstore-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
121 # shell-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
122 # workbench-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
123 # api-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
124 # keepstore-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
125 # shell-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
126 # workbench-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
127 # api-centos-7-tiamat-py3: {extends: '.test_instance'}
128 # keepstore-centos-7-tiamat-py3: {extends: '.test_instance'}
129 # shell-centos-7-tiamat-py3: {extends: '.test_instance'}
130 # workbench-centos-7-tiamat-py3: {extends: '.test_instance'}
131 # api-debian-10-master-py3: {extends: '.test_instance'}
132 # keepstore-debian-10-master-py3: {extends: '.test_instance'}
133 # shell-debian-10-master-py3: {extends: '.test_instance'}
134 # workbench-debian-10-master-py3: {extends: '.test_instance'}
135 # api-ubuntu-2004-master-py3: {extends: '.test_instance'}
136 # keepstore-ubuntu-2004-master-py3: {extends: '.test_instance'}
137 # shell-ubuntu-2004-master-py3: {extends: '.test_instance'}
138 # workbench-ubuntu-2004-master-py3: {extends: '.test_instance'}
139 # api-ubuntu-1804-master-py3: {extends: '.test_instance'}
140 # keepstore-ubuntu-1804-master-py3: {extends: '.test_instance'}
141 # shell-ubuntu-1804-master-py3: {extends: '.test_instance'}
142 # workbench-ubuntu-1804-master-py3: {extends: '.test_instance'}
143 # api-debian-10-3001-py3: {extends: '.test_instance'}
144 # keepstore-debian-10-3001-py3: {extends: '.test_instance'}
145 # shell-debian-10-3001-py3: {extends: '.test_instance'}
146 # workbench-debian-10-3001-py3: {extends: '.test_instance'}
147 # api-debian-9-3001-py3: {extends: '.test_instance'}
148 # keepstore-debian-9-3001-py3: {extends: '.test_instance'}
149 # shell-debian-9-3001-py3: {extends: '.test_instance'}
150 # workbench-debian-9-3001-py3: {extends: '.test_instance'}
151 # api-ubuntu-2004-3001-py3: {extends: '.test_instance'}
152 # keepstore-ubuntu-2004-3001-py3: {extends: '.test_instance'}
153 # shell-ubuntu-2004-3001-py3: {extends: '.test_instance'}
154 # workbench-ubuntu-2004-3001-py3: {extends: '.test_instance'}
155 # api-ubuntu-1804-3001-py3: {extends: '.test_instance'}
156 # keepstore-ubuntu-1804-3001-py3: {extends: '.test_instance'}
157 # shell-ubuntu-1804-3001-py3: {extends: '.test_instance'}
158 # workbench-ubuntu-1804-3001-py3: {extends: '.test_instance'}
159 # api-centos-7-3001-py3: {extends: '.test_instance'}
160 # keepstore-centos-7-3001-py3: {extends: '.test_instance'}
161 shell-centos-7-3001-py3: {extends: '.test_instance'}
162 # workbench-centos-7-3001-py3: {extends: '.test_instance'}
163 # api-debian-10-3000-3-py3: {extends: '.test_instance'}
164 # keepstore-debian-10-3000-3-py3: {extends: '.test_instance'}
165 # shell-debian-10-3000-3-py3: {extends: '.test_instance'}
166 # workbench-debian-10-3000-3-py3: {extends: '.test_instance'}
167 # api-debian-9-3000-3-py3: {extends: '.test_instance'}
168 # keepstore-debian-9-3000-3-py3: {extends: '.test_instance'}
169 # shell-debian-9-3000-3-py3: {extends: '.test_instance'}
170 # workbench-debian-9-3000-3-py3: {extends: '.test_instance'}
171 # api-ubuntu-1804-3000-3-py3: {extends: '.test_instance'}
172 # keepstore-ubuntu-1804-3000-3-py3: {extends: '.test_instance'}
173 # shell-ubuntu-1804-3000-3-py3: {extends: '.test_instance'}
174 # workbench-ubuntu-1804-3000-3-py3: {extends: '.test_instance'}
175 # api-centos-7-3000-3-py3: {extends: '.test_instance'}
176 keepstore-centos-7-3000-3-py3: {extends: '.test_instance'}
177 # shell-centos-7-3000-3-py3: {extends: '.test_instance'}
178 # workbench-centos-7-3000-3-py3: {extends: '.test_instance'}
179 # api-ubuntu-1804-3000-3-py2: {extends: '.test_instance'}
180 # keepstore-ubuntu-1804-3000-3-py2: {extends: '.test_instance'}
181 # shell-ubuntu-1804-3000-3-py2: {extends: '.test_instance'}
182 # workbench-ubuntu-1804-3000-3-py2: {extends: '.test_instance'}
184 ###############################################################################
185 # `release` stage: `semantic-release`
186 ###############################################################################
188 only: *only_branch_master_parent_repo
189 stage: *stage_release
190 image: *image_semanticrelease
192 MAINTAINER_TOKEN: '${GH_TOKEN}'
194 # Update `AUTHORS.md`
195 - '${HOME}/go/bin/maintainer contributor'
196 # Run `semantic-release`