Skip to content

Commit 9582398

Browse files
authored
Merge pull request #35 from sylvainfaivre/update-ci
ci: use latest test images
2 parents 3fd86a5 + d9514b0 commit 9582398

File tree

9 files changed

+764
-660
lines changed

9 files changed

+764
-660
lines changed

.gitlab-ci.yml

Lines changed: 78 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,82 @@
99
only_branch_master_parent_repo: &only_branch_master_parent_repo
1010
- 'master@saltstack-formulas/syslog-ng-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'
1516
# `image`
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_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
22-
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
17+
# yamllint disable rule:line-length
18+
image_commitlint: &image_commitlint 'techneg/ci-commitlint:v1.1.91@sha256:02574d0409adafb76d5a40a7d08202073e5377f4a7c4bfe9e198d1203ff94a8c'
19+
image_dindruby: &image_dindruby 'techneg/ci-docker-python-ruby:v2.2.60@sha256:de98b8d1d3cf86639fe69bfc4f0416115d18300759c5ed2948ac56f973dd944f'
20+
image_dindrubybionic: &image_dindrubybionic 'techneg/ci-docker-python-ruby:v2.2.60@sha256:de98b8d1d3cf86639fe69bfc4f0416115d18300759c5ed2948ac56f973dd944f'
21+
image_precommit: &image_precommit 'techneg/ci-pre-commit:v2.4.25@sha256:ff5192e893c1079fbf70e3ce6bfc3773815041786a75659793158be930ba7803'
22+
image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest@sha256:fe69f9642c7edde46bbd78326d2c42c6e13fc73694efb142e92e206725479328'
23+
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14@sha256:374f588420087517a3cc0235e11293bffd72d7a59da3d98d5e69f014ff2a7761'
2324
# `services`
2425
services_docker_dind: &services_docker_dind
25-
- 'docker:dind'
26+
- 'docker:28.2.2-dind@sha256:d4668861cabc1691635d98e827a81cfa834a416f8fe0f4efc609f9f806d86d82'
27+
# yamllint enable rule:line-length
2628
# `variables`
2729
# https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
28-
# https://bundler.io/v1.16/bundle_config.html
30+
# https://bundler.io/v2.3/man/bundle-config.1.html
2931
variables_bundler: &variables_bundler
30-
BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
31-
BUNDLE_WITHOUT: 'production'
32-
# `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'
3339
cache_bundler: &cache_bundler
34-
key: '${CI_JOB_STAGE}'
40+
key:
41+
files:
42+
- 'Gemfile.lock'
43+
prefix: 'bundler'
3544
paths:
36-
- '${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}'
3756

3857
###############################################################################
3958
# Define stages and global variables
4059
###############################################################################
4160
stages:
61+
- *stage_cache
4262
- *stage_lint
4363
- *stage_test
4464
- *stage_release
4565
variables:
4666
DOCKER_DRIVER: 'overlay2'
4767

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+
4879
###############################################################################
4980
# `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
5081
###############################################################################
51-
commitlint:
82+
.lint_job:
5283
stage: *stage_lint
84+
needs: []
85+
86+
commitlint:
87+
extends: '.lint_job'
5388
image: *image_commitlint
5489
script:
5590
# Add `upstream` remote to get access to `upstream/master`
@@ -74,17 +109,14 @@ commitlint:
74109
--verbose'
75110

76111
pre-commit:
77-
stage: *stage_lint
112+
extends: '.lint_job'
78113
image: *image_precommit
79114
# https://pre-commit.com/#gitlab-ci-example
80-
variables:
81-
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
82-
cache:
83-
key: '${CI_JOB_NAME}'
84-
paths:
85-
- '${PRE_COMMIT_HOME}'
115+
variables: *variables_pre-commit
116+
cache: *cache_pre-commit
86117
script:
87118
- 'pre-commit run --all-files --color always --verbose'
119+
- 'pre-commit run --color always --hook-stage manual commitlint-ci'
88120

89121
# Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
90122
# - The `pre-commit` check will only be available for formulas that pass the default
@@ -93,8 +125,8 @@ pre-commit:
93125
# - Furthermore, this job uses all of the latest `rubocop` features & cops,
94126
# which will help when upgrading the `rubocop` linter used in `pre-commit`
95127
rubocop:
128+
extends: '.lint_job'
96129
allow_failure: true
97-
stage: *stage_lint
98130
image: *image_rubocop
99131
script:
100132
- 'rubocop -d -P -S --enable-pending-cops'
@@ -107,12 +139,10 @@ rubocop:
107139
image: *image_dindruby
108140
services: *services_docker_dind
109141
variables: *variables_bundler
110-
cache: *cache_bundler
111-
before_script:
112-
# TODO: This should work from the env vars above automatically
113-
- 'bundle config set path "${BUNDLE_CACHE_PATH}"'
114-
- 'bundle config set without "${BUNDLE_WITHOUT}"'
115-
- 'bundle install'
142+
cache:
143+
<<: *cache_bundler
144+
policy: 'pull'
145+
before_script: *bundle_install
116146
script:
117147
# Alternative value to consider: `${CI_JOB_NAME}`
118148
- 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
@@ -131,69 +161,25 @@ rubocop:
131161
# Make sure the instances listed below match up with
132162
# the `platforms` defined in `kitchen.yml`
133163
# yamllint disable rule:line-length
134-
# default-debian-11-tiamat-py3: {extends: '.test_instance'}
135-
# default-debian-10-tiamat-py3: {extends: '.test_instance'}
136-
# default-debian-9-tiamat-py3: {extends: '.test_instance'}
137-
# default-ubuntu-2204-tiamat-py3: {extends: '.test_instance_failure_permitted'}
138-
# default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
139-
# default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
140-
# default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'}
141-
# default-centos-7-tiamat-py3: {extends: '.test_instance'}
142-
# default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
143-
# default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
144-
# default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
145-
# default-almalinux-8-tiamat-py3: {extends: '.test_instance'}
146-
# default-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
147-
default-debian-11-master-py3: {extends: '.test_instance'}
148-
default-debian-10-master-py3: {extends: '.test_instance'}
149-
default-debian-9-master-py3: {extends: '.test_instance'}
150-
default-ubuntu-2204-master-py3: {extends: '.test_instance_failure_permitted'}
151-
default-ubuntu-2004-master-py3: {extends: '.test_instance'}
152-
default-ubuntu-1804-master-py3: {extends: '.test_instance'}
153-
default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
154-
default-centos-7-master-py3: {extends: '.test_instance'}
155-
default-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'}
156-
default-fedora-35-master-py3: {extends: '.test_instance'}
157-
default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
158-
default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
159-
default-amazonlinux-2-master-py3: {extends: '.test_instance'}
160-
default-oraclelinux-8-master-py3: {extends: '.test_instance'}
161-
default-oraclelinux-7-master-py3: {extends: '.test_instance'}
162-
default-arch-base-latest-master-py3: {extends: '.test_instance'}
163-
default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
164-
default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
165-
default-almalinux-8-master-py3: {extends: '.test_instance'}
166-
default-rockylinux-8-master-py3: {extends: '.test_instance'}
167-
# default-debian-11-3004-1-py3: {extends: '.test_instance'}
168-
# default-debian-10-3004-1-py3: {extends: '.test_instance'}
169-
# default-debian-9-3004-1-py3: {extends: '.test_instance'}
170-
# default-ubuntu-2204-3004-1-py3: {extends: '.test_instance_failure_permitted'}
171-
# default-ubuntu-2004-3004-1-py3: {extends: '.test_instance'}
172-
# default-ubuntu-1804-3004-1-py3: {extends: '.test_instance'}
173-
# default-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'}
174-
# default-centos-7-3004-1-py3: {extends: '.test_instance'}
175-
# default-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'}
176-
# default-fedora-35-3004-1-py3: {extends: '.test_instance'}
177-
# default-amazonlinux-2-3004-1-py3: {extends: '.test_instance'}
178-
# default-oraclelinux-8-3004-1-py3: {extends: '.test_instance'}
179-
# default-oraclelinux-7-3004-1-py3: {extends: '.test_instance'}
180-
# default-arch-base-latest-3004-1-py3: {extends: '.test_instance'}
181-
# default-gentoo-stage3-latest-3004-1-py3: {extends: '.test_instance'}
182-
# default-gentoo-stage3-systemd-3004-1-py3: {extends: '.test_instance'}
183-
# default-almalinux-8-3004-1-py3: {extends: '.test_instance'}
184-
# default-rockylinux-8-3004-1-py3: {extends: '.test_instance'}
185-
# default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'}
186-
# default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'}
187-
# default-debian-10-3003-4-py3: {extends: '.test_instance'}
188-
# default-debian-9-3003-4-py3: {extends: '.test_instance'}
189-
# default-ubuntu-2004-3003-4-py3: {extends: '.test_instance'}
190-
# default-ubuntu-1804-3003-4-py3: {extends: '.test_instance'}
191-
# default-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'}
192-
# default-centos-7-3003-4-py3: {extends: '.test_instance'}
193-
# default-amazonlinux-2-3003-4-py3: {extends: '.test_instance'}
194-
# default-oraclelinux-8-3003-4-py3: {extends: '.test_instance'}
195-
# default-oraclelinux-7-3003-4-py3: {extends: '.test_instance'}
196-
# default-almalinux-8-3003-4-py3: {extends: '.test_instance'}
164+
default-debian-12-master: {extends: '.test_instance_failure_permitted'}
165+
default-debian-11-master: {extends: '.test_instance_failure_permitted'}
166+
default-ubuntu-2404-master: {extends: '.test_instance_failure_permitted'}
167+
default-ubuntu-2204-master: {extends: '.test_instance_failure_permitted'}
168+
default-opensuse-leap-156-master: {extends: '.test_instance_failure_permitted'}
169+
default-fedora-40-master: {extends: '.test_instance_failure_permitted'}
170+
default-debian-12-3007-4: {extends: '.test_instance'}
171+
default-debian-11-3007-4: {extends: '.test_instance'}
172+
default-ubuntu-2404-3007-4: {extends: '.test_instance'}
173+
default-ubuntu-2204-3007-4: {extends: '.test_instance'}
174+
default-opensuse-leap-156-3007-4: {extends: '.test_instance'}
175+
default-fedora-40-3007-4: {extends: '.test_instance'}
176+
default-debian-12-3006-12: {extends: '.test_instance'}
177+
default-debian-11-3006-12: {extends: '.test_instance'}
178+
default-ubuntu-2404-3006-12: {extends: '.test_instance'}
179+
default-ubuntu-2204-3006-12: {extends: '.test_instance'}
180+
default-opensuse-leap-156-3006-12: {extends: '.test_instance'}
181+
default-fedora-40-3006-12: {extends: '.test_instance'}
182+
197183
# yamllint enable rule:line-length
198184

199185
###############################################################################

.pre-commit-config.yaml

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,63 +15,101 @@ ci:
1515
autoupdate_schedule: quarterly
1616
skip: []
1717
submodules: false
18-
default_stages: [commit]
18+
default_stages: [pre-commit]
1919
repos:
20-
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
21-
rev: v2.3.0
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: v5.0.0
22+
hooks:
23+
- id: check-merge-conflict
24+
name: Check for Git merge conflicts
25+
args: [--assume-in-merge]
26+
exclude: ^docs/AUTHORS.rst$
27+
- repo: https://github.com/dafyddj/mirrors-commitlint
28+
rev: v19.8.1
2229
hooks:
2330
- id: commitlint
24-
name: Check commit message using commitlint
25-
description: Lint commit message against @commitlint/config-conventional rules
26-
stages: [commit-msg]
27-
additional_dependencies: ['@commitlint/[email protected]']
28-
- id: commitlint-travis
29-
stages: [manual]
30-
additional_dependencies: ['@commitlint/[email protected]']
31-
always_run: true
31+
- id: commitlint-ci
3232
- repo: https://github.com/rubocop-hq/rubocop
33-
rev: v1.30.1
33+
rev: v1.76.1
3434
hooks:
3535
- id: rubocop
3636
name: Check Ruby files with rubocop
3737
args: [--debug]
38-
always_run: true
39-
pass_filenames: false
4038
- repo: https://github.com/shellcheck-py/shellcheck-py
41-
rev: v0.8.0.4
39+
rev: v0.9.0.6
4240
hooks:
4341
- id: shellcheck
4442
name: Check shell scripts with shellcheck
4543
files: ^.*\.(sh|bash|ksh)$
4644
types: []
4745
- repo: https://github.com/adrienverge/yamllint
48-
rev: v1.26.3
46+
rev: v1.37.1
4947
hooks:
5048
- id: yamllint
5149
name: Check YAML syntax with yamllint
52-
args: [--strict, '.']
53-
always_run: true
54-
pass_filenames: false
50+
args: [--strict]
51+
types: [file]
52+
# Files to include
53+
# 1. Obvious YAML files
54+
# 2. `pillar.example` and similar files
55+
# 3. SLS files under directory `test/` which are pillar files
56+
# Files to exclude
57+
# 1. SLS files under directory `test/` which are state files
58+
# 2. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
59+
# 3. YAML files heavily reliant on Jinja
60+
# 4. `.copier-answers.yml` and its variants which are auto-generated
61+
files: |
62+
(?x)^(
63+
.*\.yaml|
64+
.*\.yml|
65+
\.salt-lint|
66+
\.yamllint|
67+
.*\.example|
68+
test/.*\.sls
69+
)$
70+
exclude: |
71+
(?x)^(
72+
\.copier-answers(\..+)?\.ya?ml|
73+
kitchen.vagrant.yml|
74+
test/.*/states/.*\.sls
75+
)$
5576
- repo: https://github.com/warpnet/salt-lint
56-
rev: v0.8.0
77+
rev: v0.9.2
5778
hooks:
5879
- id: salt-lint
5980
name: Check Salt files using salt-lint
6081
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
61-
- repo: https://github.com/myint/rstcheck
62-
rev: 3f929574
82+
- repo: https://github.com/rstcheck/rstcheck
83+
rev: v6.2.5
6384
hooks:
6485
- id: rstcheck
6586
name: Check reST files using rstcheck
6687
exclude: 'docs/CHANGELOG.rst'
88+
additional_dependencies: [sphinx==7.2.6]
6789
- repo: https://github.com/saltstack-formulas/mirrors-rst-lint
68-
rev: v1.3.2
90+
rev: v1.4.0
6991
hooks:
7092
- id: rst-lint
7193
name: Check reST files using rst-lint
7294
exclude: |
7395
(?x)^(
7496
docs/CHANGELOG.rst|
7597
docs/TOFS_pattern.rst|
98+
docs/CONTRIBUTING_DOCS.rst|
99+
docs/index.rst|
76100
)$
77-
additional_dependencies: [pygments==2.9.0]
101+
additional_dependencies: [pygments==2.16.1]
102+
- repo: https://github.com/renovatebot/pre-commit-hooks
103+
rev: 40.48.11
104+
hooks:
105+
- id: renovate-config-validator
106+
name: Check Renovate config with renovate-config-validator
107+
- repo: https://github.com/python-jsonschema/check-jsonschema
108+
rev: 0.33.0
109+
hooks:
110+
- id: check-github-workflows
111+
name: Check GitHub workflows with check-jsonschema
112+
args: [--verbose]
113+
- id: check-gitlab-ci
114+
name: Check GitLab CI config with check-jsonschema
115+
args: [--verbose]

.rstcheck.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[rstcheck]
22
report=info
33
ignore_language=rst
4-
ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$)
4+
# salt['config.get']('roles') is misidentified as a Markdown link.
5+
# Ignore for now, but perhaps try to submit a fix upstream in rstcheck
6+
ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$|\(rst\) Link is formatted in Markdown style\.)

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Layout/LineLength:
77
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
88
Max: 88
99
Metrics/BlockLength:
10-
IgnoredMethods:
10+
AllowedMethods:
1111
- control
1212
- describe
1313
# Increase from default of `25`

0 commit comments

Comments
 (0)