Skip to content

Commit

Permalink
Migrate standalone role to a collection
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
  • Loading branch information
Norman Ziegner committed Mar 18, 2024
1 parent 4ad48fa commit ccea30a
Show file tree
Hide file tree
Showing 35 changed files with 732 additions and 563 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- 'var-naming[no-role-prefix]'
7 changes: 7 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
unattended_upgrades:
- changed-files:
- any-glob-to-any-file:
- "roles/unattended_upgrades/**"
- "molecule/unattended_upgrades/**"
- ".github/workflows/unattended_upgrades.yml"
15 changes: 15 additions & 0 deletions .github/workflows/import-galaxy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: "Test importing collection"

on:
pull_request:
push:
branches:
- "main"

jobs:
import-galaxy:
permissions:
contents: "read"
name: "Import collection with Galaxy importer"
uses: "ansible-community/github-action-test-galaxy-import/.github/workflows/test-galaxy-import.yml@main"
19 changes: 19 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: "Pull Request Labeler"

on:
pull_request_target:
types:
- "labeled"
- "unlabeled"
- "opened"
- "edited"
- "synchronize"

jobs:
labeler:
runs-on: "ubuntu-22.04"
steps:
- uses: "actions/labeler@v5"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: "Ansible Lint"

on:
pull_request:
paths:
- 'roles/**'
push:
branches:
- "main"
tags:
- "v*.*.*"
paths:
- 'roles/**'

env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1

jobs:

ansible-lint:
name: "Ansible Lint"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out the codebase."
uses: "actions/checkout@v4"

- name: "Lint code."
uses: "ansible/ansible-lint@v24.2.1"
3 changes: 2 additions & 1 deletion .github/workflows/prepare-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
shell: "bash"

- name: "Set up Python 3."
uses: "actions/setup-python@v4"
uses: "actions/setup-python@v5"
id: "setup-python"
with:
python-version: "3.10"
Expand All @@ -18,3 +18,4 @@ runs:
- name: "Install dependencies via pipenv."
run: "pipenv install --dev"
shell: "bash"
working-directory: "ansible_collections/hifis/software_services"
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: "Release new version on Ansible Galaxy"

on:
release:
types:
- "released"

jobs:

release:
name: "Release new version on Ansible Galaxy"
runs-on: "ubuntu-22.04"
steps:
- name: "checkout"
uses: "actions/checkout@v4"

- name: "Deploy the collection"
uses: "artis3n/ansible_galaxy_collection@v2.10.1"
with:
api_key: "${{ secrets.galaxy_api_key }}"
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
---
name: "CI"
name: "hifis.unattended_upgrades"

on:
pull_request:
push:
branches:
- "main"
tags:
- "v*.*.*"
paths:
- '.github/workflows/unattended_upgrades.yml'
- 'roles/unattended_upgrades/**'
- 'molecule/unattended_upgrades/**'
- 'Pipfile'
- 'Pipfile.lock'
schedule:
- cron: '0 0 * * *'

env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1

jobs:

lint:
name: "Lint"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out the codebase."
uses: "actions/checkout@v4"

- name: "Prepare the job environment."
uses: "./.github/workflows/prepare-action"

- name: "Lint code."
run: |
pipenv run yamllint --strict --format colored .
pipenv run ansible-lint -v --force-color --offline
test:
name: "Run Molecule tests."
runs-on: "ubuntu-22.04"
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
strategy:
fail-fast: false
matrix:
Expand All @@ -47,9 +38,11 @@ jobs:
steps:
- name: "Check out the codebase."
uses: "actions/checkout@v4"
with:
path: "ansible_collections/hifis/software_services"

- name: "Prepare the job environment."
uses: "./.github/workflows/prepare-action"
uses: "./ansible_collections/hifis/software_services/.github/workflows/prepare-action"

- name: "Install modern podman"
run: |
Expand All @@ -65,20 +58,7 @@ jobs:
sudo apt-get -qq -y install podman
- name: "Run Molecule tests."
run: "pipenv run molecule test"
run: "pipenv run molecule test -s unattended_upgrades"
env:
MOLECULE_IMAGE: "${{ matrix.image }}"

release:
name: "Release new version on Ansible Galaxy"
runs-on: "ubuntu-22.04"
if: "startsWith(github.ref, 'refs/tags/v')"
needs: ["lint", "test"]
steps:
- name: "checkout"
uses: "actions/checkout@v4"
- name: "galaxy"
uses: "robertdebock/galaxy-action@1.2.1"
with:
galaxy_api_key: "${{ secrets.galaxy_api_key }}"
git_branch: "main"
working-directory: "ansible_collections/hifis/software_services"
2 changes: 1 addition & 1 deletion .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
user=hifis-net
project=ansible-role-unattended-upgrades
since-tag=v1.12.2
since-tag=v3.3.0
12 changes: 6 additions & 6 deletions .yamllint → .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ rules:
max-spaces-after: -1
level: "error"
comments: "disable"
comments-indentation: "disable"
comments-indentation: "enable"
document-start: "disable"
empty-lines:
max: 3
level: "error"
hyphens:
level: "error"
indentation: "disable"
indentation: "enable"
key-duplicates: "enable"
line-length: "disable"
new-line-at-end-of-file: "disable"
new-line-at-end-of-file: "enable"
new-lines:
type: "unix"
quoted-strings:
quote-type: "any"
required: True
required: true
extra-required: [ ]
extra-allowed: [ ]
trailing-spaces: "disable"
truthy: "disable"
trailing-spaces: "enable"
truthy: "enable"
Loading

0 comments on commit ccea30a

Please sign in to comment.