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

Add Docker Swarm support #1296

Merged
merged 29 commits into from
Jan 31, 2025
Merged
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
46 changes: 46 additions & 0 deletions .github/actions/chef-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Install Chef'
description: 'Installs Chef products on Windows or Linux/macOS'

inputs:
channel:
description: 'Chef download channel'
required: false
default: 'stable'
project:
description: 'Chef project to download'
required: false
default: 'chef-workstation'
version:
description: 'Version of Chef product'
required: false
license-id:
description: 'Chef license ID'
required: true
windows-path:
description: 'Windows installation path'
required: false
default: 'C:\opscode'

runs:
using: "composite"
steps:
- name: Install Chef on Linux/macOS
if: runner.os != 'Windows'
shell: bash
run: |
curl -L https://chefdownload-commercial.chef.io/install.sh?license_id=${{ inputs.license-id }} -o chefDownload.sh
sudo chmod +x chefDownload.sh
sudo ./chefDownload.sh -c ${{ inputs.channel }} -P ${{ inputs.project }} ${{ inputs.version && format('-v {0}', inputs.version) }}
rm -f chefDownload.sh

- name: Install Chef on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
. { iwr -useb https://chefdownload-commercial.chef.io/install.ps1?license_id=${{ inputs.license-id }} } | iex;
install -channel ${{ inputs.channel }} -project ${{ inputs.project }} ${{ inputs.version && format('-version {0}', inputs.version) }}

- name: Add Windows Chef Path
if: runner.os == 'Windows'
shell: pwsh
run: echo "${{ inputs.windows-path }}\bin" >> $env:GITHUB_PATH
56 changes: 56 additions & 0 deletions .github/actions/test-kitchen/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'Run Test Kitchen'
description: 'Runs Test Kitchen tests with configurable options'

inputs:
suite:
description: 'Test Kitchen suite to run'
required: false
os:
description: 'Operating system to test'
required: false
kitchen-yaml:
description: 'Kitchen YAML file to use'
required: false
default: 'kitchen.dokken.yml'
chef-version:
description: 'Chef version to use'
required: false
default: 'latest'
license-id:
description: 'Chef license ID'
required: true
kitchen-command:
description: 'Kitchen command to run (test, verify, etc)'
required: false
default: 'test'
channel:
description: 'Chef download channel'
required: false
default: 'stable'
project:
description: 'Chef project to download'
required: false
default: 'chef-workstation'
version:
description: 'Version of Chef product'
required: false
windows-path:
description: 'Windows installation path'
required: false
default: 'C:\opscode'

runs:
using: "composite"
steps:
- name: Install Chef
uses: ./.github/actions/chef-install
with:
version: ${{ inputs.chef-version }}
license-id: ${{ inputs.license-id }}

- name: Run Test Kitchen
shell: bash
run: kitchen ${{ inputs.kitchen-command }} ${{ inputs.suite }}${{ inputs.suite && inputs.os && '-' }}${{ inputs.os }}
env:
CHEF_LICENSE: ${{ inputs.license-id }}
KITCHEN_LOCAL_YAML: ${{ inputs.kitchen-yaml }}
23 changes: 23 additions & 0 deletions .github/actions/virtualbox-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Setup VirtualBox & Vagrant'
description: 'Installs VirtualBox and Vagrant on Ubuntu runners'

inputs:
virtualbox-version:
description: 'Version of VirtualBox to install'
required: false
default: '*'
vagrant-version:
description: 'Version of Vagrant to install'
required: false
default: 'latest'

runs:
using: "composite"
steps:
- name: Install VirtualBox & Vagrant
shell: bash
run: |
sudo apt update && sudo apt install virtualbox -y
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
135 changes: 67 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,86 +19,86 @@ jobs:

integration:
needs: lint-unit
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
os:
- "almalinux-8"
- "debian-11"
- "debian-12"
- "rockylinux-8"
- "rockylinux-9"
- "ubuntu-2004"
- "ubuntu-2204"
- "ubuntu-2404"
- almalinux-9
- almalinux-10
- amazonlinux-2023
- centos-stream-9
- centos-stream-10
- debian-11
- debian-12
- ubuntu-2204
- ubuntu-2404
suite:
- "installation-script-main"
- "installation-script-test"
- "installation-package"
- "installation-tarball"
- "install-and-stop"
exclude:
- os: debian-11
suite: installation-script-test
- os: debian-12
suite: installation-script-test
- os: almalinux-8
suite: installation-script-main
- os: almalinux-8
suite: installation-script-test
- os: rockylinux-8
suite: installation-script-main
- os: rockylinux-8
suite: installation-script-test
- os: rockylinux-9
suite: installation-script-main
- os: rockylinux-9
suite: installation-script-test
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Chef
uses: actionshub/[email protected]
- name: Dokken
uses: actionshub/[email protected]
env:
CHEF_VERSION: latest
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml

- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
kitchen-yaml: kitchen.dokken.yml
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

integration-amazonlinux:
installation-script:
needs: lint-unit
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
strategy:
matrix:
os:
- amazonlinux-2
suite:
- "installation-tarball"
- "install-and-stop"
- centos-stream-9
- centos-stream-10
- debian-11
- debian-12
- ubuntu-2204
- ubuntu-2404
suite: ["installation-script"]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
kitchen-yaml: kitchen.dokken.yml
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

swarm:
needs: lint-unit
runs-on: ubuntu-22.04
strategy:
matrix:
os: ["ubuntu-2204"]
suite: ["swarm"]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Chef
uses: actionshub/[email protected]
- name: Dokken
uses: actionshub/[email protected]
env:
CHEF_VERSION: latest
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml

- name: Setup VirtualBox & Vagrant
uses: ./.github/actions/virtualbox-setup

- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
kitchen-yaml: kitchen.yml
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

integration-smoke:
smoke:
needs: lint-unit
runs-on: ubuntu-latest
strategy:
Expand All @@ -108,31 +108,30 @@ jobs:
- "almalinux-9"
- "debian-11"
- "debian-12"
- "rockylinux-8"
- "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
uses: actionshub/[email protected]
env:
CHEF_VERSION: latest
CHEF_LICENSE: accept-no-persist

- name: Setup VirtualBox & Vagrant
uses: ./.github/actions/virtualbox-setup

- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
kitchen-yaml: kitchen.yml
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

final:
needs: [lint-unit, installation-script, integration, swarm, smoke]
runs-on: ubuntu-latest
steps:
- name: Complete
run: echo "All tests passed"
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby system
17 changes: 7 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

Standardise files with files in sous-chefs/repo-management
- Add Docker Swarm support
New resources:
- docker_swarm_init
- docker_swarm_join
- docker_swarm_service
- docker_swarm_token

## 11.8.4 - *2024-12-11*

- Update resources overview
- Update documentation for `docker_container` resource
- Update documentation for `docker_service` resource
- Update documentation for `docker_exec` resource
- Update resources overview
- Update documentation for `docker_installation_package` resource
- Update documentation for `docker_installation_script` resource
- Update documentation for `docker_installation_tarball` resource
- Update documentation for `docker_service_manager_execute` resource
- Update documentation for `docker_service_manager_systemd` resource
- Update documentation for `docker_volume_prune` resource
<<<<<<< HEAD

## 11.8.3 - *2024-12-11*

- Cleanup changelog
=======

>>>>>>> 5326caf (Update readme, and documentation folder)

## 11.8.2 - *2024-12-11*

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ Those recipes are found at `test/cookbooks/docker_test`.
- [docker_tag](documentation/docker_tag.md): image tagging operations
- [docker_volume](documentation/docker_volume.md): volume operations
- [docker_volume_prune](documentation/docker_volume_prune.md): remove unused docker volumes
- [docker_swarm_init](documentation/docker_swarm_init.md): initialize a new Docker swarm cluster
- [docker_swarm_join](documentation/docker_swarm_join.md): join a node to a Docker swarm cluster
- [docker_swarm_service](documentation/docker_swarm_service.md): manage Docker swarm services
- [docker_swarm_token](documentation/docker_swarm_token.md): manage Docker swarm tokens

## Getting Started

Expand Down
Loading
Loading