Skip to content

Commit

Permalink
YOLO
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Webb <dan.webb@damacus.io>
  • Loading branch information
damacus committed Dec 17, 2024
1 parent d45d850 commit df12aea
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 98 deletions.
43 changes: 43 additions & 0 deletions .github/actions/test-kitchen/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Run Test Kitchen'
description: 'Runs Test Kitchen tests with configurable options'

inputs:
suite:
description: 'Test Kitchen suite to run'
required: true
os:
description: 'Operating system to test'
required: true
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'
chef-license:
description: 'Chef license acceptance'
required: false
default: 'accept-no-persist'
kitchen-command:
description: 'Kitchen command to run (test, verify, etc)'
required: false
default: 'test'

runs:
using: "composite"
steps:
- name: Install Chef
uses: actionshub/chef-install@3.0.1
with:
version: ${{ inputs.chef-version }}

- name: Run Test Kitchen
shell: bash
run:
kitchen ${{ inputs.kitchen-command }} ${{ inputs.suite }}-${{ inputs.os }}
env:
CHEF_LICENSE: ${{ inputs.chef-license }}
KITCHEN_LOCAL_YAML: ${{ inputs.kitchen-yaml }}
KITCHEN_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
119 changes: 37 additions & 82 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,104 +19,64 @@ jobs:

integration:
needs: lint-unit
runs-on: ubuntu-latest
runs-on: ubuntu-2204
strategy:
matrix:
os:
- "almalinux-8"
- "debian-11"
- "debian-12"
- "rockylinux-8"
- "rockylinux-9"
- "ubuntu-2004"
- "ubuntu-2204"
- "ubuntu-2404"
- almalinux-9

Check failure on line 26 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / lint-unit / runner / yamllint

26:9 [indentation] wrong indentation: expected 10 but found 8
- almalinux-10
- amazonlinux-2023
- centos-stream-9
- centos-stream-10
- debian-11
- debian-12
- fedora-latest
- opensuse-leap-15
- oraclelinux-8
- oraclelinux-9
- 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/chef-install@3.0.1
- name: Dokken
uses: actionshub/test-kitchen@3.0.0
env:
CHEF_VERSION: latest
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
kitchen-yaml: kitchen.dokken.yml
chef-version: latest
chef-license: accept-no-persist

integration-amazonlinux:
integration-swarm:
needs: lint-unit
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
strategy:
matrix:
os:
- amazonlinux-2
suite:
- "installation-tarball"
- "install-and-stop"
os: ["ubuntu-2204"]
suite: ["swarm"]
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Chef
uses: actionshub/chef-install@3.0.1
- name: Dokken
uses: actionshub/test-kitchen@3.0.0
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: Run Kitchen Tests
uses: ./.github/actions/test-kitchen
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}

integration-swarm:
needs: lint-unit
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Chef
uses: actionshub/chef-install@3.0.1
- name: Install Docker
uses: docker/setup-docker-action@v4
- name: Test Kitchen
uses: actionshub/test-kitchen@3.0.0
env:
CHEF_VERSION: latest
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.exec.yml
with:
suite: swarm
os: ubuntu-latest
kitchen-yaml: kitchen.yml
chef-version: latest
chef-license: accept-no-persist

integration-smoke:
needs: lint-unit
Expand All @@ -136,23 +96,18 @@ jobs:
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: Setup VirtualBox & Vagrant
uses: ./.github/workflows/virtualbox-setup.yml
- name: Install Chef
uses: actionshub/chef-install@3.0.1
- name: Dokken
uses: actionshub/test-kitchen@3.0.0
env:
CHEF_VERSION: latest
CHEF_LICENSE: accept-no-persist
- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
kitchen-yaml: kitchen.yml
chef-version: latest
chef-license: accept-no-persist
15 changes: 0 additions & 15 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,6 @@ platforms:
image: dokken/oraclelinux-9
pid_one_command: /usr/lib/systemd/systemd

- name: rockylinux-8
driver:
image: dokken/rockylinux-8
pid_one_command: /usr/lib/systemd/systemd

- name: rockylinux-9
driver:
image: dokken/rockylinux-9
pid_one_command: /usr/lib/systemd/systemd

- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd

- name: ubuntu-22.04
driver:
image: dokken/ubuntu-22.04
Expand Down
27 changes: 27 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,30 @@ suites:
- name: smoke
run_list:
- recipe[docker_test::smoke]

###############################
# docker_swarm resources
###############################
- name: swarm
includes:
- ubuntu-22.04
provisioner:
enforce_idempotency: false
multiple_converge: 1
attributes:
docker:
version: '20.10.11'
swarm:
init:
advertise_addr: '127.0.0.1'
listen_addr: '0.0.0.0:2377'
rotate_token: true
service:
name: 'web'
image: 'nginx:latest'
publish: ['80:80']
replicas: 2
run_list:
- recipe[docker_test::swarm_default]
- recipe[docker_test::swarm_init]
- recipe[docker_test::swarm_service]
2 changes: 1 addition & 1 deletion resources/swarm_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

load_current_value do
if swarm_manager?
cmd = Mixlib::ShellOut.new("docker swarm join-token -q #{token_type}")
cmd = Mixlib::ShellOut.new("docker swarm join-token -q #{new_resource.token_type}")
cmd.run_command
current_value_does_not_exist! if cmd.error?
else
Expand Down

0 comments on commit df12aea

Please sign in to comment.