From 1ad1dbe0fcfcd7c866b217b38528c623148a24ee Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 25 Jun 2024 11:23:53 -0600 Subject: [PATCH] Reverted to using kitchen-salt in order to get this out faster --- .github/workflows/ci.yml | 9 +- .github/workflows/templates/ci.yml | 9 +- .github/workflows/test-linux.yml | 28 ++- .github/workflows/test-macos.yml | 27 ++- .github/workflows/test-windows.yml | 33 ++-- .pre-commit-config.yaml | 11 +- CHANGELOG.md | 3 +- Gemfile | 11 ++ kitchen.macos.yml | 42 +++++ kitchen.windows.yml | 42 +++++ kitchen.yml | 286 +++++++++++++++++++++++++++++ 11 files changed, 436 insertions(+), 65 deletions(-) create mode 100644 Gemfile create mode 100644 kitchen.macos.yml create mode 100644 kitchen.windows.yml create mode 100644 kitchen.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc3ac74..73ae839 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,8 @@ jobs: separator: "," files: | bootstrap-salt.* - ## DGM Gemfile - ## DGM kitchen*.yml - btstrap-build*.yml + Gemfile + kitchen*.yml tests/** .github/workflows/** files_ignore: | @@ -62,10 +61,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: 3.9 - name: Install Pre-Commit run: | diff --git a/.github/workflows/templates/ci.yml b/.github/workflows/templates/ci.yml index f24688d..2bde230 100644 --- a/.github/workflows/templates/ci.yml +++ b/.github/workflows/templates/ci.yml @@ -27,9 +27,8 @@ jobs: separator: "," files: | bootstrap-salt.* - ## DGM Gemfile - ## DGM kitchen*.yml - btstrap-build*.yml + Gemfile + kitchen*.yml tests/** .github/workflows/** files_ignore: | @@ -62,10 +61,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: 3.9 - name: Install Pre-Commit run: | diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index c8a1915..75235df 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -38,16 +38,17 @@ jobs: - uses: actions/checkout@v3 ## DGM Need to replace this - ## DGM - name: Setup Ruby - ## DGM uses: ruby/setup-ruby@v1 - ## DGM with: - ## DGM ruby-version: 3.2.3 - ## DGM bundler-cache: true + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ## DGM ruby-version: 3.2.3 + ruby-version: 2.6.10 + bundler-cache: true - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: 3.9 - name: Install Python Dependencies run: | @@ -57,27 +58,20 @@ jobs: - name: Create Test Instance run: | ## DGM Need to replace this - ## DGM b - ## DGM (sleep 10 && bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }}) - ## DGM - ## DGM Need to select a GitHub runner here , ubuntu-latest + (sleep 10 && bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }}) sleep 2 - name: Test Bootstrap run: | ## DGM Need to replace this - ## DGM bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM Need to run the bootstrap tests for Linux here + bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Destroy Test Instance if: always() run: | ## DGM Need to replace this - ## DGM bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM this can be removed since using GitHub shared runners, and it should just close when done with it + bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Set Exit Status diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index a42c9b4..8d53170 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -28,9 +28,9 @@ on: default: 20 description: The timeout(in minutes) for the workflow -## DGM env: -## DGM KITCHEN_LOCAL_YAML: 'kitchen.macos.yml' -## DGM +env: + KITCHEN_LOCAL_YAML: 'kitchen.macos.yml' + ## DGM Wonder what the KITCHEN_LOCAL_YAML had to be set here for MacOS, do we need to do something similar for runners ? jobs: @@ -50,13 +50,14 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2.3 + ## DGM ruby-version: 3.2.3 + ruby-version: 2.6.10 bundler-cache: true - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: 3.9 - name: Install Python Dependencies run: | @@ -65,25 +66,19 @@ jobs: - name: Create Test Instance run: | - ## DGM bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }} || \ - ## DGM (sleep 10 && bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }}) - ## DGM - ## DGM Need to select a GitHub runner here , macos-latest + bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }} || \ + (sleep 10 && bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }}) sleep 2 - name: Test Bootstrap run: | - ## DGM bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM Need to run the bootstrap tests for MacOS here + bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Destroy Test Instance if: always() run: | - ## DGM bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM this can be removed since using GitHub shared runners, and it should just close when done with it + bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Set Exit Status diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 930e6c9..dea426a 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -28,12 +28,12 @@ on: default: 20 description: The timeout(in minutes) for the workflow -## DGM env: -## DGM machine_user: kitchen -## DGM machine_pass: Password1 -## DGM machine_port: 5985 -## DGM KITCHEN_LOCAL_YAML: 'kitchen.windows.yml' -## DGM +env: + machine_user: kitchen + machine_pass: Password1 + machine_port: 5985 + KITCHEN_LOCAL_YAML: 'kitchen.windows.yml' + ## DGM Wonder what the KITCHEN_LOCAL_YAML had to be set here for Windows, do we need to do something similar for runners ? jobs: @@ -53,7 +53,8 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2.3 + ## DGM ruby-version: 3.2.3 + ruby-version: 2.6.10 bundler-cache: true - name: Install Chef @@ -82,10 +83,10 @@ jobs: winrm set winrm/config/service '@{AllowUnencrypted="True"}' env - - name: Set up Python 3.10 + - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: 3.9 - name: Install Python Dependencies run: | @@ -94,25 +95,19 @@ jobs: - name: Create Test Instance run: | - ## DGM bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM Need to select a GitHub runner here , ubuntu-latest + bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Test Bootstrap run: | - ## DGM env - ## DGM bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM Need to run the bootstrap tests for Windows here + env + bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Destroy Test Instance if: always() run: | - ## DGM bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }} - ## DGM - ## DGM this can be removed since using GitHub shared runners, and it should just close when done with it + bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }} sleep 2 - name: Set Exit Status diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d916858..9fb6a26 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,12 +37,19 @@ repos: args: - requirements/release.in +## DGM - repo: https://github.com/asottile/pyupgrade +## DGM rev: v3.15.0 +## DGM hooks: +## DGM - id: pyupgrade +## DGM name: Rewrite Code to be Py3.10+ +## DGM args: [--py310-plus] + - repo: https://github.com/asottile/pyupgrade rev: v3.15.0 hooks: - id: pyupgrade - name: Rewrite Code to be Py3.10+ - args: [--py310-plus] + name: Rewrite Code to be Py3.9+ + args: [--py39-plus] - repo: https://github.com/asottile/reorder_python_imports rev: v3.12.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index e503a9c..f32d61f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## What's Changed -- Removed support for Ruby, Kitchen and kitchen-salt and it's associated utilities +## DGM - Removed support for Ruby, Kitchen and kitchen-salt and it's associated utilities + - Migrated to using GitHub Actions - Removed support of End-Of-Life OS's, for example: Debian 7, 8, 9 & 10, RHEL 7 - Removed support for FreeBSD and OpenBSD diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a70a9da --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem 'test-kitchen', '>= 3.2.2' +gem 'kitchen-salt', '>= 0.7.2' +gem 'kitchen-docker', :git => 'https://github.com/test-kitchen/kitchen-docker.git', :branch => 'main' + +group :vagrant do + gem 'kitchen-vagrant' +end diff --git a/kitchen.macos.yml b/kitchen.macos.yml new file mode 100644 index 0000000..616a489 --- /dev/null +++ b/kitchen.macos.yml @@ -0,0 +1,42 @@ +--- +driver: + name: exec + +provisioner: + sudo: true + salt_bootstrap_options: -MP stable %s + init_environment: | + echo 'auto_accept: true' > /tmp/auto-accept-keys.conf + sudo mkdir -p /etc/salt/master.d + sudo mv /tmp/auto-accept-keys.conf /etc/salt/master.d/auto-accept-keys.conf + brew install coreutils + sh -c 't=$(gshuf -i 1-15 -n 1); echo Sleeping $t seconds; sleep $t' + +platforms: + - name: macos-12 + - name: macos-13 + +suites: + - name: stable-3006 + provisioner: + salt_version: 3006 + salt_call_command: /opt/salt/salt-call + - name: stable-3006-8 + provisioner: + salt_version: 3006.8 + salt_call_command: /opt/salt/salt-call + - name: stable-3007 + provisioner: + salt_version: 3007 + salt_call_command: /opt/salt/salt-call + - name: stable-3007-1 + provisioner: + salt_version: 3007.1 + salt_call_command: /opt/salt/salt-call + - name: latest + provisioner: + salt_version: latest + salt_call_command: /opt/salt/salt-call + +verifier: + command: pytest --cache-clear -v -s -ra --log-cli-level=debug -k "not test_ping" tests/integration/ diff --git a/kitchen.windows.yml b/kitchen.windows.yml new file mode 100644 index 0000000..a2b88e2 --- /dev/null +++ b/kitchen.windows.yml @@ -0,0 +1,42 @@ +--- +driver: + name: proxy + host: localhost + reset_command: "exit 0" + port: 5985 + username: kitchen + password: Password1 + +provisioner: + salt_bootstrap_url: D:/a/salt-bootstrap/salt-bootstrap/bootstrap-salt.ps1 + salt_bootstrap_options: -Version %s -Verbose + init_environment: '' + +platforms: + - name: windows-2022 + - name: windows-2019 + +suites: + - name: stable-3006 + provisioner: + salt_version: 3006 + salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe + - name: stable-3006-8 + provisioner: + salt_version: 3006.8 + salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe + - name: stable-3007 + provisioner: + salt_version: 3007 + salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe + - name: stable-3007-1 + provisioner: + salt_version: 3007.1 + salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe + - name: latest + provisioner: + salt_version: latest + salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe + +verifier: + command: pytest --cache-clear -v -s -ra --log-cli-level=debug -k "not test_ping" tests/integration/ diff --git a/kitchen.yml b/kitchen.yml new file mode 100644 index 0000000..f5d91cd --- /dev/null +++ b/kitchen.yml @@ -0,0 +1,286 @@ +--- +driver: + name: docker + use_sudo: false + hostname: salt + privileged: true + username: root + cap_add: + - sys_admin + disable_upstart: false + use_internal_docker_network: false + run_command: /usr/lib/systemd/systemd + +provisioner: + name: salt_solo + salt_install: bootstrap + salt_bootstrap_url: bootstrap-salt.sh + salt_bootstrap_options: -MPfq git %s + install_after_init_environment: true + log_level: info + sudo: false + require_chef: false + formula: tests + run_salt_call: false + init_environment: | + echo 'auto_accept: true' > /tmp/auto-accept-keys.conf + mkdir -p /etc/salt/master.d + mv /tmp/auto-accept-keys.conf /etc/salt/master.d/auto-accept-keys.conf + sh -c 't=$(shuf -i 1-15 -n 1); echo Sleeping $t seconds; sleep $t' + +platforms: + - name: almalinux-9 + driver: + provision_command: + - dnf -y install crypto-policies-scripts procps-ng + ## DGM - update-crypto-policies --set DEFAULT:SHA1 + - update-crypto-policies + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: almalinux-8 + - name: amazon-2 + driver: + image: amazonlinux:2 + platform: rhel + provision_command: + - yum -y install procps-ng + - name: amazon-2023 + driver: + image: amazonlinux:2023 + platform: fedora + provision_command: + - yum -y install procps-ng + - name: arch + driver: + image: archlinux/archlinux + provision_command: + - pacman -Syu --noconfirm --needed systemd grep awk procps which + - systemctl enable sshd + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: centos-stream9 + driver: + platform: centosstream + image: quay.io/centos/centos:stream9 + provision_command: + - dnf -y install crypto-policies-scripts procps-ng + ## DGM - update-crypto-policies --set DEFAULT:SHA1 + - update-crypto-policies + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: centos-stream8 + driver: + image: quay.io/centos/centos:stream8 + - name: debian-11 + driver: + image: debian:bullseye + run_command: /lib/systemd/systemd + - name: debian-12 + driver: + image: debian:bookworm + run_command: /lib/systemd/systemd + - name: fedora-39 + driver: + provision_command: &fedora_provision_command + - dnf -y install procps-ng crypto-policies-scripts + - update-crypto-policies --set LEGACY + - name: fedora-40 + driver: + provision_command: *fedora_provision_command + - name: gentoo + driver: + image: gentoo/stage3:latest + run_command: /sbin/init + provision_command: + - rc-update add sshd default + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: gentoo-systemd + driver: + image: gentoo/stage3:systemd + run_command: /lib/systemd/systemd + provision_command: + - systemctl enable sshd.service + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: opensuse-15 + driver: + image: opensuse/leap:15.4 + provision_command: + - &opensuse_provision_command_01 zypper --non-interactive install --auto-agree-with-licenses dbus-1 + - &opensuse_provision_command_02 zypper --non-interactive install --auto-agree-with-licenses sudo openssh which curl systemd + - &opensuse_provision_command_03 systemctl enable sshd.service + - name: opensuse-tumbleweed + driver: + image: opensuse/tumbleweed:latest + provision_command: + - *opensuse_provision_command_01 + - *opensuse_provision_command_02 + - *opensuse_provision_command_03 + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: rockylinux-9 + driver: + platform: centosstream + run_command: /usr/lib/systemd/systemd + provision_command: + - dnf -y install crypto-policies-scripts procps-ng + ## DGM - update-crypto-policies --set DEFAULT:SHA1 + - update-crypto-policies + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: rockylinux-8 + - name: oraclelinux-8 + - name: rockylinux-8 + - name: ubuntu-22.04 + - name: ubuntu-24.04 + driver: + run_command: /lib/systemd/systemd + provision_command: + - echo "PubkeyAcceptedAlgorithms +ssh-rsa" | tee -a /etc/ssh/sshd_config + - name: ubuntu-20.04 + driver: + run_command: /lib/systemd/systemd + - name: photon-4 + driver: + image: photon:4.0 + provision_command: + - tdnf -y install rpm procps-ng coreutils gawk + - echo "PubkeyAcceptedKeyTypes +ssh-rsa" | tee -a /etc/ssh/sshd_config + - sed -ie 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config + - systemctl enable sshd.service + - name: photon-5 + driver: + image: photon:5.0 + provision_command: + - tdnf -y install rpm procps-ng coreutils gawk + - echo "PubkeyAcceptedKeyTypes +ssh-rsa" | tee -a /etc/ssh/sshd_config + - sed -ie 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config + - systemctl enable sshd.service + +suites: + - name: git-3006 + provisioner: + salt_version: v3006 + salt_bootstrap_options: -x python3 -MPfq git %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - debian-11 + - arch + - gentoo + - gentoo-systemd + - name: git-3006x + provisioner: + salt_version: 3006.x + salt_bootstrap_options: -x python3 -MPfq git %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - debian-11 + - arch + - gentoo + - gentoo-systemd + - name: git-3007 + provisioner: + salt_version: v3007 + salt_bootstrap_options: -x python3 -MPfq git %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - debian-11 + - arch + - gentoo + - gentoo-systemd + - name: git-3007x + provisioner: + salt_version: 3007.x + salt_bootstrap_options: -x python3 -MPfq git %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - debian-11 + - arch + - gentoo + - gentoo-systemd + - name: stable-3006 + provisioner: + salt_version: 3006 + salt_bootstrap_options: -x python3 -MP stable %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - arch + - name: stable-3006-8 + provisioner: + salt_version: 3006.8 + salt_bootstrap_options: -x python3 -MP stable %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - arch + - name: stable-3007 + provisioner: + salt_version: 3007 + salt_bootstrap_options: -x python3 -MP stable %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - arch + - name: stable-3007-1 + provisioner: + salt_version: 3007.1 + salt_bootstrap_options: -x python3 -MP stable %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - arch + - name: git-master + provisioner: + salt_version: master + salt_bootstrap_options: -x python3 -MPfq -D git %s + + - name: latest + provisioner: + salt_version: latest + salt_bootstrap_options: -MP stable %s + + - name: default + provisioner: + salt_version: latest + salt_bootstrap_options: -MP + + - name: onedir-nightly + provisioner: + salt_version: nightly + salt_bootstrap_options: -MP onedir %s + + - name: onedir-latest + provisioner: + salt_version: latest + salt_bootstrap_options: -MP onedir %s + + - name: onedir-3006 + provisioner: + salt_version: 3006 + salt_bootstrap_options: -MP onedir %s + + - name: onedir-3007 + provisioner: + salt_version: 3007 + salt_bootstrap_options: -MP onedir %s + + - name: onedir-rc-3008-0rc1 + provisioner: + salt_version: 3008.0rc1 + salt_bootstrap_options: -R staging.repo.saltproject.io -MP onedir_rc %s + excludes: + - arch + - gentoo + - opensuse-15 + - opensuse-tumbleweed + - ubuntu-2004 + - ubuntu-2204 + + + - name: quickstart + provisioner: + salt_bootstrap_options: -Q + +verifier: + name: shell + remote_exec: false + command: pytest --cache-clear -v -s -ra --log-cli-level=info tests/integration/