0
0
mirror of https://github.com/saltstack-formulas/sysctl-formula.git synced 2026-05-08 23:43:20 +02:00

chore(copier): apply template copier-ssf-ciat v2.10.7

This commit is contained in:
Alex Wede 2026-05-04 22:21:26 +02:00
parent eac6750f94
commit bb50197a2a
14 changed files with 1029 additions and 773 deletions

View File

@ -0,0 +1,23 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v2.10.7
_src_path: https://github.com/dafyddj/copier-ssf-ci
failure_permitted_ignored: []
failure_permitted_patterns: []
formula_name: sysctl
release_using_gha: false
renovate_extend_presets:
- github>saltstack-formulas/.github
- github>saltstack-formulas/.github:copier
renovate_ignore_presets: []
supported_oses:
- AlmaLinux OS
- Amazon Linux
- CentOS
- Debian
- Fedora Linux
- openSUSE
- Oracle Linux
- Rocky Linux
- Ubuntu
test_using_gha: false
using_probot_settings: false

11
.github/renovate.json5 vendored Normal file
View File

@ -0,0 +1,11 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
"github>saltstack-formulas/.github",
"github>saltstack-formulas/.github:copier"
],
/**********************************************************
* This file is managed as part of a Copier template. *
* Please make your own changes below this comment. *
*********************************************************/
}

84
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,84 @@
---
name: Test & release
'on':
- pull_request
- push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}',
github.event.repository.default_branch) }}
jobs:
should-run:
name: Prep / Should run
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
should-run: ${{ steps.action.outputs.should-run }}
steps:
- id: action
# yamllint disable-line rule:line-length
uses: techneg-it/should-workflow-run@eff19348eb884f57e05bc6f05ae48ece3af14714 # v1.0.1
pre-commit:
name: Lint / `pre-commit`
needs: should-run
if: fromJSON(needs.should-run.outputs.should-run)
container: techneg/ci-pre-commit:v2.5.40@sha256:08cbbc8b1b3ad6bfc7056494823b0f96faa50ab467649f8d48e8e6d963f11b41
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- run: | # Needed because of bug #2031 in `actions/checkout`
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
fetch-tags: true
filter: tree:0
- name: Export `CI_CACHE_ID` from container
run: echo "CI_CACHE_ID=$(cat /.ci_cache_id)" >> $GITHUB_ENV
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/pre-commit
key: "${{ env.CI_CACHE_ID }}|\
${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: |
${{ env.CI_CACHE_ID }}|
- name: Build cache
run: |
pre-commit gc
echo "Installing hook environments..."
time -f "Hook installation took %E" pre-commit install-hooks
- name: Run `pre-commit`
run: |
pre-commit run --all-files --color always --verbose
pre-commit run --color always --hook-stage manual --verbose commitlint-ci
results:
name: Release / Collect results
permissions:
contents: write
issues: write
pull-requests: write
checks: read
container: techneg/ci-semantic-release:v1.2.38@sha256:292fab25c01c3a8bf6f27be8d397be40c4e95ded49d99d9a5ac47c79cc40d981
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: | # Needed due to bug actions/checkout#2031
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# yamllint disable-line rule:line-length
- uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0
with:
ignore: >
Release / Collect results
ignore_pattern: ^GitLab CI
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run `semantic-release`
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAINTAINER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
semantic-release --dry-run
- run: echo "::notice ::Workflow success!"

View File

@ -9,47 +9,82 @@
only_branch_master_parent_repo: &only_branch_master_parent_repo
- 'master@saltstack-formulas/sysctl-formula'
# `stage`
stage_cache: &stage_cache 'cache'
stage_lint: &stage_lint 'lint'
stage_release: &stage_release 'release'
stage_test: &stage_test 'test'
# `image`
image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
image_precommit: &image_precommit
name: 'myii/ssf-pre-commit:2.9.2'
entrypoint: ['/bin/bash', '-c']
image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
# yamllint disable rule:line-length
image_commitlint: &image_commitlint 'techneg/ci-commitlint:v1.1.137@sha256:65f39c2408d55619ba50b1289c1f9e52d6e76f4d8c899c46a6d520fa56c20da4'
image_dindruby: &image_dindruby 'techneg/ci-docker-python-ruby:v2.2.107@sha256:16d1d002162df6679b3ff26c84ddbabfc3ec8f8811ebcda8ef6adaefb9d8e7fa'
image_dindrubybionic: &image_dindrubybionic 'techneg/ci-docker-python-ruby:v2.2.107@sha256:16d1d002162df6679b3ff26c84ddbabfc3ec8f8811ebcda8ef6adaefb9d8e7fa'
image_precommit: &image_precommit 'techneg/ci-pre-commit:v2.5.40@sha256:08cbbc8b1b3ad6bfc7056494823b0f96faa50ab467649f8d48e8e6d963f11b41'
image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest@sha256:74850471782195453cdf91f4a5edf62b6fcc3365c124d4d975c7e87a702040d7'
image_semantic-release: &image_semanticrelease 'techneg/ci-semantic-release:v1.2.38@sha256:292fab25c01c3a8bf6f27be8d397be40c4e95ded49d99d9a5ac47c79cc40d981'
# `services`
services_docker_dind: &services_docker_dind
- 'docker:dind'
- 'docker:29.4.1-dind@sha256:c77e5d7912f9b137cc67051fdc2991d8f5ae22c55ddf532bb836dcb693a04940'
# yamllint enable rule:line-length
# `variables`
# https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
# https://bundler.io/v1.16/bundle_config.html
# https://bundler.io/v2.3/man/bundle-config.1.html
variables_bundler: &variables_bundler
BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
BUNDLE_WITHOUT: 'production'
# `cache`
BUNDLE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
BUNDLE_DEPLOYMENT: 'true'
bundle_install: &bundle_install
- 'bundle version'
- 'bundle config list'
# `--no-cache` means don't bother caching the downloaded .gem files
- 'time bundle install --no-cache'
cache_bundler: &cache_bundler
key: '${CI_JOB_STAGE}'
key:
files:
- 'Gemfile.lock'
prefix: 'bundler'
paths:
- '${BUNDLE_CACHE_PATH}'
- '${BUNDLE_PATH}'
# https://pre-commit.com/#gitlab-ci-example
variables_pre-commit: &variables_pre-commit
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
cache_pre-commit: &cache_pre-commit
key:
files:
- '.pre-commit-config.yaml'
prefix: 'pre-commit'
paths:
- '${PRE_COMMIT_HOME}'
###############################################################################
# Define stages and global variables
###############################################################################
stages:
- *stage_cache
- *stage_lint
- *stage_test
- *stage_release
variables:
DOCKER_DRIVER: 'overlay2'
###############################################################################
# `cache` stage: build up the bundler cache required before the `test` stage
###############################################################################
build-cache:
stage: *stage_cache
image: *image_dindruby
variables: *variables_bundler
cache: *cache_bundler
script: *bundle_install
###############################################################################
# `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
###############################################################################
commitlint:
.lint_job:
stage: *stage_lint
needs: []
commitlint:
extends: '.lint_job'
image: *image_commitlint
script:
# Add `upstream` remote to get access to `upstream/master`
@ -59,32 +94,20 @@ commitlint:
# Set default commit hashes for `--from` and `--to`
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
- 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
# `coqbot` adds a merge commit to test PRs on top of the latest commit in
# the repo; amend this merge commit message to avoid failure
- |
if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
&& [ "${CI_COMMIT_BRANCH}" != "master" ]; then
git commit --amend -m \
'chore: reword coqbot merge commit message for commitlint'
export COMMITLINT_TO=HEAD
fi
# Run `commitlint`
- 'commitlint --from "${COMMITLINT_FROM}"
--to "${COMMITLINT_TO}"
--verbose'
pre-commit:
stage: *stage_lint
extends: '.lint_job'
image: *image_precommit
# https://pre-commit.com/#gitlab-ci-example
variables:
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
cache:
key: '${CI_JOB_NAME}'
paths:
- '${PRE_COMMIT_HOME}'
variables: *variables_pre-commit
cache: *cache_pre-commit
script:
- 'pre-commit run --all-files --color always --verbose'
- 'pre-commit run --color always --hook-stage manual commitlint-ci'
# Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
# - The `pre-commit` check will only be available for formulas that pass the default
@ -93,8 +116,8 @@ pre-commit:
# - Furthermore, this job uses all of the latest `rubocop` features & cops,
# which will help when upgrading the `rubocop` linter used in `pre-commit`
rubocop:
extends: '.lint_job'
allow_failure: true
stage: *stage_lint
image: *image_rubocop
script:
- 'rubocop -d -P -S --enable-pending-cops'
@ -107,15 +130,13 @@ rubocop:
image: *image_dindruby
services: *services_docker_dind
variables: *variables_bundler
cache: *cache_bundler
before_script:
# TODO: This should work from the env vars above automatically
- 'bundle config set path "${BUNDLE_CACHE_PATH}"'
- 'bundle config set without "${BUNDLE_WITHOUT}"'
- 'bundle install'
cache:
<<: *cache_bundler
policy: 'pull'
before_script: *bundle_install
script:
# Alternative value to consider: `${CI_JOB_NAME}`
- 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
- 'echo "Starting test job: ${CI_JOB_NAME}"'
- 'bin/kitchen verify "${CI_JOB_NAME}"'
###############################################################################
# Define `test` template (`allow_failure: true`)
@ -131,82 +152,75 @@ rubocop:
# Make sure the instances listed below match up with
# the `platforms` defined in `kitchen.yml`
# yamllint disable rule:line-length
# default-debian-11-tiamat-py3: {extends: '.test_instance'}
# default-debian-10-tiamat-py3: {extends: '.test_instance'}
# default-debian-9-tiamat-py3: {extends: '.test_instance'}
# default-ubuntu-2204-tiamat-py3: {extends: '.test_instance_failure_permitted'}
# default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
# default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
# default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'}
# default-centos-7-tiamat-py3: {extends: '.test_instance'}
# default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
# default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
# default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
# default-almalinux-8-tiamat-py3: {extends: '.test_instance'}
# default-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
default-debian-11-master-py3: {extends: '.test_instance'}
default-debian-10-master-py3: {extends: '.test_instance'}
default-debian-9-master-py3: {extends: '.test_instance'}
default-ubuntu-2204-master-py3: {extends: '.test_instance_failure_permitted'}
default-ubuntu-2004-master-py3: {extends: '.test_instance'}
default-ubuntu-1804-master-py3: {extends: '.test_instance'}
default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
default-centos-7-master-py3: {extends: '.test_instance'}
default-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'}
default-fedora-35-master-py3: {extends: '.test_instance'}
default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
default-amazonlinux-2-master-py3: {extends: '.test_instance'}
default-oraclelinux-8-master-py3: {extends: '.test_instance'}
default-oraclelinux-7-master-py3: {extends: '.test_instance'}
default-arch-base-latest-master-py3: {extends: '.test_instance'}
default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
default-almalinux-8-master-py3: {extends: '.test_instance'}
default-rockylinux-8-master-py3: {extends: '.test_instance'}
# default-debian-11-3004-1-py3: {extends: '.test_instance'}
# default-debian-10-3004-1-py3: {extends: '.test_instance'}
# default-debian-9-3004-1-py3: {extends: '.test_instance'}
# default-ubuntu-2204-3004-1-py3: {extends: '.test_instance_failure_permitted'}
# default-ubuntu-2004-3004-1-py3: {extends: '.test_instance'}
# default-ubuntu-1804-3004-1-py3: {extends: '.test_instance'}
# default-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'}
# default-centos-7-3004-1-py3: {extends: '.test_instance'}
# default-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'}
# default-fedora-35-3004-1-py3: {extends: '.test_instance'}
# default-amazonlinux-2-3004-1-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3004-1-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3004-1-py3: {extends: '.test_instance'}
# default-arch-base-latest-3004-1-py3: {extends: '.test_instance'}
# default-gentoo-stage3-latest-3004-1-py3: {extends: '.test_instance'}
# default-gentoo-stage3-systemd-3004-1-py3: {extends: '.test_instance'}
# default-almalinux-8-3004-1-py3: {extends: '.test_instance'}
# default-rockylinux-8-3004-1-py3: {extends: '.test_instance'}
# default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'}
# default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'}
# default-debian-10-3003-4-py3: {extends: '.test_instance'}
# default-debian-9-3003-4-py3: {extends: '.test_instance'}
# default-ubuntu-2004-3003-4-py3: {extends: '.test_instance'}
# default-ubuntu-1804-3003-4-py3: {extends: '.test_instance'}
# default-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'}
# default-centos-7-3003-4-py3: {extends: '.test_instance'}
# default-amazonlinux-2-3003-4-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3003-4-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3003-4-py3: {extends: '.test_instance'}
# default-almalinux-8-3003-4-py3: {extends: '.test_instance'}
# Fedora 41+ will permit failure until this PR is merged into kitchen-docker
# https://github.com/test-kitchen/kitchen-docker/pull/427 is merged
# OpenSUSE master branch will fail until zypperpkg module is back in salt core
# https://github.com/saltstack/great-module-migration/issues/14
#
almalinux-9-master: {extends: '.test_instance_failure_permitted'}
almalinux-8-master: {extends: '.test_instance_failure_permitted'}
amazonlinux-2023-master: {extends: '.test_instance_failure_permitted'}
amazonlinux-2-master: {extends: '.test_instance_failure_permitted'}
centos-stream9-master: {extends: '.test_instance_failure_permitted'}
debian-12-master: {extends: '.test_instance_failure_permitted'}
debian-11-master: {extends: '.test_instance_failure_permitted'}
fedora-41-master: {extends: '.test_instance_failure_permitted'}
fedora-40-master: {extends: '.test_instance_failure_permitted'}
opensuse-leap-156-master: {extends: '.test_instance_failure_permitted'}
opensuse-tmbl-latest-master: {extends: '.test_instance_failure_permitted'}
oraclelinux-9-master: {extends: '.test_instance_failure_permitted'}
oraclelinux-8-master: {extends: '.test_instance_failure_permitted'}
rockylinux-9-master: {extends: '.test_instance_failure_permitted'}
rockylinux-8-master: {extends: '.test_instance_failure_permitted'}
ubuntu-2404-master: {extends: '.test_instance_failure_permitted'}
ubuntu-2204-master: {extends: '.test_instance_failure_permitted'}
ubuntu-2004-master: {extends: '.test_instance_failure_permitted'}
almalinux-9-3007: {extends: '.test_instance'}
almalinux-8-3007: {extends: '.test_instance'}
amazonlinux-2023-3007: {extends: '.test_instance'}
amazonlinux-2-3007: {extends: '.test_instance_failure_permitted'}
centos-stream9-3007: {extends: '.test_instance'}
debian-12-3007: {extends: '.test_instance'}
debian-11-3007: {extends: '.test_instance'}
fedora-41-3007: {extends: '.test_instance_failure_permitted'}
fedora-40-3007: {extends: '.test_instance'}
opensuse-leap-156-3007: {extends: '.test_instance'}
opensuse-tmbl-latest-3007: {extends: '.test_instance'}
oraclelinux-9-3007: {extends: '.test_instance'}
oraclelinux-8-3007: {extends: '.test_instance'}
rockylinux-9-3007: {extends: '.test_instance'}
rockylinux-8-3007: {extends: '.test_instance'}
ubuntu-2404-3007: {extends: '.test_instance'}
ubuntu-2204-3007: {extends: '.test_instance'}
ubuntu-2004-3007: {extends: '.test_instance'}
almalinux-9-3006: {extends: '.test_instance'}
almalinux-8-3006: {extends: '.test_instance'}
amazonlinux-2023-3006: {extends: '.test_instance'}
amazonlinux-2-3006: {extends: '.test_instance_failure_permitted'}
centos-stream9-3006: {extends: '.test_instance'}
debian-12-3006: {extends: '.test_instance'}
debian-11-3006: {extends: '.test_instance'}
fedora-41-3006: {extends: '.test_instance_failure_permitted'}
fedora-40-3006: {extends: '.test_instance'}
opensuse-leap-156-3006: {extends: '.test_instance'}
opensuse-tmbl-latest-3006: {extends: '.test_instance'}
oraclelinux-9-3006: {extends: '.test_instance'}
oraclelinux-8-3006: {extends: '.test_instance'}
rockylinux-9-3006: {extends: '.test_instance'}
rockylinux-8-3006: {extends: '.test_instance'}
ubuntu-2404-3006: {extends: '.test_instance'}
ubuntu-2204-3006: {extends: '.test_instance'}
ubuntu-2004-3006: {extends: '.test_instance'}
# yamllint enable rule:line-length
###############################################################################
# `release` stage: `semantic-release`
###############################################################################
semantic-release:
only: *only_branch_master_parent_repo
stage: *stage_release
image: *image_semanticrelease
variables:
MAINTAINER_TOKEN: '${GH_TOKEN}'
script:
# Update `AUTHORS.md`
- '${HOME}/go/bin/maintainer contributor'
# Run `semantic-release`
- 'semantic-release'

View File

@ -15,57 +15,79 @@ ci:
autoupdate_schedule: quarterly
skip: []
submodules: false
default_stages: [commit]
default_stages: [pre-commit]
repos:
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
rev: v2.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-merge-conflict
name: Check for Git merge conflicts
args: [--assume-in-merge]
exclude: ^docs/AUTHORS.rst$
- repo: https://github.com/dafyddj/mirrors-commitlint
rev: v19.8.1
hooks:
- id: commitlint
name: Check commit message using commitlint
description: Lint commit message against @commitlint/config-conventional rules
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
- id: commitlint-travis
stages: [manual]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
always_run: true
- id: commitlint-ci
- repo: https://github.com/rubocop-hq/rubocop
rev: v1.30.1
rev: v1.86.1
hooks:
- id: rubocop
name: Check Ruby files with rubocop
args: [--debug]
always_run: true
pass_filenames: false
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: v0.9.0.6
hooks:
- id: shellcheck
name: Check shell scripts with shellcheck
files: ^.*\.(sh|bash|ksh)$
types: []
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
rev: v1.38.0
hooks:
- id: yamllint
name: Check YAML syntax with yamllint
args: [--strict, '.']
always_run: true
pass_filenames: false
args: [--strict]
types: [file]
# Files to include
# 1. Obvious YAML files
# 2. `pillar.example` and similar files
# 3. SLS files under directory `test/` which are pillar files
# Files to exclude
# 1. SLS files under directory `test/` which are state files
# 2. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
# 3. YAML files heavily reliant on Jinja
# 4. `.copier-answers.yml` and its variants which are auto-generated
files: |
(?x)^(
.*\.yaml|
.*\.yml|
\.salt-lint|
\.yamllint|
.*\.example|
test/.*\.sls
)$
exclude: |
(?x)^(
\.copier-answers(\..+)?\.ya?ml|
kitchen.vagrant.yml|
test/.*/states/.*\.sls
)$
- repo: https://github.com/warpnet/salt-lint
rev: v0.8.0
rev: v0.9.2
hooks:
- id: salt-lint
name: Check Salt files using salt-lint
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
- repo: https://github.com/myint/rstcheck
rev: 3f929574
- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.5
hooks:
- id: rstcheck
name: Check reST files using rstcheck
exclude: 'docs/CHANGELOG.rst'
additional_dependencies: [sphinx==7.2.6]
- repo: https://github.com/saltstack-formulas/mirrors-rst-lint
rev: v1.3.2
rev: v1.4.0
hooks:
- id: rst-lint
name: Check reST files using rst-lint
@ -73,5 +95,26 @@ repos:
(?x)^(
docs/CHANGELOG.rst|
docs/TOFS_pattern.rst|
docs/CONTRIBUTING_DOCS.rst|
docs/index.rst|
)$
additional_dependencies: [pygments==2.9.0]
additional_dependencies: [pygments==2.16.1]
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 43.141.2
hooks:
- id: renovate-config-validator
name: Check Renovate config with renovate-config-validator
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.1
hooks:
- id: check-github-workflows
name: Check GitHub workflows with check-jsonschema
args: [--verbose]
- id: check-gitlab-ci
name: Check GitLab CI config with check-jsonschema
args: [--verbose]
- repo: https://github.com/standard/standard
rev: v17.1.2
hooks:
- id: standard
name: Check JavaScript files using standardJS

View File

@ -1,4 +1,6 @@
[rstcheck]
report=info
ignore_language=rst
ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$)
# salt['config.get']('roles') is misidentified as a Markdown link.
# Ignore for now, but perhaps try to submit a fix upstream in rstcheck
ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$|\(rst\) Link is formatted in Markdown style\.)

View File

@ -7,7 +7,7 @@ Layout/LineLength:
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
Max: 88
Metrics/BlockLength:
IgnoredMethods:
AllowedMethods:
- control
- describe
# Increase from default of `25`

View File

@ -4,34 +4,9 @@
# Extend the `default` configuration provided by `yamllint`
extends: 'default'
# Files to ignore completely
# 1. All YAML files under directory `.bundle/`, introduced if gems are installed locally
# 2. All YAML files under directory `.cache/`, introduced during the CI run
# 3. All YAML files under directory `.git/`
# 4. All YAML files under directory `node_modules/`, introduced during the CI run
# 5. Any SLS files under directory `test/`, which are actually state files
# 6. Any YAML files under directory `.kitchen/`, introduced during local testing
# 7. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
ignore: |
.bundle/
.cache/
.git/
node_modules/
test/**/states/**/*.sls
.kitchen/
kitchen.vagrant.yml
yaml-files:
# Default settings
- '*.yaml'
- '*.yml'
- .salt-lint
- .yamllint
# SaltStack Formulas additional settings
- '*.example'
- test/**/*.sls
rules:
comments:
min-spaces-from-content: 1
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
@ -39,6 +14,7 @@ rules:
# Increase from default of `80`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
max: 88
allow-non-breakable-inline-mappings: true
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true

14
Gemfile
View File

@ -1,5 +1,9 @@
# frozen_string_literal: true
# This is a placeholder version to remind us to update the Gemfile
# when a new stable Chef Workstation is released
# renovate: chef-workstation 25.13.7
source ENV.fetch('PROXY_RUBYGEMSORG', 'https://rubygems.org')
# Install the `inspec` gem using `git` because versions after `4.22.22`
@ -12,8 +16,12 @@ gem 'inspec', git: 'https://gitlab.com/saltstack-formulas/infrastructure/inspec'
# improvement: avoid package installations which are already covered by the
# `salt-image-builder` (i.e. the pre-salted images that we're using)
# rubocop:disable Layout/LineLength
gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker', branch: 'ssf'
gem 'kitchen-docker', git: 'https://github.com/test-kitchen/kitchen-docker', ref: '511e4ad36856b9e2eccceb56603586e6cebd296a'
# rubocop:enable Layout/LineLength
gem 'kitchen-inspec', '>= 2.5.0'
gem 'kitchen-salt', '>= 0.7.2'
gem 'kitchen-inspec', '3.1.0'
gem 'kitchen-salt', '0.7.2'
gem 'net-ssh', '7.3.0'
gem 'test-kitchen', '3.9.1'

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,14 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [2, 'always', 120],
'footer-max-line-length': [2, 'always', 120],
'header-max-length': [2, 'always', 72],
},
};
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [2, 'always', 120],
'footer-max-line-length': [2, 'always', 120],
'header-max-length': [2, 'always', 72]
},
ignores: [
(commit) => commit.startsWith('chore(copier):'),
(commit) => commit.startsWith('chore(deps):'),
(commit) => commit.startsWith('ci(pre-commit.ci):'),
(commit) => commit.startsWith('[CI merge]')
]
}

View File

@ -17,246 +17,222 @@ provisioner:
salt_copy_filter:
- .kitchen
- .git
pillars_from_directories:
- test/salt/pillar
transport:
# Avoid lengthy waits when a container does not launch correctly
max_wait_until_ready: 60
platforms:
## SALT `tiamat`
- name: debian-11-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:debian-11
run_command: /lib/systemd/systemd
- name: debian-10-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:debian-10
run_command: /lib/systemd/systemd
- name: debian-9-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:debian-9
run_command: /lib/systemd/systemd
- name: ubuntu-2204-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:ubuntu-22.04
run_command: /lib/systemd/systemd
- name: ubuntu-2004-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:ubuntu-20.04
run_command: /lib/systemd/systemd
- name: ubuntu-1804-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:ubuntu-18.04
run_command: /lib/systemd/systemd
- name: centos-stream8-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:centos-stream8
- name: centos-7-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:centos-7
- name: amazonlinux-2-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:amazonlinux-2
- name: oraclelinux-8-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:oraclelinux-8
- name: oraclelinux-7-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:oraclelinux-7
- name: almalinux-8-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:almalinux-8
- name: rockylinux-8-tiamat-py3
driver:
image: saltimages/salt-tiamat-py3:rockylinux-8
## SALT `master`
- name: debian-11-master-py3
- name: debian-12-master
driver:
image: saltimages/salt-master-py3:debian-12
run_command: /lib/systemd/systemd
- name: debian-11-master
driver:
image: saltimages/salt-master-py3:debian-11
run_command: /lib/systemd/systemd
- name: debian-10-master-py3
- name: ubuntu-2404-master
driver:
image: saltimages/salt-master-py3:debian-10
image: saltimages/salt-master-py3:ubuntu-24.04
run_command: /lib/systemd/systemd
- name: debian-9-master-py3
driver:
image: saltimages/salt-master-py3:debian-9
run_command: /lib/systemd/systemd
- name: ubuntu-2204-master-py3
- name: ubuntu-2204-master
driver:
image: saltimages/salt-master-py3:ubuntu-22.04
run_command: /lib/systemd/systemd
- name: ubuntu-2004-master-py3
- name: ubuntu-2004-master
driver:
image: saltimages/salt-master-py3:ubuntu-20.04
run_command: /lib/systemd/systemd
- name: ubuntu-1804-master-py3
- name: centos-stream9-master
driver:
image: saltimages/salt-master-py3:ubuntu-18.04
run_command: /lib/systemd/systemd
- name: centos-stream8-master-py3
image: saltimages/salt-master-py3:centos-stream9
- name: opensuse-leap-156-master
driver:
image: saltimages/salt-master-py3:centos-stream8
- name: centos-7-master-py3
driver:
image: saltimages/salt-master-py3:centos-7
- name: fedora-36-master-py3
driver:
image: saltimages/salt-master-py3:fedora-36
- name: fedora-35-master-py3
driver:
image: saltimages/salt-master-py3:fedora-35
- name: opensuse-leap-153-master-py3
driver:
image: saltimages/salt-master-py3:opensuse-leap-15.3
# Workaround to avoid intermittent failures on `opensuse-leap-15.3`:
image: saltimages/salt-master-py3:opensuse-leap-15.6
# Workaround to avoid intermittent failures on `opensuse-leap-15.6`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: opensuse-tmbl-latest-master-py3
- name: opensuse-tmbl-latest-master
driver:
image: saltimages/salt-master-py3:opensuse-tumbleweed-latest
# Workaround to avoid intermittent failures on `opensuse-tumbleweed`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: amazonlinux-2-master-py3
- name: fedora-41-master
driver:
image: saltimages/salt-master-py3:amazonlinux-2
- name: oraclelinux-8-master-py3
image: saltimages/salt-master-py3:fedora-41
- name: fedora-40-master
driver:
image: saltimages/salt-master-py3:fedora-40
- name: amazonlinux-2023-master
driver:
image: saltimages/salt-master-py3:amazonlinux-2023
- name: oraclelinux-9-master
driver:
image: saltimages/salt-master-py3:oraclelinux-9
- name: oraclelinux-8-master
driver:
image: saltimages/salt-master-py3:oraclelinux-8
- name: oraclelinux-7-master-py3
- name: almalinux-9-master
driver:
image: saltimages/salt-master-py3:oraclelinux-7
- name: arch-base-latest-master-py3
driver:
image: saltimages/salt-master-py3:arch-base-latest
- name: gentoo-stage3-latest-master-py3
driver:
image: saltimages/salt-master-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-master-py3
driver:
image: saltimages/salt-master-py3:gentoo-stage3-systemd
- name: almalinux-8-master-py3
image: saltimages/salt-master-py3:almalinux-9
- name: almalinux-8-master
driver:
image: saltimages/salt-master-py3:almalinux-8
- name: rockylinux-8-master-py3
- name: rockylinux-9-master
driver:
image: saltimages/salt-master-py3:rockylinux-9
- name: rockylinux-8-master
driver:
image: saltimages/salt-master-py3:rockylinux-8
## SALT `3004.1`
- name: debian-11-3004-1-py3
## SALT `3007.9`
- name: debian-12-3007-9
driver:
image: saltimages/salt-3004.1-py3:debian-11
image: saltimages/salt-3007.9-py3:debian-12
run_command: /lib/systemd/systemd
- name: debian-10-3004-1-py3
- name: debian-11-3007-9
driver:
image: saltimages/salt-3004.1-py3:debian-10
image: saltimages/salt-3007.9-py3:debian-11
run_command: /lib/systemd/systemd
- name: debian-9-3004-1-py3
- name: ubuntu-2404-3007-9
driver:
image: saltimages/salt-3004.1-py3:debian-9
image: saltimages/salt-3007.9-py3:ubuntu-24.04
run_command: /lib/systemd/systemd
- name: ubuntu-2204-3004-1-py3
- name: ubuntu-2204-3007-9
driver:
image: saltimages/salt-3004.1-py3:ubuntu-22.04
image: saltimages/salt-3007.9-py3:ubuntu-22.04
run_command: /lib/systemd/systemd
- name: ubuntu-2004-3004-1-py3
- name: ubuntu-2004-3007-9
driver:
image: saltimages/salt-3004.1-py3:ubuntu-20.04
image: saltimages/salt-3007.9-py3:ubuntu-20.04
run_command: /lib/systemd/systemd
- name: ubuntu-1804-3004-1-py3
- name: centos-stream9-3007-9
driver:
image: saltimages/salt-3004.1-py3:ubuntu-18.04
run_command: /lib/systemd/systemd
- name: centos-stream8-3004-1-py3
image: saltimages/salt-3007.9-py3:centos-stream9
- name: opensuse-leap-156-3007-9
driver:
image: saltimages/salt-3004.1-py3:centos-stream8
- name: centos-7-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:centos-7
- name: fedora-36-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:fedora-36
- name: fedora-35-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:fedora-35
- name: amazonlinux-2-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:amazonlinux-2
- name: oraclelinux-8-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:oraclelinux-8
- name: oraclelinux-7-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:oraclelinux-7
- name: arch-base-latest-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:arch-base-latest
- name: gentoo-stage3-latest-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:gentoo-stage3-systemd
- name: almalinux-8-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:almalinux-8
- name: rockylinux-8-3004-1-py3
driver:
image: saltimages/salt-3004.1-py3:rockylinux-8
## SALT `3004.0`
- name: opensuse-leap-153-3004-0-py3
driver:
image: saltimages/salt-3004.0-py3:opensuse-leap-15.3
# Workaround to avoid intermittent failures on `opensuse-leap-15.3`:
image: saltimages/salt-3007.9-py3:opensuse-leap-15.6
# Workaround to avoid intermittent failures on `opensuse-leap-15.6`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: opensuse-tmbl-latest-3004-0-py3
- name: opensuse-tmbl-latest-3007-9
driver:
image: saltimages/salt-3004.0-py3:opensuse-tumbleweed-latest
image: saltimages/salt-3007.9-py3:opensuse-tumbleweed-latest
# Workaround to avoid intermittent failures on `opensuse-tumbleweed`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: fedora-41-3007-9
driver:
image: saltimages/salt-3007.9-py3:fedora-41
- name: fedora-40-3007-9
driver:
image: saltimages/salt-3007.9-py3:fedora-40
- name: amazonlinux-2023-3007-9
driver:
image: saltimages/salt-3007.9-py3:amazonlinux-2023
- name: amazonlinux-2-3007-9
driver:
image: saltimages/salt-3007.9-py3:amazonlinux-2
- name: oraclelinux-9-3007-9
driver:
image: saltimages/salt-3007.9-py3:oraclelinux-9
- name: oraclelinux-8-3007-9
driver:
image: saltimages/salt-3007.9-py3:oraclelinux-8
- name: almalinux-9-3007-9
driver:
image: saltimages/salt-3007.9-py3:almalinux-9
- name: almalinux-8-3007-9
driver:
image: saltimages/salt-3007.9-py3:almalinux-8
- name: rockylinux-9-3007-9
driver:
image: saltimages/salt-3007.9-py3:rockylinux-9
- name: rockylinux-8-3007-9
driver:
image: saltimages/salt-3007.9-py3:rockylinux-8
## SALT `3003.4`
- name: debian-10-3003-4-py3
## SALT `3006.17`
- name: debian-12-3006-17
driver:
image: saltimages/salt-3003.4-py3:debian-10
image: saltimages/salt-3006.17-py3:debian-12
run_command: /lib/systemd/systemd
- name: debian-9-3003-4-py3
- name: debian-11-3006-17
driver:
image: saltimages/salt-3003.4-py3:debian-9
image: saltimages/salt-3006.17-py3:debian-11
run_command: /lib/systemd/systemd
- name: ubuntu-2004-3003-4-py3
- name: ubuntu-2404-3006-17
driver:
image: saltimages/salt-3003.4-py3:ubuntu-20.04
image: saltimages/salt-3006.17-py3:ubuntu-24.04
run_command: /lib/systemd/systemd
- name: ubuntu-1804-3003-4-py3
- name: ubuntu-2204-3006-17
driver:
image: saltimages/salt-3003.4-py3:ubuntu-18.04
image: saltimages/salt-3006.17-py3:ubuntu-22.04
run_command: /lib/systemd/systemd
- name: centos-stream8-3003-4-py3
- name: ubuntu-2004-3006-17
driver:
image: saltimages/salt-3003.4-py3:centos-stream8
- name: centos-7-3003-4-py3
image: saltimages/salt-3006.17-py3:ubuntu-20.04
run_command: /lib/systemd/systemd
- name: centos-stream9-3006-17
driver:
image: saltimages/salt-3003.4-py3:centos-7
- name: amazonlinux-2-3003-4-py3
image: saltimages/salt-3006.17-py3:centos-stream9
- name: opensuse-tmbl-latest-3006-17
driver:
image: saltimages/salt-3003.4-py3:amazonlinux-2
- name: oraclelinux-8-3003-4-py3
image: saltimages/salt-3006.17-py3:opensuse-tumbleweed-latest
# Workaround to avoid intermittent failures on `opensuse-tumbleweed`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: opensuse-leap-156-3006-17
driver:
image: saltimages/salt-3003.4-py3:oraclelinux-8
- name: oraclelinux-7-3003-4-py3
image: saltimages/salt-3006.17-py3:opensuse-leap-15.6
# Workaround to avoid intermittent failures on `opensuse-leap-15.6`:
# => SCP did not finish successfully (255): (Net::SCP::Error)
transport:
max_ssh_sessions: 1
- name: fedora-41-3006-17
driver:
image: saltimages/salt-3003.4-py3:oraclelinux-7
- name: almalinux-8-3003-4-py3
image: saltimages/salt-3006.17-py3:fedora-41
- name: fedora-40-3006-17
driver:
image: saltimages/salt-3003.4-py3:almalinux-8
image: saltimages/salt-3006.17-py3:fedora-40
- name: amazonlinux-2023-3006-17
driver:
image: saltimages/salt-3006.17-py3:amazonlinux-2023
- name: amazonlinux-2-3006-17
driver:
image: saltimages/salt-3006.17-py3:amazonlinux-2
- name: oraclelinux-9-3006-17
driver:
image: saltimages/salt-3006.17-py3:oraclelinux-9
- name: oraclelinux-8-3006-17
driver:
image: saltimages/salt-3006.17-py3:oraclelinux-8
- name: almalinux-9-3006-17
driver:
image: saltimages/salt-3006.17-py3:almalinux-9
- name: almalinux-8-3006-17
driver:
image: saltimages/salt-3006.17-py3:almalinux-8
- name: rockylinux-9-3006-17
driver:
image: saltimages/salt-3006.17-py3:rockylinux-9
- name: rockylinux-8-3006-17
driver:
image: saltimages/salt-3006.17-py3:rockylinux-8
##########################################################
# This file is managed as part of a Copier template. #
# Please make your own changes below this comment. #
##########################################################
verifier:
# https://www.inspec.io/

View File

@ -3,20 +3,25 @@
###############################################################################
# (A) Update `FORMULA` with `${nextRelease.version}`
###############################################################################
sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
###############################################################################
# (B) Use `m2r2` to convert automatically produced `.md` docs to `.rst`
# (B) Update `AUTHORS.md`
###############################################################################
# Install `m2r2`
pip3 install m2r2
maintainer contributor \
--ignore-contributors dependabot[bot],renovate[bot],semantic-release-bot
###############################################################################
# (C) Use `m2r` to convert automatically produced `.md` docs to `.rst`
###############################################################################
# Copy and then convert the `.md` docs
cp ./*.md docs/
cd docs/ || exit
m2r2 --overwrite ./*.md
m2r --overwrite ./*.md
# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst`
sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst

View File

@ -1,107 +1,54 @@
module.exports = {
branch: 'master',
// Commit types appear in the changelog in this order
const commitTypes = [
{ type: 'feat', section: 'Features' },
{ type: 'fix', section: 'Bug Fixes' },
{ type: 'perf', section: 'Performance Improvements' },
{ type: 'revert', section: 'Reversions' },
{ type: 'refactor', section: 'Code Refactoring' },
{ type: 'docs', section: 'Documentation' },
{ type: 'test', section: 'Testing' },
{ type: 'style', section: 'Style Changes' },
{ type: 'ci', section: 'Continuous Integration' },
{ type: 'build', section: 'Build System' },
{ type: 'chore', section: 'Maintenance' }
]
// Default rules can be found in `github.com/semantic-release/commit-analyzer/lib/default-release-rules.js`
// that cover feat, fix, perf and breaking.
// Commit types defined above but without release rules do not trigger a release
// but will be incorporated into the next release.
// NOTE: Any changes to commit types or release rules must be reflected in `CONTRIBUTING.rst`.
const releaseRules = [
{ type: 'docs', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'revert', release: 'patch' },
{ type: 'style', release: 'patch' },
{ type: 'test', release: 'patch' }
]
const config = {
// TODO: remove this when we no longer process releases on GitLab CI
repositoryUrl: 'https://github.com/saltstack-formulas/sysctl-formula',
plugins: [
['@semantic-release/commit-analyzer', {
preset: 'angular',
releaseRules: './release-rules.js',
}],
'@semantic-release/release-notes-generator',
['@semantic-release/changelog', {
changelogFile: 'CHANGELOG.md',
changelogTitle: '# Changelog',
}],
['@semantic-release/exec', {
prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}',
}],
['@semantic-release/git', {
assets: ['*.md', 'docs/*.rst', 'FORMULA'],
}],
'@semantic-release/github',
['@semantic-release/commit-analyzer', { releaseRules }],
'@semantic-release/release-notes-generator',
['@semantic-release/changelog', {
changelogFile: 'CHANGELOG.md',
changelogTitle: '# Changelog'
}],
['@semantic-release/exec', {
// eslint-disable-next-line no-template-curly-in-string
prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}'
}],
['@semantic-release/git', {
assets: ['*.md', 'docs/*.rst', 'FORMULA']
}],
'@semantic-release/github'
],
generateNotes: {
preset: 'angular',
writerOpts: {
// Required due to upstream bug preventing all types being displayed.
// Bug: https://github.com/conventional-changelog/conventional-changelog/issues/317
// Fix: https://github.com/conventional-changelog/conventional-changelog/pull/410
transform: (commit, context) => {
const issues = []
preset: 'conventionalcommits',
presetConfig: {
types: commitTypes
}
}
commit.notes.forEach(note => {
note.title = `BREAKING CHANGES`
})
// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`.
if (commit.type === `feat`) {
commit.type = `Features`
} else if (commit.type === `fix`) {
commit.type = `Bug Fixes`
} else if (commit.type === `perf`) {
commit.type = `Performance Improvements`
} else if (commit.type === `revert`) {
commit.type = `Reverts`
} else if (commit.type === `docs`) {
commit.type = `Documentation`
} else if (commit.type === `style`) {
commit.type = `Styles`
} else if (commit.type === `refactor`) {
commit.type = `Code Refactoring`
} else if (commit.type === `test`) {
commit.type = `Tests`
} else if (commit.type === `build`) {
commit.type = `Build System`
// } else if (commit.type === `chore`) {
// commit.type = `Maintenance`
} else if (commit.type === `ci`) {
commit.type = `Continuous Integration`
} else {
return
}
if (commit.scope === `*`) {
commit.scope = ``
}
if (typeof commit.hash === `string`) {
commit.shortHash = commit.hash.substring(0, 7)
}
if (typeof commit.subject === `string`) {
let url = context.repository
? `${context.host}/${context.owner}/${context.repository}`
: context.repoUrl
if (url) {
url = `${url}/issues/`
// Issue URLs.
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
issues.push(issue)
return `[#${issue}](${url}${issue})`
})
}
if (context.host) {
// User URLs.
commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
if (username.includes('/')) {
return `@${username}`
}
return `[@${username}](${context.host}/${username})`
})
}
}
// remove references that already appear in the subject
commit.references = commit.references.filter(reference => {
if (issues.indexOf(reference.issue) === -1) {
return true
}
return false
})
return commit
},
},
},
};
module.exports = config