From 7a007491c82aaabccf0ed7aa40e922f224b380c4 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 5 Jan 2023 23:48:42 +0100 Subject: [PATCH] feat: restructure workflows and enable automated releases --- .github/renovate.json | 63 +++++----- .github/semantic.yml | 23 ++++ .github/settings.yml | 15 ++- .github/workflows/galaxy.yml | 4 +- .github/workflows/general.yml | 8 +- .github/workflows/readme.yml | 6 +- .github/workflows/release.yml | 28 +++++ .releaserc | 110 ++++++++++++++++++ README.md | 2 +- meta/main.yml | 10 +- molecule/{ubuntu => default}/converge.yml | 2 +- molecule/{ubuntu => default}/molecule.yml | 31 ++++- molecule/{ubuntu => default}/prepare.yml | 0 .../{ubuntu => default}/tests/test_default.py | 0 14 files changed, 244 insertions(+), 58 deletions(-) create mode 100644 .github/semantic.yml create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc rename molecule/{ubuntu => default}/converge.yml (70%) rename molecule/{ubuntu => default}/molecule.yml (58%) rename molecule/{ubuntu => default}/prepare.yml (100%) rename molecule/{ubuntu => default}/tests/test_default.py (100%) diff --git a/.github/renovate.json b/.github/renovate.json index 957a056..1f81c71 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -3,17 +3,20 @@ "config:base", ":semanticCommits", ":semanticCommitType(deps)", - ":automergePatch" + ":automergeMinor" ], - "regexManagers": [{ - "fileMatch": [ - "defaults/main.yml" - ], - "matchStrings": [ - "# renovate: datasource=(?\\S+) depName=(?\\S+)( versioning=(?.*?))?\\n.*?_version: (?.*)\\s" - ] - }], - "packageRules": [{ + "regexManagers": [ + { + "fileMatch": [ + "defaults/main.yml" + ], + "matchStrings": [ + "# renovate: datasource=(?\\S+) depName=(?\\S+)( versioning=(?.*?))?\\n.*?_version: (?.*)\\s" + ] + } + ], + "packageRules": [ + { "description": "Strip v prefix from versions", "groupName": "version prefix", "matchDatasources": [ @@ -23,49 +26,37 @@ "extractVersion": "^v(?.*)$" }, { - "description": "Semantic commits for major updates", - "groupName": "major updates", - "matchDatasources": [ - "github-releases", - "github-tags", - "galaxy-collection" - ], + "description": "Semantic commits for major versions", + "groupName": "major versions", "matchUpdateTypes": [ "major" ], - "semanticCommitScope": "major", + "semanticCommitType": "major", + "semanticCommitScope": "deps", "automerge": false }, { - "description": "Semantic commits for minor updates", - "groupName": "minor updates", - "matchDatasources": [ - "github-releases", - "github-tags", - "galaxy-collection" - ], + "description": "Semantic commits for minor versions", + "groupName": "minor versions", "matchUpdateTypes": [ "minor" ], - "semanticCommitScope": "minor", - "automerge": false + "semanticCommitType": "minor", + "semanticCommitScope": "deps", + "automerge": true }, { - "description": "Semantic commits for patch updates", - "groupName": "patch updates", - "matchDatasources": [ - "github-releases", - "github-tags", - "galaxy-collection" - ], + "description": "Semantic commits for patch versions", + "groupName": "patch versions", "matchUpdateTypes": [ "patch" ], - "semanticCommitScope": "patch", + "semanticCommitType": "patch", + "semanticCommitScope": "deps", "automerge": true } ], "labels": [ "renovate" ] -} \ No newline at end of file +} diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000..0724847 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,23 @@ +--- +commitsOnly: true +anyCommit: true +allowMergeCommits: true +allowRevertCommits: true + +types: + - feat + - fix + - docs + - style + - refactor + - perf + - test + - build + - ci + - chore + - revert + - major + - minor + - patch + +... diff --git a/.github/settings.yml b/.github/settings.yml index f6ab7a5..0172db2 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -6,7 +6,6 @@ repository: private: false has_issues: true - has_projects: false has_wiki: false has_downloads: false @@ -16,6 +15,12 @@ repository: allow_merge_commit: true allow_rebase_merge: true + allow_update_branch: true + allow_auto_merge: true + delete_branch_on_merge: true + enable_automated_security_fixes: true + enable_vulnerability_alerts: true + labels: - name: bug color: d73a4a @@ -54,12 +59,18 @@ labels: branches: - name: master protection: + required_pull_request_reviews: null required_status_checks: strict: true contexts: [] enforce_admins: false restrictions: + apps: + - renovate users: [] - teams: [] + teams: + - admins + - bots + - members ... diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 2b9ffde..7130378 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -1,7 +1,7 @@ --- name: galaxy -'on': +"on": push: branches: - master @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v3 - name: Galaxy upload - uses: robertdebock/galaxy-action@1.2.0 + uses: robertdebock/galaxy-action@1.2.1 with: galaxy_api_key: ${{ secrets.GALAXY_TOKEN }} diff --git a/.github/workflows/general.yml b/.github/workflows/general.yml index f41187a..a2e7861 100644 --- a/.github/workflows/general.yml +++ b/.github/workflows/general.yml @@ -1,7 +1,7 @@ --- name: general -'on': +"on": push: branches: - master @@ -28,18 +28,18 @@ jobs: matrix: scenario: - - ubuntu + - default steps: - name: Checkout source uses: actions/checkout@v3 - with: - path: ${{ github.repository }} - name: Molecule tests uses: gofrolist/molecule-action@v2 with: molecule_command: test molecule_args: --scenario-name ${{ matrix.scenario }} + env: + ANSIBLE_FORCE_COLOR: "1" ... diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 2ccca79..b7aaa15 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -1,7 +1,7 @@ --- name: readme -'on': +"on": push: branches: - master @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v3 + with: + token: ${{ secrets.BOT_ACCESS_TOKEN }} - name: Generate readme uses: actionhippie/ansible-doctor@v1 @@ -26,7 +28,7 @@ jobs: author_name: GitHub Actions author_email: github@webhippie.de add: README.md - message: automated readme update [skip ci] + message: "docs: automated readme update [skip ci]" push: true commit: --signoff diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7421eb9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +--- +name: release + +"on": + push: + branches: + - master + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout source + uses: actions/checkout@v3 + with: + token: ${{ secrets.BOT_ACCESS_TOKEN }} + + - name: Semantic release + uses: cycjimmy/semantic-release-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }} + with: + extra_plugins: | + conventional-changelog-conventionalcommits + +... diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..931e0d2 --- /dev/null +++ b/.releaserc @@ -0,0 +1,110 @@ +{ + "branches": [ + "master" + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": [ + { + "type": "major", + "release": "major" + }, + { + "type": "deps", + "scope": "major", + "release": "major" + }, + { + "type": "minor", + "release": "minor" + }, + { + "type": "deps", + "scope": "minor", + "release": "minor" + }, + { + "type": "patch", + "release": "patch" + }, + { + "type": "deps", + "scope": "patch", + "release": "patch" + }, + { + "type": "refactor", + "release": "minor" + }, + { + "scope": "docs", + "release": false + } + ] + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "presetConfig": { + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "major", + "section": "Features" + }, + { + "type": "minor", + "section": "Features" + }, + { + "type": "fix", + "section": "Bugfixes" + }, + { + "type": "patch", + "section": "Bugfixes" + }, + { + "type": "chore", + "hidden": true + }, + { + "type": "docs", + "hidden": true + }, + { + "type": "refactor", + "hidden": true + } + ] + } + } + ], + [ + "@semantic-release/changelog", + { + "changelogTitle": "# Changelog" + } + ], + [ + "@semantic-release/git", + { + "message": "chore: release ${nextRelease.version}" + } + ], + [ + "@semantic-release/github", + { + "addReleases": true + } + ] + ] +} diff --git a/README.md b/README.md index f5c599f..47929d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # rke -[![Source Code](https://img.shields.io/badge/github-source%20code-blue?logo=github&logoColor=white)](https://github.com/rolehippie/rke) [![Testing Build](https://github.com/rolehippie/rke/workflows/testing/badge.svg)](https://github.com/rolehippie/rke/actions?query=workflow%3Atesting) [![Readme Build](https://github.com/rolehippie/rke/workflows/readme/badge.svg)](https://github.com/rolehippie/rke/actions?query=workflow%3Areadme) [![Galaxy Build](https://github.com/rolehippie/rke/workflows/galaxy/badge.svg)](https://github.com/rolehippie/rke/actions?query=workflow%3Agalaxy) [![License: Apache-2.0](https://img.shields.io/github/license/rolehippie/rke)](https://github.com/rolehippie/rke/blob/master/LICENSE) +[![Source Code](https://img.shields.io/badge/github-source%20code-blue?logo=github&logoColor=white)](https://github.com/rolehippie/rke) [![General Workflow](https://github.com/rolehippie/rke/actions/workflows/general.yml/badge.svg)](https://github.com/rolehippie/rke/actions/workflows/general.yml) [![Readme Workflow](https://github.com/rolehippie/rke/actions/workflows/readme.yml/badge.svg)](https://github.com/rolehippie/rke/actions/workflows/readme.yml) [![Galaxy Workflow](https://github.com/rolehippie/rke/actions/workflows/galaxy.yml/badge.svg)](https://github.com/rolehippie/rke/actions/workflows/galaxy.yml) [![License: Apache-2.0](https://img.shields.io/github/license/rolehippie/rke)](https://github.com/rolehippie/rke/blob/master/LICENSE) [![Ansible Role](https://img.shields.io/ansible/role/51496)](https://galaxy.ansible.com/rolehippie/rke) Ansible role to deploy Kubernetes with Rancher Kubernetes Engine. diff --git a/meta/main.yml b/meta/main.yml index 6bbd45f..12c437b 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -3,10 +3,11 @@ # @meta author:value: [Thomas Boerger](https://github.com/tboerger) # @meta description: > # [![Source Code](https://img.shields.io/badge/github-source%20code-blue?logo=github&logoColor=white)](https://github.com/rolehippie/rke) -# [![Testing Build](https://github.com/rolehippie/rke/workflows/testing/badge.svg)](https://github.com/rolehippie/rke/actions?query=workflow%3Atesting) -# [![Readme Build](https://github.com/rolehippie/rke/workflows/readme/badge.svg)](https://github.com/rolehippie/rke/actions?query=workflow%3Areadme) -# [![Galaxy Build](https://github.com/rolehippie/rke/workflows/galaxy/badge.svg)](https://github.com/rolehippie/rke/actions?query=workflow%3Agalaxy) +# [![General Workflow](https://github.com/rolehippie/rke/actions/workflows/general.yml/badge.svg)](https://github.com/rolehippie/rke/actions/workflows/general.yml) +# [![Readme Workflow](https://github.com/rolehippie/rke/actions/workflows/readme.yml/badge.svg)](https://github.com/rolehippie/rke/actions/workflows/readme.yml) +# [![Galaxy Workflow](https://github.com/rolehippie/rke/actions/workflows/galaxy.yml/badge.svg)](https://github.com/rolehippie/rke/actions/workflows/galaxy.yml) # [![License: Apache-2.0](https://img.shields.io/github/license/rolehippie/rke)](https://github.com/rolehippie/rke/blob/master/LICENSE) +# [![Ansible Role](https://img.shields.io/ansible/role/51496)](https://galaxy.ansible.com/rolehippie/rke) # # Ansible role to deploy Kubernetes with Rancher Kubernetes Engine. # @@ -23,12 +24,13 @@ galaxy_info: author: Thomas Boerger description: Ansible role to deploy Kubernetes with Rancher Kubernetes Engine license: Apache-2.0 - min_ansible_version: 2.10 + min_ansible_version: "2.10" platforms: - name: Ubuntu versions: - bionic - focal + - jammy galaxy_tags: - rancher - kubernetes diff --git a/molecule/ubuntu/converge.yml b/molecule/default/converge.yml similarity index 70% rename from molecule/ubuntu/converge.yml rename to molecule/default/converge.yml index 1c2b85e..ea8f0d9 100644 --- a/molecule/ubuntu/converge.yml +++ b/molecule/default/converge.yml @@ -3,6 +3,6 @@ - name: Converge hosts: all roles: - - role: rke + - role: rolehippie.rke ... diff --git a/molecule/ubuntu/molecule.yml b/molecule/default/molecule.yml similarity index 58% rename from molecule/ubuntu/molecule.yml rename to molecule/default/molecule.yml index b440bc5..bed5ebf 100644 --- a/molecule/ubuntu/molecule.yml +++ b/molecule/default/molecule.yml @@ -11,30 +11,49 @@ driver: name: docker platforms: - - name: rke-ubuntu-20 - image: mpaivabarbosa/molecule-systemd-ubuntu:20.04 + - name: rke-ubuntu-22 + image: geerlingguy/docker-ubuntu2204-ansible:latest hostname: ubuntu privileged: True pre_build_image: True override_command: False + cgroupns_mode: host tmpfs: + - /tmp - /run + - /run/lock + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup + environment: + container: docker + - name: rke-ubuntu-20 + image: geerlingguy/docker-ubuntu2004-ansible:latest + hostname: ubuntu + privileged: True + pre_build_image: True + override_command: False + cgroupns_mode: host + tmpfs: - /tmp + - /run + - /run/lock volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup environment: container: docker - name: rke-ubuntu-18 - image: mpaivabarbosa/molecule-systemd-ubuntu:18.04 + image: geerlingguy/docker-ubuntu1804-ansible:latest hostname: ubuntu privileged: True pre_build_image: True override_command: False + cgroupns_mode: host tmpfs: - - /run - /tmp + - /run + - /run/lock volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup environment: container: docker diff --git a/molecule/ubuntu/prepare.yml b/molecule/default/prepare.yml similarity index 100% rename from molecule/ubuntu/prepare.yml rename to molecule/default/prepare.yml diff --git a/molecule/ubuntu/tests/test_default.py b/molecule/default/tests/test_default.py similarity index 100% rename from molecule/ubuntu/tests/test_default.py rename to molecule/default/tests/test_default.py