From 3077c8e4fe05f2a3a3b1c1061d162a244f1adb8d Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Fri, 30 Jul 2021 15:04:07 -0700 Subject: [PATCH 1/8] Use local exec on GH Actions runners rather than Vagrant Since these VMs don't need to reboot, run directly on the runner instead of using a nested VM. Signed-off-by: Robert Detjens --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++---- kitchen.exec.yml | 14 ++++++++++++++ kitchen.yml | 17 ++++++++++++++++- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 kitchen.exec.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3ed6a6..f1a3881 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,16 +75,38 @@ jobs: sudo journalctl -l --since today KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l" + integration-windows: + needs: [mdl, yamllint, delivery] + runs-on: windows-latest + strategy: + matrix: + os: + - windows-latest + suite: + - resources + fail-fast: false + + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Install Chef + uses: actionshub/chef-install@main + - name: test-kitchen + uses: actionshub/test-kitchen@main + env: + CHEF_LICENSE: accept-no-persist + KITCHEN_LOCAL_YAML: kitchen.exec.yml + with: + suite: ${{ matrix.suite }} + os: ${{ matrix.os }} + integration-macos: needs: [mdl, yamllint, delivery] runs-on: macos-latest strategy: matrix: os: - - windows-2012r2 - - windows-2016 - - windows-2019 - - macos-1015 + - macos-latest suite: - resources fail-fast: false @@ -98,6 +120,7 @@ jobs: uses: actionshub/test-kitchen@main env: CHEF_LICENSE: accept-no-persist + KITCHEN_LOCAL_YAML: kitchen.exec.yml with: suite: ${{ matrix.suite }} os: ${{ matrix.os }} diff --git a/kitchen.exec.yml b/kitchen.exec.yml new file mode 100644 index 0000000..980f952 --- /dev/null +++ b/kitchen.exec.yml @@ -0,0 +1,14 @@ +--- +driver: + name: exec + +transport: + name: exec + +provisioner: + name: chef_zero + deprecations_as_errors: true + +platforms: + - name: windows-latest + - name: macos-latest diff --git a/kitchen.yml b/kitchen.yml index c6f7478..f091554 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -4,7 +4,7 @@ driver: provisioner: name: chef_zero - product_name: chef + product_name: cinc enforce_idempotency: true multiple_converge: 2 deprecations_as_errors: true @@ -28,14 +28,29 @@ platforms: driver: box: tas50/windows_2012r2 gui: false + customize: + memory: 2048 + transport: + name: winrm + elevated: true - name: windows-2016 driver: box: tas50/windows_2016 gui: false + customize: + memory: 2048 + transport: + name: winrm + elevated: true - name: windows-2019 driver: box: tas50/windows_2019 gui: false + customize: + memory: 2048 + transport: + name: winrm + elevated: true - name: macos-10.15 run_list: homebrew::default driver: From 6a3c8b70434628933789e5216f5b859f344a4435 Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Tue, 3 Aug 2021 15:17:35 -0700 Subject: [PATCH 2/8] Fix string interp in windows helper Signed-off-by: Robert Detjens --- kitchen.yml | 5 +++-- libraries/helpers.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index f091554..e0ec168 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -4,9 +4,10 @@ driver: provisioner: name: chef_zero - product_name: cinc - enforce_idempotency: true + product_name: chef + chef_license: accept-no-persist multiple_converge: 2 + enforce_idempotency: true deprecations_as_errors: true verifier: diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 7bf29b3..0eaad74 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -36,7 +36,7 @@ def parsed_windows_package_version def parsed_windows_package_url return new_resource.windows_package_url if new_resource.windows_package_url - "https://github.com/git-for-windows/git/releases/download/v%#{parsed_windows_package_version}.windows.1/Git-%#{parsed_windows_package_version}-32-bit.exe" + "https://github.com/git-for-windows/git/releases/download/v#{parsed_windows_package_version}.windows.1/Git-#{parsed_windows_package_version}-32-bit.exe" end def parsed_windows_package_checksum From 8fc1d8db07b115a91cffbbc361ff1c2c59684f3d Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Tue, 3 Aug 2021 16:18:26 -0700 Subject: [PATCH 3/8] Add Changelog entry Signed-off-by: Robert Detjens --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a025ab2..d38e2ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Fix Windows/MacOS CI testing + ## 11.0.1 - *2021-08-30* - Standardise files with files in sous-chefs/repo-management From af961323507e88d4d7ba2221255962f4b97fa9f3 Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Tue, 3 Aug 2021 16:35:02 -0700 Subject: [PATCH 4/8] Allow path editing on Windows runner Signed-off-by: Robert Detjens --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1a3881..5d88fee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,6 +96,7 @@ jobs: env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.exec.yml + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' # allow path editing with: suite: ${{ matrix.suite }} os: ${{ matrix.os }} From 9738cbd5fe4e880c5fdce527e0759915b10c72ff Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Wed, 4 Aug 2021 11:37:22 -0700 Subject: [PATCH 5/8] Use yaml bool instead of string Co-authored-by: Dan Webb --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d88fee..9fa3c81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.exec.yml - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' # allow path editing + ACTIONS_ALLOW_UNSECURE_COMMANDS: true # allow path editing with: suite: ${{ matrix.suite }} os: ${{ matrix.os }} From 24fcb9eb249c0e7c01b35e6ed216626aead1d0f7 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 14 Feb 2022 09:26:23 +0000 Subject: [PATCH 6/8] Dependon the correct workflow Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73aae8f..a61d42f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,7 @@ name: ci "on": pull_request: push: - branches: - - main + branches: [main] jobs: lint-unit: @@ -54,14 +53,12 @@ jobs: KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l" integration-windows: - needs: [mdl, yamllint, delivery] + needs: lint-unit runs-on: windows-latest strategy: matrix: - os: - - windows-latest - suite: - - resources + os: [windows-latest] + suite: [resources] fail-fast: false steps: @@ -74,7 +71,7 @@ jobs: env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.exec.yml - ACTIONS_ALLOW_UNSECURE_COMMANDS: true # allow path editing + # ACTIONS_ALLOW_UNSECURE_COMMANDS: true # allow path editing with: suite: ${{ matrix.suite }} os: ${{ matrix.os }} @@ -84,12 +81,9 @@ jobs: runs-on: macos-10.15 strategy: matrix: - os: - - macos-latest - suite: - - resources + os: [macos-latest] + suite: [resources] fail-fast: false - steps: - name: Check out code uses: actions/checkout@v2 From 562af2c27cce8c4323ce7a32c2a435a06ac7d2c4 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 14 Feb 2022 09:48:06 +0000 Subject: [PATCH 7/8] Use MacOS 11 image Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 2 +- kitchen.dokken.yml | 5 ++--- kitchen.exec.yml | 11 ++--------- kitchen.yml | 6 ++---- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a61d42f..62c4e0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: integration-macos: needs: lint-unit - runs-on: macos-10.15 + runs-on: macos-11 strategy: matrix: os: [macos-latest] diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 61a6cc5..caf68eb 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -1,10 +1,9 @@ --- driver: name: dokken - privileged: true # because Docker and SystemD + privileged: true -transport: - name: dokken +transport: { name: dokken } provisioner: name: dokken diff --git a/kitchen.exec.yml b/kitchen.exec.yml index 980f952..61fca24 100644 --- a/kitchen.exec.yml +++ b/kitchen.exec.yml @@ -1,13 +1,6 @@ --- -driver: - name: exec - -transport: - name: exec - -provisioner: - name: chef_zero - deprecations_as_errors: true +driver: { name: exec } +transport: { name: exec } platforms: - name: windows-latest diff --git a/kitchen.yml b/kitchen.yml index ca3babe..ef883f3 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -1,6 +1,5 @@ --- -driver: - name: vagrant +driver: { name: vagrant } provisioner: name: chef_infra @@ -10,8 +9,7 @@ provisioner: enforce_idempotency: true deprecations_as_errors: true -verifier: - name: inspec +verifier: { name: inspec } platforms: - name: amazonlinux-2 From 67451e13326cb09d279d72044b78c36bf38af5a7 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 14 Feb 2022 09:56:32 +0000 Subject: [PATCH 8/8] Fix Windows path in tests Signed-off-by: Dan Webb --- test/fixtures/cookbooks/test/recipes/default.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/fixtures/cookbooks/test/recipes/default.rb b/test/fixtures/cookbooks/test/recipes/default.rb index 1199f23..4e310a2 100644 --- a/test/fixtures/cookbooks/test/recipes/default.rb +++ b/test/fixtures/cookbooks/test/recipes/default.rb @@ -2,9 +2,11 @@ git_client 'install it' +user_path = platform_family?('windows') ? 'C:\Users\random' : '/home/random' + user 'random' do manage_home true - home '/home/random' + home user_path end git_config 'add name to random' do @@ -14,8 +16,8 @@ value 'John Doe global' end -git '/home/random/git_repo' do - repository 'https://github.com/chef/chef-repo.git' +git "#{user_path}/git_repo" do + repository 'https://github.com/chef-boneyard/chef-repo.git' user 'random' end @@ -24,7 +26,7 @@ scope 'local' key 'user.name' value 'John Doe local' - path '/home/random/git_repo' + path "#{user_path}/git_repo" end git_config 'change system config' do