Skip to content

Commit

Permalink
Merge branch 'main' into automated/standardfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Stromweld authored Nov 18, 2024
2 parents 1db67ec + 2516039 commit 1fb8d21
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 76 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: ci

jobs:
lint-unit:
uses: sous-chefs/.github/.github/workflows/lint-unit.yml@bd438e6f5861a5b7ac15e6fe7d10222a4bc296be
uses: sous-chefs/.github/.github/workflows/lint-unit.yml@main
permissions:
actions: write
checks: write
Expand All @@ -30,6 +30,7 @@ jobs:
- "rockylinux-9"
- "ubuntu-2004"
- "ubuntu-2204"
- "ubuntu-2404"
suite:
- "installation-script-main"
- "installation-script-test"
Expand Down Expand Up @@ -72,7 +73,7 @@ jobs:

integration-amazonlinux:
needs: lint-unit
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
os:
Expand All @@ -99,25 +100,32 @@ jobs:

integration-smoke:
needs: lint-unit
runs-on: macos-latest
runs-on: ubuntu-latest
strategy:
matrix:
os:
- "almalinux-8"
- "centos-7"
- "centos-stream-8"
- "debian-10"
- "almalinux-9"
- "debian-11"
- "debian-12"
- "rockylinux-8"
- "ubuntu-1804"
- "rockylinux-9"
- "ubuntu-2004"
- "ubuntu-2204"
- "ubuntu-2404"
suite:
- "smoke"
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install VirtualBox & Vagrant
run: |
sudo apt update && sudo apt install virtualbox
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.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
sudo apt update && sudo apt install vagrant
- name: Install Chef
uses: actionshub/[email protected]
- name: Dokken
Expand Down
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Standardise files with files in sous-chefs/repo-management

Standardise files with files in sous-chefs/repo-management
## 11.5.1 - *2024-10-07*

Standardise files with files in sous-chefs/repo-management
## 11.5.0 - *2024-08-03*

Standardise files with files in sous-chefs/repo-management
- Add `none` as an option to `service_manager` to allow using the system defaults
- Switch to running vagrant+virtualbox on Ubuntu via nested virtualization for smoke tests
- Fix package installation tests

## 11.4.2 - *2024-07-16*

## 11.4.1 - *2024-07-16*

- Fix `version_string` for Debian Bookworm

## 11.4.0 - *2024-07-15*

- `docker_installation_package` support for Ubuntu v24.04 (noble)

## 11.3.7 - *2024-07-09*

Expand Down
21 changes: 7 additions & 14 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,25 @@ driver:
provisioner:
name: chef_infra
product_name: <%= ENV['CHEF_PRODUCT_NAME'] || 'chef' %>
product_version: <%= ENV['CHEF_VERSION'] || '17' %>
product_version: <%= ENV['CHEF_VERSION'] || 'latest' %>
enforce_idempotency: true
multiple_converge: 2
deprecations_as_errors: true
chef_license: accept-no-persist

verifier:
name: inspec

platforms:
- name: almalinux-8
- name: amazonlinux-2
- name: centos-7
- name: debian-10
# docker post-install script misbehaves on Debian 10 if systemd isn't completely started
# https://forums.docker.com/t/failed-to-load-listeners-no-sockets-found-via-socket-activation-make-sure-the-service-was-started-by-systemd/62505/11
lifecycle:
pre_converge:
- remote: 'until systemctl --quiet is-active multi-user.target; do sleep 2; done'
- name: almalinux-9
- name: debian-11
- name: fedora-latest
- name: debian-12
- name: rockylinux-8
- name: ubuntu-18.04
lifecycle:
pre_converge:
- remote: sudo apt update
- name: rockylinux-9
- name: ubuntu-20.04
- name: ubuntu-22.04
- name: ubuntu-24.04

suites:

Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Provides docker_service, docker_image, and docker_container resources'
version '11.3.7'
version '11.5.1'
source_url 'https://github.com/sous-chefs/docker'
issues_url 'https://github.com/sous-chefs/docker/issues'
chef_version '>= 16.0', '< 19.0'
Expand Down
9 changes: 8 additions & 1 deletion resources/installation_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def bullseye?
end

def bookworm?
return true if platform?('debian') && node['platform_version'].to_i == 11
return true if platform?('debian') && node['platform_version'].to_i == 12
false
end

Expand All @@ -72,6 +72,11 @@ def jammy?
false
end

def noble?
return true if platform?('ubuntu') && node['platform_version'] == '24.04'
false
end

# https://github.com/chef/chef/issues/4103
def version_string(v)
return if v.nil?
Expand All @@ -89,6 +94,8 @@ def version_string(v)
'focal'
elsif jammy? # ubuntu 22.04
'jammy'
elsif noble? # ubuntu 24.04
'noble'
end

# https://github.com/seemethere/docker-ce-packaging/blob/9ba8e36e8588ea75209d813558c8065844c953a0/deb/gen-deb-ver#L16-L20
Expand Down
5 changes: 4 additions & 1 deletion resources/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# installation type and service_manager
property :install_method, %w(script package tarball none auto), default: lazy { docker_install_method }, desired_state: false
property :service_manager, %w(execute systemd auto), default: 'auto', desired_state: false
property :service_manager, %w(execute systemd none auto), default: 'auto', desired_state: false

# docker_installation_script
property :repo, String, desired_state: false
Expand Down Expand Up @@ -78,6 +78,9 @@ def svc_manager(&block)
svc = docker_service_manager_execute(new_resource.name, &b)
when 'systemd'
svc = docker_service_manager_systemd(new_resource.name, &b)
when 'none'
Chef::Log.info('Skipping Docker Server Manager. Assuming it was handled previously.')
return
end
svc
end
Expand Down
14 changes: 7 additions & 7 deletions spec/docker_test/installation_package_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'spec_helper'

describe 'docker_test::installation_package' do
platform 'ubuntu', '18.04'
platform 'ubuntu'
step_into :docker_installation_package
cached(:subject) { chef_run }

context 'Ubuntu: testing default action, default properties' do
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default').with(version: '20.10.11')
expect(chef_run).to create_docker_installation_package('default')
end

it do
Expand All @@ -23,7 +23,7 @@
context 'Ubuntu (aarch64): testing default action, default properties' do
automatic_attributes['kernel']['machine'] = 'aarch64'
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default').with(version: '20.10.11')
expect(chef_run).to create_docker_installation_package('default')
end

it do
Expand All @@ -39,7 +39,7 @@
context 'Ubuntu (ppc64le): testing default action, default properties' do
automatic_attributes['kernel']['machine'] = 'ppc64le'
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default').with(version: '20.10.11')
expect(chef_run).to create_docker_installation_package('default')
end

it do
Expand All @@ -53,10 +53,10 @@
end

context 'CentOS: testing default action, default properties' do
platform 'centos', '8'
platform 'centos'
cached(:subject) { chef_run }
it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default').with(version: '3:20.10.11')
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
Expand All @@ -75,7 +75,7 @@
automatic_attributes['kernel']['machine'] = 's390x'

it 'installs docker' do
expect(chef_run).to create_docker_installation_package('default').with(version: '3:20.10.11')
expect(chef_run).to create_docker_installation_package('default')
end
it do
expect(chef_run).to create_yum_repository('Docker').with(
Expand Down
12 changes: 0 additions & 12 deletions test/cookbooks/docker_test/recipes/installation_package.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
docker_ver =
# Include epoch on RHEL to fix idempotency issues
if platform_family?('rhel', 'fedora')
'3:20.10.11'
# Debian 9 does not include 20.10
elsif platform?('debian') && node['platform_version'].to_i == 9
'19.03.14'
else
'20.10.11'
end

docker_installation_package 'default' do
version docker_ver
action :create
end
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
if os.name == 'debian'
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/27\.0\./) }
end
elsif os.name == 'amazon' && %w(2 2023).include?(os.release)
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/20\.10\./) }
end
elsif os.family == 'redhat' && os.release.to_i == 8
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/26\.1\./) }
end
else
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/27\.0\./) }
end
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its('stdout') { should match(/2[0-9].[0-9]/) }
end

# NOTE: See https://github.com/sous-chefs/docker/pull/1194
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
if os.family == 'redhat' && os.release.to_i == 8
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/26\.1\./) }
end
else
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/27\.1\./) }
end
describe command('/usr/bin/docker --version') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/2[0-9]\.[0-9]+\./) }
end

0 comments on commit 1fb8d21

Please sign in to comment.