From 6aa327cf574ae249a53541c37d0b112844fcbdb8 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Mon, 28 Oct 2024 09:31:21 +0100 Subject: [PATCH 1/2] feat: update gitlabci example --- .gitlab-ci.yml | 146 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 106 insertions(+), 40 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61e243d..e43719a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,89 +1,155 @@ --- # Example of a CI/CD pipeline for a Puppet module +# Pipeline runs on main and merge_requests, but not on tags. +# stages: - - QA🚦 - - Test🚥 + - 🚦 QA + -🚥 Test variables: +# Use internal default Rakefile, to make sure we have a working version RAKE: rake -f /Rakefile default: image: - name: ghcr.io/voxpupuli/vobox:7.29.1-main + name: ghcr.io/voxpupuli/voxbox:7.34.0-main entrypoint: [""] -### QA🚦 +### Templates +.default_rules: + rules: + - &puppetfile + if: '$CI_COMMIT_TAG == null' + exists: + - 'Puppetfile' + changes: + - 'Puppetfile' + +### 🚦 QA .qa: - stage: QA🚦 + stage: 🚦 QA qa-check: extends: .qa script: - $RAKE check + rules: + - if: '$CI_COMMIT_TAG == null' qa-lint: extends: .qa script: - - $RAKE lint + - $RAKE voxpupuli:custom:lint_all + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - '**/*.pp' -qa-metadata_lint: +qa-yamllint: extends: .qa script: - - $RAKE metadata_lint + - yamllint data/ + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - 'data/**/*.yaml' -qa-puppet-strings: +qa-metadata_lint: extends: .qa script: - - $RAKE strings:validate:reference + - $RAKE metadata_lint + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - metadata.json qa-rubocop: extends: .qa script: - $RAKE rubocop + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - '**/*.rb' + +qa-strings: + extends: .qa + script: + - $RAKE strings:validate:reference + rules: + - if: '$CI_COMMIT_TAG == null' + exists: + - REFERENCE.md qa-syntax: extends: .qa script: - $RAKE syntax + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - 'data/**/*.yaml' + - 'manifests/**/*.pp' + - 'plans/**/*.pp' + - 'templates/**/*.epp' + - 'templates/**/*.erb' -qa-gateway: - stage: QA🚦 - image: alpine:latest +qa-r10k-syntax: + extends: .qa script: - - echo "QA Gateway" - variables: - GIT_STRATEGY: none - needs: - - qa-check - - qa-lint - - qa-metadata_lint - - qa-puppet-strings - - qa-rubocop - - qa-syntax - -### Test🚥 + - $RAKE r10k:syntax + rules: + - *puppetfile + +qa-r10k-duplicates: + extends: .qa + script: + - $RAKE r10k:duplicates + rules: + - *puppetfile + +qa-r10k-validate: + extends: .qa + script: + - $RAKE r10k:validate + rules: + - *puppetfile + +### 🚥 Test .test: - stage: Test🚥 - needs: - - qa-gateway + stage: 🚥 Test test-unit: extends: .test script: - - $RAKE spec + - $RAKE spec + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - 'data/**/*.yaml' + - 'manifests/**/*.pp' + - 'plans/**/*.pp' + - 'spec/**/*_spec.rb' + - 'templates/**/*.epp' + - 'templates/**/*.erb' -test-acceptance: +test-r10k-install: extends: .test script: - - $RAKE beaker + - $RAKE r10k:install + rules: + - *puppetfile -test-gateway: - stage: Test🚥 - image: alpine:latest +test-acceptance: + extends: .test script: - - echo "Test Gateway" - variables: - GIT_STRATEGY: none - needs: - - test-unit - - test-acceptance + - $RAKE beaker + rules: + - if: '$CI_COMMIT_TAG == null' + changes: + - 'data/**/*.yaml' + - 'manifests/**/*.pp' + - 'plans/**/*.pp' + - 'spec/**/*_spec.rb' + - 'templates/**/*.epp' + - 'templates/**/*.erb' From 585a454e002b6ded2e49b525d316f32a197c3c44 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Fri, 15 Nov 2024 11:30:51 +0100 Subject: [PATCH 2/2] fix: style updates --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e43719a..94a1dfa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,10 +4,10 @@ # stages: - 🚦 QA - -🚥 Test + - 🚥 Test variables: -# Use internal default Rakefile, to make sure we have a working version + # Use internal default Rakefile, to make sure we have a working version RAKE: rake -f /Rakefile default: @@ -15,7 +15,7 @@ default: name: ghcr.io/voxpupuli/voxbox:7.34.0-main entrypoint: [""] -### Templates +### Templates ################################################################# .default_rules: rules: - &puppetfile @@ -25,7 +25,7 @@ default: changes: - 'Puppetfile' -### 🚦 QA +### 🚦 QA ###################################################################### .qa: stage: 🚦 QA @@ -115,7 +115,7 @@ qa-r10k-validate: rules: - *puppetfile -### 🚥 Test +### 🚥 Test #################################################################### .test: stage: 🚥 Test