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 <[email protected]>
  • Loading branch information
Norman Ziegner committed Mar 18, 2024
1 parent 4ad48fa commit e37104b
Show file tree
Hide file tree
Showing 35 changed files with 726 additions and 562 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:

Check failure on line 1 in .ansible-lint

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[document-start]

Missing document start "---"
- '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"
13 changes: 13 additions & 0 deletions .github/workflows/import-galaxy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Test importing collection"

Check failure on line 1 in .github/workflows/import-galaxy-test.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[document-start]

Missing document start "---"
'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 }}"
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
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/[email protected]"
1 change: 1 addition & 0 deletions .github/workflows/prepare-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ runs:
- name: "Install dependencies via pipenv."
run: "pipenv install --dev"
shell: "bash"
working-directory: "ansible_collections/hifis/software_services"
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
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/[email protected]"
with:
api_key: "${{ secrets.galaxy_api_key }}"
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
---
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 +37,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 +57,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/[email protected]"
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"
document-start: "disable"
comments-indentation: "enable"
document-start: "enable"
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

Check failure on line 37 in .yamllint.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[truthy]

Truthy value should be one of \[false, true]
extra-required: [ ]
extra-allowed: [ ]
trailing-spaces: "disable"
truthy: "disable"
trailing-spaces: "enable"
truthy: "enable"
Loading

0 comments on commit e37104b

Please sign in to comment.