From 7d56e5c8e14bd7d54db37863cff657fafa43c9fb Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Fri, 26 Jun 2026 10:48:52 -0400 Subject: [PATCH 1/2] Try to add more in-depth testing Add plumbing not previously-copied from template --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++ Gemfile | 27 +++++++++++++++++++++++++ git-bash/_mapdata/init.sls | 13 ++++++++----- kitchen.yml | 40 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 Gemfile create mode 100644 kitchen.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 751d7c2..4cfbf7d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,3 +26,40 @@ jobs: salt-os-version: ${{ matrix.os_version }} salt-state: ${{ matrix.salt_state }} salt-pillar-root: ${{ matrix.salt_pillar_root }} + + verify-shortcut-integration: + name: "Execute Salt Kitchen Integration Verification" + runs-on: "windows-2022" + steps: + - name: "Check Out Source Repository" + uses: "actions/checkout@v4" + + - name: "Set Up Ruby Execution Environment" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "3.2" + + - name: "Regenerate Dependency Lockfile with Full Index" + run: | + Remove-Item Gemfile.lock -Force -ErrorAction SilentlyContinue + bundle install --full-index + shell: "powershell" + + - name: "Install Salt Minion Natively" + run: | + choco install saltminion -y + echo "C:\Program Files\Salt Project\Salt" >> $env:GITHUB_PATH + shell: "powershell" + + - name: "Execute Converge and Verify Integration Tests" + run: | + bundle exec kitchen converge default + bundle exec kitchen verify default + shell: "powershell" + + - if: "always()" + name: "Upload Test Kitchen Execution Logs" + uses: "actions/upload-artifact@v4" + with: + name: "kitchen-logs" + path: ".kitchen/logs/" diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..f084722 --- /dev/null +++ b/Gemfile @@ -0,0 +1,27 @@ +# 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.14.2 + +source ENV.fetch('PROXY_RUBYGEMSORG', 'https://rubygems.org') + +# Install the `inspec` gem using `git` because versions after `4.22.22` +# suppress diff output; this version fixes this for our uses. +# rubocop:disable Layout/LineLength +gem 'inspec', git: 'https://gitlab.com/saltstack-formulas/infrastructure/inspec', branch: 'ssf' +# rubocop:enable Layout/LineLength + +# Install the `kitchen-docker` gem using `git` in order to avoid an upstream +# error caused by `kitchen-docker.gemspec`. +# TODO: correct the error upstream +# rubocop:disable Layout/LineLength +gem 'kitchen-docker', git: 'https://github.com/dafyddj/kitchen-docker', branch: 'chore/gemspec' +# rubocop:enable Layout/LineLength + +gem 'kitchen-inspec', '3.1.0' +gem 'kitchen-salt', '0.7.2' + +gem 'net-ssh', '7.3.2' + +gem 'test-kitchen', '4.0.0' diff --git a/git-bash/_mapdata/init.sls b/git-bash/_mapdata/init.sls index 3529a8d..927f7e8 100644 --- a/git-bash/_mapdata/init.sls +++ b/git-bash/_mapdata/init.sls @@ -10,13 +10,16 @@ } %} {%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %} -{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %} -{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %} +{%- set output_dir = "C:\\temp" if grains.os_family == "Windows" else "/tmp" %} +{%- set output_file = output_dir ~ "\\salt_mapdata_dump.yaml" + if grains.os_family == "Windows" + else output_dir ~ "/salt_mapdata_dump.yaml" %} -{{ tplroot }}-mapdata-dump: +Dump Formula Map Data To File: file.managed: + - context: + map: {{ _mapdata | yaml }} + - makedirs: true - name: {{ output_file }} - source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja - template: jinja - - context: - map: {{ _mapdata | yaml }} diff --git a/kitchen.yml b/kitchen.yml new file mode 100644 index 0000000..33704ba --- /dev/null +++ b/kitchen.yml @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +driver: + name: "exec" + +provisioner: + formula: "git-bash" + log_level: "debug" + name: "salt_solo" + pillars_from_directories: + - "tests/pillar/git-bash" + require_chef: false + root_path: "C:\\salt_kitchen" + salt_copy_filter: + - ".kitchen" + - ".git" + salt_install: "none" + +transport: + max_wait_until_ready: 60 + +verifier: + name: "inspec" + reporter: + - "cli" + root_path: "C:\\salt_kitchen" + sudo: true + +platforms: + - name: "windows-2022" + +suites: + - name: "default" + provisioner: + state_top: + base: + "*": + - "git-bash._mapdata" + - "git-bash" From b2670bf98a16606dd85d98c8e0e0bb12f25b548c Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Fri, 26 Jun 2026 14:59:00 -0400 Subject: [PATCH 2/2] Remove Windows 2019 from test-matrix GitHub has wholly deprecated Windows 2019 runners for GitHub actions. As such, jobs pointed to that runner-type will hang and eventually timeout, causing spurious failures to be logged during CI activities. --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4cfbf7d..282eaee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,6 @@ jobs: strategy: matrix: os_version: - - windows-2019 - windows-2022 - windows-2025 salt_state: