99  only_branch_master_parent_repo : &only_branch_master_parent_repo 
1010    - ' master@saltstack-formulas/postfix-formula' 
1111  #  `stage`
12+   stage_cache : &stage_cache 'cache' 
1213  stage_lint : &stage_lint 'lint' 
1314  stage_release : &stage_release 'release' 
1415  stage_test : &stage_test 'test' 
2627  #  yamllint enable rule:line-length
2728  #  `variables`
2829  #  https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
29-   #  https://bundler.io/v1.16/bundle_config .html
30+   #  https://bundler.io/v2.3/man/bundle-config.1 .html
3031  variables_bundler : &variables_bundler 
31-     BUNDLE_CACHE_PATH : ' ${CI_PROJECT_DIR}/.cache/bundler' 
32-     BUNDLE_WITHOUT : ' production' 
33-   #  `cache`
32+     BUNDLE_PATH : ' ${CI_PROJECT_DIR}/.cache/bundler' 
33+     BUNDLE_DEPLOYMENT : ' true' 
34+   bundle_install : &bundle_install 
35+     - ' bundle version' 
36+     - ' bundle config list' 
37+     #  `--no-cache` means don't bother caching the downloaded .gem files
38+     - ' time bundle install --no-cache' 
3439  cache_bundler : &cache_bundler 
35-     key : ' ${CI_JOB_STAGE}' 
40+     key :
41+       files :
42+         - ' Gemfile.lock' 
43+       prefix : ' bundler' 
3644    paths :
37-       - ' ${BUNDLE_CACHE_PATH}' 
45+       - ' ${BUNDLE_PATH}' 
46+   #  https://pre-commit.com/#gitlab-ci-example
47+   variables_pre-commit : &variables_pre-commit 
48+     PRE_COMMIT_HOME : ' ${CI_PROJECT_DIR}/.cache/pre-commit' 
49+   cache_pre-commit : &cache_pre-commit 
50+     key :
51+       files :
52+         - ' .pre-commit-config.yaml' 
53+       prefix : ' pre-commit' 
54+     paths :
55+       - ' ${PRE_COMMIT_HOME}' 
3856
3957# ##############################################################################
4058#  Define stages and global variables
4159# ##############################################################################
4260stages :
61+   - *stage_cache 
4362  - *stage_lint 
4463  - *stage_test 
4564  - *stage_release 
4665variables :
4766  DOCKER_DRIVER : ' overlay2' 
4867
68+ 
69+ # ##############################################################################
70+ #  `cache` stage: build up the bundler cache required before the `test` stage
71+ # ##############################################################################
72+ build-cache :
73+   stage : *stage_cache 
74+   image : *image_dindruby 
75+   variables : *variables_bundler 
76+   cache : *cache_bundler 
77+   script : *bundle_install 
78+ 
4979# ##############################################################################
5080#  `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
5181# ##############################################################################
52- commitlint :
82+ .lint_job :
5383  stage : *stage_lint 
84+   needs : [] 
85+ 
86+ commitlint :
87+   extends : ' .lint_job' 
5488  image : *image_commitlint 
5589  script :
5690    #  Add `upstream` remote to get access to `upstream/master`
@@ -75,15 +109,11 @@ commitlint:
75109                  --verbose'  
76110
77111pre-commit :
78-   stage :  *stage_lint 
112+   extends :  ' .lint_job ' 
79113  image : *image_precommit 
80114  #  https://pre-commit.com/#gitlab-ci-example
81-   variables :
82-     PRE_COMMIT_HOME : ' ${CI_PROJECT_DIR}/.cache/pre-commit' 
83-   cache :
84-     key : ' ${CI_JOB_NAME}' 
85-     paths :
86-       - ' ${PRE_COMMIT_HOME}' 
115+   variables : *variables_pre-commit 
116+   cache : *cache_pre-commit 
87117  script :
88118    - ' pre-commit run --all-files --color always --verbose' 
89119    - ' pre-commit run --color always --hook-stage manual commitlint-ci' 
@@ -95,8 +125,8 @@ pre-commit:
95125#  - Furthermore, this job uses all of the latest `rubocop` features & cops,
96126#    which will help when upgrading the `rubocop` linter used in `pre-commit`
97127rubocop :
128+   extends : ' .lint_job' 
98129  allow_failure : true 
99-   stage : *stage_lint 
100130  image : *image_rubocop 
101131  script :
102132    - ' rubocop -d -P -S --enable-pending-cops' 
@@ -109,12 +139,10 @@ rubocop:
109139  image : *image_dindruby 
110140  services : *services_docker_dind 
111141  variables : *variables_bundler 
112-   cache : *cache_bundler 
113-   before_script :
114-     #  TODO: This should work from the env vars above automatically
115-     - ' bundle config set path "${BUNDLE_CACHE_PATH}"' 
116-     - ' bundle config set without "${BUNDLE_WITHOUT}"' 
117-     - ' bundle install' 
142+   cache :
143+     << : *cache_bundler 
144+     policy : ' pull' 
145+   before_script : *bundle_install 
118146  script :
119147    #  Alternative value to consider: `${CI_JOB_NAME}`
120148    - ' bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"' 
@@ -160,44 +188,44 @@ rockylinux-8-master: {extends: '.test_instance_failure_permitted'}
160188ubuntu-2404-master : {extends: '.test_instance_failure_permitted'} 
161189ubuntu-2204-master : {extends: '.test_instance_failure_permitted'} 
162190ubuntu-2004-master : {extends: '.test_instance_failure_permitted'} 
163- almalinux-9-3007-2  : {extends: '.test_instance'} 
164- almalinux-8-3007-2  : {extends: '.test_instance'} 
165- amazonlinux-2023-3007-2  : {extends: '.test_instance'} 
166- amazonlinux-2-3007-2  : {extends: '.test_instance_failure_permitted'} 
167- centos-stream9-3007-2  : {extends: '.test_instance'} 
168- debian-12-3007-2  : {extends: '.test_instance'} 
169- debian-11-3007-2  : {extends: '.test_instance'} 
170- fedora-41-3007-2  : {extends: '.test_instance_failure_permitted'} 
171- fedora-40-3007-2  : {extends: '.test_instance'} 
172- opensuse-leap-156-3007-2  : {extends: '.test_instance'} 
173- opensuse-leap-155-3007-2  : {extends: '.test_instance'} 
174- opensuse-tmbl-latest-3007-2  : {extends: '.test_instance'} 
175- oraclelinux-9-3007-2  : {extends: '.test_instance'} 
176- oraclelinux-8-3007-2  : {extends: '.test_instance'} 
177- rockylinux-9-3007-2  : {extends: '.test_instance'} 
178- rockylinux-8-3007-2  : {extends: '.test_instance'} 
179- ubuntu-2404-3007-2  : {extends: '.test_instance'} 
180- ubuntu-2204-3007-2  : {extends: '.test_instance'} 
181- ubuntu-2004-3007-2  : {extends: '.test_instance'} 
182- almalinux-9-3006-10  : {extends: '.test_instance'} 
183- almalinux-8-3006-10  : {extends: '.test_instance'} 
184- amazonlinux-2023-3006-10  : {extends: '.test_instance'} 
185- amazonlinux-2-3006-10  : {extends: '.test_instance_failure_permitted'} 
186- centos-stream9-3006-10  : {extends: '.test_instance'} 
187- debian-12-3006-10  : {extends: '.test_instance'} 
188- debian-11-3006-10  : {extends: '.test_instance'} 
189- fedora-41-3006-10  : {extends: '.test_instance_failure_permitted'} 
190- fedora-40-3006-10  : {extends: '.test_instance'} 
191- opensuse-leap-156-3006-10  : {extends: '.test_instance'} 
192- opensuse-leap-155-3006-10  : {extends: '.test_instance'} 
193- opensuse-tmbl-latest-3006-10  : {extends: '.test_instance'} 
194- oraclelinux-9-3006-10  : {extends: '.test_instance'} 
195- oraclelinux-8-3006-10  : {extends: '.test_instance'} 
196- rockylinux-9-3006-10  : {extends: '.test_instance'} 
197- rockylinux-8-3006-10  : {extends: '.test_instance'} 
198- ubuntu-2404-3006-10  : {extends: '.test_instance'} 
199- ubuntu-2204-3006-10  : {extends: '.test_instance'} 
200- ubuntu-2004-3006-10  : {extends: '.test_instance'} 
191+ almalinux-9-3007-3  : {extends: '.test_instance'} 
192+ almalinux-8-3007-3  : {extends: '.test_instance'} 
193+ amazonlinux-2023-3007-3  : {extends: '.test_instance'} 
194+ amazonlinux-2-3007-3  : {extends: '.test_instance_failure_permitted'} 
195+ centos-stream9-3007-3  : {extends: '.test_instance'} 
196+ debian-12-3007-3  : {extends: '.test_instance'} 
197+ debian-11-3007-3  : {extends: '.test_instance'} 
198+ fedora-41-3007-3  : {extends: '.test_instance_failure_permitted'} 
199+ fedora-40-3007-3  : {extends: '.test_instance'} 
200+ opensuse-leap-156-3007-3  : {extends: '.test_instance'} 
201+ opensuse-leap-155-3007-3  : {extends: '.test_instance'} 
202+ opensuse-tmbl-latest-3007-3  : {extends: '.test_instance'} 
203+ oraclelinux-9-3007-3  : {extends: '.test_instance'} 
204+ oraclelinux-8-3007-3  : {extends: '.test_instance'} 
205+ rockylinux-9-3007-3  : {extends: '.test_instance'} 
206+ rockylinux-8-3007-3  : {extends: '.test_instance'} 
207+ ubuntu-2404-3007-3  : {extends: '.test_instance'} 
208+ ubuntu-2204-3007-3  : {extends: '.test_instance'} 
209+ ubuntu-2004-3007-3  : {extends: '.test_instance'} 
210+ almalinux-9-3006-11  : {extends: '.test_instance'} 
211+ almalinux-8-3006-11  : {extends: '.test_instance'} 
212+ amazonlinux-2023-3006-11  : {extends: '.test_instance'} 
213+ amazonlinux-2-3006-11  : {extends: '.test_instance_failure_permitted'} 
214+ centos-stream9-3006-11  : {extends: '.test_instance'} 
215+ debian-12-3006-11  : {extends: '.test_instance'} 
216+ debian-11-3006-11  : {extends: '.test_instance'} 
217+ fedora-41-3006-11  : {extends: '.test_instance_failure_permitted'} 
218+ fedora-40-3006-11  : {extends: '.test_instance'} 
219+ opensuse-leap-156-3006-11  : {extends: '.test_instance'} 
220+ opensuse-leap-155-3006-11  : {extends: '.test_instance'} 
221+ opensuse-tmbl-latest-3006-11  : {extends: '.test_instance'} 
222+ oraclelinux-9-3006-11  : {extends: '.test_instance'} 
223+ oraclelinux-8-3006-11  : {extends: '.test_instance'} 
224+ rockylinux-9-3006-11  : {extends: '.test_instance'} 
225+ rockylinux-8-3006-11  : {extends: '.test_instance'} 
226+ ubuntu-2404-3006-11  : {extends: '.test_instance'} 
227+ ubuntu-2204-3006-11  : {extends: '.test_instance'} 
228+ ubuntu-2004-3006-11  : {extends: '.test_instance'} 
201229#  yamllint enable rule:line-length
202230
203231# ##############################################################################
0 commit comments