Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix tests, remove EOL OSes, fix Ruby 3.4 compatibility warnings #421

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@test-kitchen/maintainers
85 changes: 0 additions & 85 deletions .github/workflows/ci.yml

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: 'Lint, Unit & Integration Tests'

"on":
pull_request:

jobs:
lint-unit:
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@main

build-matrix:
name: Build test matrix from test-kitchen config
runs-on: ubuntu-latest
needs: lint-unit
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Discover Windows suites
id: windows
run: |
cat << "EORUBY" | bundle exec ruby >> "$GITHUB_OUTPUT"
require 'inspec'
require 'kitchen'

windows_loader = Kitchen::Loader::YAML.new(project_config: './kitchen.windows.yml')
windows_suites = Kitchen::Config.new(loader: windows_loader).instances.map { |instance| instance.name }

puts "suites=#{windows_suites.to_json}"
EORUBY
- name: Discover Linux suites
id: linux
run: |
cat << "EORUBY" | bundle exec ruby >> "$GITHUB_OUTPUT"
require 'inspec'
require 'kitchen'

linux_loader = Kitchen::Loader::YAML.new(project_config: './kitchen.yml')
linux_suites = Kitchen::Config.new(loader: linux_loader).instances.map { |instance| instance.name }

puts "suites=#{linux_suites.to_json}"
EORUBY
outputs:
windows-suites: ${{ steps.windows.outputs.suites }}
linux-suites: ${{ steps.linux.outputs.suites }}

integration-windows:
name: Windows ${{matrix.suite}}
runs-on: windows-latest
needs:
- build-matrix
strategy:
fail-fast: false
matrix:
suite: ${{ fromJson(needs.build-matrix.outputs.windows-suites) }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- run: bundle exec kitchen test ${{ matrix.suite }} -l debug

integration-linux:
name: Linux ${{matrix.suite}}
runs-on: ubuntu-latest
needs:
- build-matrix
strategy:
fail-fast: false
matrix:
suite: ${{ fromJson(needs.build-matrix.outputs.linux-suites) }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- run: bundle exec kitchen test ${{ matrix.suite }} -l debug
5 changes: 1 addition & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: ruby
package-name: kitchen-docker
version-file: lib/kitchen/driver/docker_version.rb
token: ${{ secrets.PORTER_GITHUB_TOKEN }}

- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ tmp
.kitchen.local.yml
Dockerfile
.DS_Store
bin/*
.idea/*
8 changes: 3 additions & 5 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
default: true
MD004: false
MD012: false
MD013: false
MD024: false
MD026: false
MD036: false
MD012: false
MD029: false
MD004: false
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.2.0"
}
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ gemspec
group :development do
# Integration testing gems.
gem 'kitchen-inspec', '~> 2.0'
gem 'inspec', '>= 4.26.2', '< 6.0'
gem 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released
# Silence ruby 3.4.0 standard gem deprecation warnings
gem 'csv', '~> 3.3.0'
gem 'syslog', '~> 0.1.1'
end

group :test do
Expand Down
2 changes: 1 addition & 1 deletion kitchen.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provisioner:
platforms:
- name: windows
driver_config:
image: mcr.microsoft.com/windows/servercore:1809
image: mcr.microsoft.com/windows/servercore:ltsc2022
platform: windows

suites:
Expand Down
35 changes: 23 additions & 12 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,42 @@
---
driver:
name: docker
provision_command: curl -L https://www.chef.io/chef/install.sh | bash
# provision_command: curl -L https://www.chef.io/chef/install.sh | bash

transport:
name: docker

provisioner:
name: dummy

verifier:
name: inspec
inspec_tests:
- test/integration/inspec

platforms:
- name: amazonlinux-2
- name: ubuntu-18.04
# - name: amazonlinux-2023
- name: ubuntu-20.04
- name: ubuntu-22.04
- name: ubuntu-24.04
- name: fedora-latest
driver:
provision_command:
- yum install libxcrypt-compat -y
- curl -L https://www.chef.io/chef/install.sh | bash
- name: centos-7
- name: centos-stream-9
driver:
image: dokken/centos-stream-9
- name: oraclelinux-7
- name: rockylinux-8
- name: debian-11
- name: oraclelinux-8
- name: oraclelinux-9
- name: rockylinux-9
- name: debian-12
- name: opensuse-15
- name: opensuse-15.5
driver:
image: opensuse/leap:15.5
- name: opensuse-15-latest
driver:
image: opensuse/leap:15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slug should get you the latest without having to maintain the version here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up putting in the two versions separately because both of them showed to still be under active support on the website.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait I see what you mean. Specify a "latest v15" in addition to a "specific v15."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leap:15 should always be the latest

- name: dockerfile
Expand All @@ -42,7 +55,10 @@ suites:
driver:
build_context: false
- name: capabilities
includes: [debian-11, ubuntu-18.04, ubuntu-20.04]
includes:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
driver:
provision_command:
- curl -L https://www.chef.io/chef/install.sh | bash
Expand All @@ -55,8 +71,3 @@ suites:
- name: amd64
driver:
docker_platform: linux/amd64
- name: inspec
driver:
provision_command: true
verifier:
name: inspec
12 changes: 6 additions & 6 deletions lib/kitchen/docker/helpers/container_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ def remove_container(state)
def dockerfile_proxy_config
env_variables = ""
if config[:http_proxy]
env_variables << "ENV http_proxy #{config[:http_proxy]}\n"
env_variables << "ENV HTTP_PROXY #{config[:http_proxy]}\n"
env_variables << "ENV http_proxy=#{config[:http_proxy]}\n"
env_variables << "ENV HTTP_PROXY=#{config[:http_proxy]}\n"
end

if config[:https_proxy]
env_variables << "ENV https_proxy #{config[:https_proxy]}\n"
env_variables << "ENV HTTPS_PROXY #{config[:https_proxy]}\n"
env_variables << "ENV https_proxy=#{config[:https_proxy]}\n"
env_variables << "ENV HTTPS_PROXY=#{config[:https_proxy]}\n"
end

if config[:no_proxy]
env_variables << "ENV no_proxy #{config[:no_proxy]}\n"
env_variables << "ENV NO_PROXY #{config[:no_proxy]}\n"
env_variables << "ENV no_proxy=#{config[:no_proxy]}\n"
env_variables << "ENV NO_PROXY=#{config[:no_proxy]}\n"
end

env_variables
Expand Down
Loading
Loading