From de393fd6772e34460489d23af8980839e884a3ff Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 17:29:42 -0500 Subject: [PATCH 1/8] fix: update release please configs Signed-off-by: Corey Hemminger --- .github/workflows/lint.yml | 2 +- .github/workflows/publish.yml | 9 +++------ .release-please-manifest.json | 3 +++ release-please-config.json | 12 ++++++++++++ 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0eaf511..4700f36 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,4 +6,4 @@ name: 'Test' jobs: lint-unit: - uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.2 + uses: test-kitchen/.github/.github/workflows/lint-unit.yml@main diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ad5b1e4..05bbabd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,10 @@ --- +name: release-please + "on": push: - branches: - - main + branches: [main] -name: release-please jobs: release-please: runs-on: ubuntu-latest @@ -12,9 +12,6 @@ jobs: - uses: google-github-actions/release-please-action@v4 id: release with: - release-type: ruby - package-name: kitchen-vagrant - version-file: lib/kitchen/driver/vagrant_version.rb token: ${{ secrets.PORTER_GITHUB_TOKEN }} - name: Checkout diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..3086963 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.14.2" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..ee4a6d4 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,12 @@ +{ + "packages": { + ".": { + "package-name": "kitchen-vagrant", + "changelog-path": "CHANGELOG.md", + "release-type": "ruby", + "include-component-in-tag": false, + "version-file": "lib/kitchen/driver/vagrant_version.rb" + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} From da5aa3a21b73cb75e5594154c89f166bab24268b Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 18:09:09 -0500 Subject: [PATCH 2/8] fix: add release please configs Signed-off-by: Corey Hemminger --- .github/workflows/lint.yml | 29 +++++++++++++++++++++++- .markdownlint.yaml | 7 ++---- Gemfile | 3 ++- kitchen.yml | 25 ++++++++++++++++++++ test/integration/default/default_test.rb | 9 ++++++++ 5 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 kitchen.yml create mode 100644 test/integration/default/default_test.rb diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4700f36..1b017d2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,5 @@ --- -name: 'Test' +name: 'Lint, Unit & Integration Tests' 'on': pull_request: @@ -7,3 +7,30 @@ name: 'Test' jobs: lint-unit: uses: test-kitchen/.github/.github/workflows/lint-unit.yml@main + + integration: + runs-on: ubuntu-latest + needs: lint-unit + name: Kitchen Verify + steps: + - name: Install Vagrant VirtualBox + run: | + wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg + wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor | sudo tee /usr/share/keyrings/oracle-virtualbox-2016.gpg + echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list + echo "deb [signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list + sudo apt-get update + sudo apt-get install -y software-properties-common vagrant virtualbox-7.0 + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + strategy: + matrix: + ruby: ["3.3", "3.4"] + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Create & Validate containers + run: | + bundle exec kitchen verify + env: + CHEF_LICENSE: "accept-no-persist" diff --git a/.markdownlint.yaml b/.markdownlint.yaml index b5908fb..9fd2375 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,9 +1,6 @@ --- default: true +MD004: false +MD012: false MD013: false MD024: false -MD026: false -MD036: false -MD012: false -MD029: false -MD004: false diff --git a/Gemfile b/Gemfile index a1c8065..533b99b 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gemspec group :test do gem "rake" + gem "kitchen-inspec" gem "rspec", "~> 3.2" end @@ -14,4 +15,4 @@ end group :chefstyle do gem "chefstyle", "2.2.3" -end \ No newline at end of file +end diff --git a/kitchen.yml b/kitchen.yml new file mode 100644 index 0000000..ffab50e --- /dev/null +++ b/kitchen.yml @@ -0,0 +1,25 @@ +--- +driver: + name: vagrant + +provisioner: + name: shell + command: 'echo "Hello, World!"' + +verifier: + name: inspec + +platforms: + - name: almalinux-9 + - name: ubuntu-24.04 + - name: windows-2022 + driver: + box: stromweld/windows-2022 + customize: + memory: 4096 + +suites: + - name: default + verifier: + inspec_tests: + - test/integration/default diff --git a/test/integration/default/default_test.rb b/test/integration/default/default_test.rb new file mode 100644 index 0000000..08c4153 --- /dev/null +++ b/test/integration/default/default_test.rb @@ -0,0 +1,9 @@ +# Chef InSpec test for kitchen-vagrant + +# The Chef InSpec reference, with examples and extensive documentation, can be +# found at https://docs.chef.io/inspec/resources/ + +user_name = os.windows? ? 'Administrator' : 'root' +describe user(user_name) do + it { should exist } +end From de6081e670f60b675415435d94fb39f7c1370c10 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 18:16:02 -0500 Subject: [PATCH 3/8] fix tests Signed-off-by: Corey Hemminger --- .github/workflows/lint.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b017d2..548ccdd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,6 +12,10 @@ jobs: runs-on: ubuntu-latest needs: lint-unit name: Kitchen Verify + strategy: + matrix: + ruby: ["3.3", "3.4"] + os: ["almalinux-9", "ubuntu-24.04", "windows-2022"] steps: - name: Install Vagrant VirtualBox run: | @@ -23,14 +27,11 @@ jobs: sudo apt-get install -y software-properties-common vagrant virtualbox-7.0 - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 - strategy: - matrix: - ruby: ["3.3", "3.4"] with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Create & Validate containers run: | - bundle exec kitchen verify + bundle exec kitchen verify default-${{ matrix.os}} env: CHEF_LICENSE: "accept-no-persist" From e9da2d78f6c38fd39677517b9282824e6b419337 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 18:26:48 -0500 Subject: [PATCH 4/8] linting fixes Signed-off-by: Corey Hemminger --- .yamllint.yml | 4 ++++ CHANGELOG.md | 2 +- test/integration/default/default_test.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .yamllint.yml diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..5574348 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,4 @@ +--- + +rules: + line-length: disable \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d83aec7..dcdb903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -223,7 +223,7 @@ [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v1.1.0...v1.1.1) -**Fixed Bugs** +### Fixed Bugs - Fix detection of vagrant-winrm plugin. [\#309](https://github.com/test-kitchen/kitchen-vagrant/pull/309) ([silverl](https://github.com/silverl)) - Fix bug in Vagrantfile template related to WinRM options. [\#306](https://github.com/test-kitchen/kitchen-vagrant/pull/306) ([aleksey-hariton](https://github.com/aleksey-hariton)) diff --git a/test/integration/default/default_test.rb b/test/integration/default/default_test.rb index 08c4153..95cc643 100644 --- a/test/integration/default/default_test.rb +++ b/test/integration/default/default_test.rb @@ -3,7 +3,7 @@ # The Chef InSpec reference, with examples and extensive documentation, can be # found at https://docs.chef.io/inspec/resources/ -user_name = os.windows? ? 'Administrator' : 'root' +user_name = os.windows? ? "Administrator" : "root" describe user(user_name) do it { should exist } end From 9d1109b8b80bc1fced65372d057db6cad37767f7 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 18:32:36 -0500 Subject: [PATCH 5/8] test Signed-off-by: Corey Hemminger --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 548ccdd..8646c12 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,6 +32,7 @@ jobs: bundler-cache: true - name: Create & Validate containers run: | + export LOGNAME=$USER bundle exec kitchen verify default-${{ matrix.os}} env: CHEF_LICENSE: "accept-no-persist" From 3a92732d5feec6e2199d932d8804050beaa66b10 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 18:45:26 -0500 Subject: [PATCH 6/8] test Signed-off-by: Corey Hemminger --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8646c12..48b6398 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,8 +14,8 @@ jobs: name: Kitchen Verify strategy: matrix: - ruby: ["3.3", "3.4"] - os: ["almalinux-9", "ubuntu-24.04", "windows-2022"] + ruby: ["3.3"] + os: ["almalinux-9"] steps: - name: Install Vagrant VirtualBox run: | From c5f4f905fa513029ecba3927dab074d08b76b469 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 19:42:22 -0500 Subject: [PATCH 7/8] Update lint.yml Signed-off-by: Corey Hemminger --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 48b6398..9cd3259 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,7 +30,7 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Create & Validate containers + - name: Kitchen Verify run: | export LOGNAME=$USER bundle exec kitchen verify default-${{ matrix.os}} From 5278efd3ece366024aacf88bbc159c6f20f0e2c6 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 19:50:51 -0500 Subject: [PATCH 8/8] Update .rubocop.yml Signed-off-by: Corey Hemminger --- .rubocop.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 409ed81..9909d8e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,6 @@ require: - chefstyle AllCops: - TargetRubyVersion: 3.0 Include: - "**/*.rb" Exclude: