From 69dcfd9c3bf49416e6c77d8e982446d99af3b95c Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 14 Sep 2021 08:17:43 +0100 Subject: [PATCH] ci: test for upstream Salt regressions in `master` instances (2021-W37a) * Automated using https://github.com/myii/ssf-formula/pull/999 --- .gitlab-ci.yml | 103 +++++++++++++++++++++++++------------------------ .travis.yml | 54 +++++--------------------- Gemfile.lock | 22 +++++------ kitchen.yml | 3 ++ 4 files changed, 76 insertions(+), 106 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e6be063..d907c4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,56 +49,58 @@ variables: ############################################################################### # `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed) ############################################################################### -commitlint: - stage: *stage_lint - image: *image_commitlint - script: - # Add `upstream` remote to get access to `upstream/master` - - 'git remote add upstream - https://gitlab.com/saltstack-formulas/apache-formula.git' - - 'git fetch --all' - # 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 - 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}' - script: - - 'pre-commit run --all-files --color always --verbose' - -# 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 -# `rubocop` check -- and must continue to do so -# - This job is allowed to fail, so can be used for all formulas -# - Furthermore, this job uses all of the latest `rubocop` features & cops, -# which will help when upgrading the `rubocop` linter used in `pre-commit` -rubocop: - allow_failure: true - stage: *stage_lint - image: *image_rubocop - script: - - 'rubocop -d -P -S --enable-pending-cops' +# commitlint: +# allow_failure: true +# stage: *stage_lint +# image: *image_commitlint +# script: +# # Add `upstream` remote to get access to `upstream/master` +# - 'git remote add upstream +# https://gitlab.com/saltstack-formulas/apache-formula.git' +# - 'git fetch --all' +# # 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: +# allow_failure: true +# stage: *stage_lint +# 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}' +# script: +# - 'pre-commit run --all-files --color always --verbose' +# +# # 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 +# # `rubocop` check -- and must continue to do so +# # - This job is allowed to fail, so can be used for all formulas +# # - Furthermore, this job uses all of the latest `rubocop` features & cops, +# # which will help when upgrading the `rubocop` linter used in `pre-commit` +# rubocop: +# allow_failure: true +# stage: *stage_lint +# image: *image_rubocop +# script: +# - 'rubocop -d -P -S --enable-pending-cops' ############################################################################### # Define `test` template @@ -114,6 +116,7 @@ rubocop: - 'bundle config set path "${BUNDLE_CACHE_PATH}"' - 'bundle config set without "${BUNDLE_WITHOUT}"' - 'bundle install' + # - 'bundle update --all' script: # Alternative value to consider: `${CI_JOB_NAME}` - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"' diff --git a/.travis.yml b/.travis.yml index 6e36653..03e41a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,10 @@ cache: 'bundler' services: - docker +## Use the latest gems for this `master` run +## https://docs.travis-ci.com/user/job-lifecycle/ +before_install: bundle update + ## Script to run for the test stage script: - bin/kitchen verify "${INSTANCE}" @@ -37,48 +41,6 @@ stages: # if: 'branch = master AND type != pull_request' jobs: include: - ## Define the test stage that runs the linters (and testing matrix, if applicable) - - # Run all of the linters in a single job - - language: 'node_js' - node_js: 'lts/*' - env: 'Lint' - name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' - before_install: 'skip' - script: - # Install and run `salt-lint` - - pip install --user salt-lint - - git ls-files -- '*.sls' '*.jinja' '*.j2' '*.tmpl' '*.tst' - | xargs salt-lint - # Install and run `yamllint` - # Need at least `v1.17.0` for the `yaml-files` setting - - pip install --user yamllint>=1.17.0 - - yamllint -s . - # Install and run `rubocop` - - gem install rubocop - - rubocop -d - # Run `shellcheck` (already pre-installed in Travis) - - shellcheck --version - - git ls-files -- '*.sh' '*.bash' '*.ksh' - | xargs shellcheck - # Install and run `commitlint` - - npm i -D @commitlint/config-conventional - @commitlint/travis-cli - - commitlint-travis - - # Run `pre-commit` linters in a single job - - language: 'python' - env: 'Lint_pre-commit' - name: 'Lint: pre-commit' - before_install: 'skip' - cache: - directories: - - $HOME/.cache/pre-commit - script: - # Install and run `pre-commit` - - pip install pre-commit==2.7.1 - - pre-commit run --all-files --color always --verbose - - pre-commit run --color always --hook-stage manual --verbose commitlint-travis ## Define the rest of the matrix based on Kitchen testing # Make sure the instances listed below match up with @@ -254,14 +216,16 @@ jobs: # Run `semantic-release` script: 'npx semantic-release@15.14' +# yamllint disable rule:line-length # Notification options: `always`, `never` or `change` notifications: webhooks: - if: 'repo = saltstack-formulas/apache-formula' + if: 'repo = saltstack-formulas/apache-formula OR repo = myii/apache-formula' urls: - - https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Fapache-formula&ignore_pull_requests=true + - https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=master%2F2021-W37a&ignore_pull_requests=true on_success: always # default: always on_failure: always # default: always - on_start: always # default: never + on_start: never # default: never on_cancel: always # default: always on_error: always # default: always +# yamllint enable rule:line-length diff --git a/Gemfile.lock b/Gemfile.lock index 06584a8..13b3128 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,17 +1,17 @@ GIT remote: https://gitlab.com/saltstack-formulas/infrastructure/inspec - revision: 2654d96e9567010c80908b15e07b0c63220abda9 + revision: 9a3c06719f3a209f34212151883fda40787a1626 branch: ssf specs: - inspec (4.41.20) + inspec (4.46.4) faraday_middleware (>= 0.12.2, < 1.1) - inspec-core (= 4.41.20) + inspec-core (= 4.46.4) mongo (= 2.13.2) train (~> 3.0) train-aws (~> 0.2) train-habitat (~> 0.1) train-winrm (~> 0.2) - inspec-core (4.41.20) + inspec-core (4.46.4) addressable (~> 2.4) chef-telemetry (~> 1.0, >= 1.0.8) faraday (>= 0.9.0, < 1.5) @@ -55,7 +55,7 @@ GEM addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) aws-eventstream (1.2.0) - aws-partitions (1.497.0) + aws-partitions (1.501.0) aws-sdk-alexaforbusiness (1.50.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) @@ -83,7 +83,7 @@ GEM aws-sdk-budgets (1.41.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudformation (1.57.0) + aws-sdk-cloudformation (1.58.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) aws-sdk-cloudfront (1.56.0) @@ -139,10 +139,10 @@ GEM aws-sdk-dynamodb (1.63.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) - aws-sdk-ec2 (1.261.0) + aws-sdk-ec2 (1.262.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) - aws-sdk-ecr (1.45.0) + aws-sdk-ecr (1.46.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) aws-sdk-ecrpublic (1.6.0) @@ -187,7 +187,7 @@ GEM aws-sdk-iam (1.60.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) - aws-sdk-kafka (1.39.0) + aws-sdk-kafka (1.40.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) aws-sdk-kinesis (1.35.0) @@ -214,7 +214,7 @@ GEM aws-sdk-ram (1.26.0) aws-sdk-core (~> 3, >= 3.112.0) aws-sigv4 (~> 1.1) - aws-sdk-rds (1.126.0) + aws-sdk-rds (1.127.0) aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) aws-sdk-redshift (1.69.0) @@ -407,7 +407,7 @@ GEM net-ssh (>= 4.0.0) nori (2.6.0) os (1.1.1) - parallel (1.20.1) + parallel (1.21.0) parslet (1.8.2) pastel (0.8.0) tty-color (~> 0.5) diff --git a/kitchen.yml b/kitchen.yml index 828270e..4ad4e9d 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -8,6 +8,9 @@ driver: privileged: true run_command: /usr/lib/systemd/systemd +# Using the commit title as a comment to guarantee change for new commit/push: +# ci: test for upstream Salt regressions in '`'master'`' instances (2021-W37a) + provisioner: name: salt_solo log_level: debug