From 494a1c518ba577117634fbd5529b0b78e7bddc39 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Fri, 25 Mar 2022 11:07:51 +0100 Subject: [PATCH 1/5] docs: add changelogs --- CHANGELOG.rst | 24 ++++++++++++++++++++++++ changelogs/changelog.yaml | 16 ++++++++++++++++ changelogs/config.yaml | 32 ++++++++++++++++++++++++++++++++ changelogs/fragments/.git-keep | 0 docs/CHANGELOG.rst | 1 + galaxy.yml | 7 ++++--- 6 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.rst create mode 100644 changelogs/changelog.yaml create mode 100644 changelogs/config.yaml create mode 100644 changelogs/fragments/.git-keep create mode 120000 docs/CHANGELOG.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..ada0d32 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,24 @@ +============================================ +middleware_automation.keycloak Release Notes +============================================ + +.. contents:: Topics + +This changelog describes changes after version 0.2.6 + +v1.0.1 +====== + +Release Summary +--------------- + +Documentation fixes to reflect the correct module names. + + +v1.0.0 +====== + +Release Summary +--------------- + +This is the first stable release of the ``middleware_automation.keycloak`` collection. diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 0000000..fac497d --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,16 @@ +ancestor: 0.2.6 +releases: + 1.0.0: + changes: + release_summary: | + This is the first stable release of the ``middleware_automation.keycloak`` collection. + release_date: '2022-03-04' + 1.0.1: + changes: + minor_changes: + - apply latest cumulative patch of RH-SSO automatically when new parameter ``keycloak_rhsso_apply_patches`` is ``true`` + bugfixes: + - clustered installs now perform database initialization on first node to avoid locking issues + release_summary: | + Minor enhancements, bug and documentation fixes. + release_date: '2022-03-11' \ No newline at end of file diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..374ae65 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,32 @@ +--- +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: middleware_automation.keycloak +trivial_section_name: trivial +use_fqcn: true diff --git a/changelogs/fragments/.git-keep b/changelogs/fragments/.git-keep new file mode 100644 index 0000000..e69de29 diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst new file mode 120000 index 0000000..e22698b --- /dev/null +++ b/docs/CHANGELOG.rst @@ -0,0 +1 @@ +../CHANGELOG.rst \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 32007fb..195f396 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: middleware_automation name: keycloak -version: "1.0.1" +version: "1.0.2" readme: README.md authors: - Romain Pelisse @@ -22,12 +22,13 @@ tags: - authentication dependencies: "middleware_automation.redhat_csp_download": ">=1.2.1" - "middleware_automation.wildfly": ">=0.0.6" + "middleware_automation.wildfly": ">=1.0.0" repository: https://github.com/ansible-middleware/keycloak documentation: https://ansible-middleware.github.io/keycloak homepage: https://github.com/ansible-middleware/keycloak issues: https://github.com/ansible-middleware/keycloak/issues build_ignore: - molecule - - docs - .github + - '*.tar.gz' + - '*.zip' \ No newline at end of file From fc780599b0c644e2fcd192a4bc1017dd0f40083c Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Fri, 25 Mar 2022 11:21:55 +0100 Subject: [PATCH 2/5] add antsibull generated changelog --- .gitignore | 1 + CHANGELOG.rst | 15 +++++++++++++-- changelogs/fragments/.git-keep | 0 changelogs/fragments/.gitignore | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) delete mode 100644 changelogs/fragments/.git-keep create mode 100644 changelogs/fragments/.gitignore diff --git a/.gitignore b/.gitignore index f10cc78..ef79fe9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ docs/_build/ .pytest_cache/ .mypy_cache/ *.retry +changelogs/.plugin-cache.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ada0d32..24f1090 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ middleware_automation.keycloak Release Notes .. contents:: Topics -This changelog describes changes after version 0.2.6 +This changelog describes changes after version 0.2.6. v1.0.1 ====== @@ -12,9 +12,19 @@ v1.0.1 Release Summary --------------- -Documentation fixes to reflect the correct module names. +Minor enhancements, bug and documentation fixes. +Minor Changes +------------- + +- apply latest cumulative patch of RH-SSO automatically when new parameter ``keycloak_rhsso_apply_patches`` is ``true`` + +Bugfixes +-------- + +- clustered installs now perform database initialization on first node to avoid locking issues + v1.0.0 ====== @@ -22,3 +32,4 @@ Release Summary --------------- This is the first stable release of the ``middleware_automation.keycloak`` collection. + diff --git a/changelogs/fragments/.git-keep b/changelogs/fragments/.git-keep deleted file mode 100644 index e69de29..0000000 diff --git a/changelogs/fragments/.gitignore b/changelogs/fragments/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/changelogs/fragments/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore From 63f31fe258b1fec48a086079cf8a2915e4f1d9af Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Fri, 25 Mar 2022 18:22:55 +0100 Subject: [PATCH 3/5] Add gitignore to ansible-test sanity excludes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a72e5c..7c96b1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: mkdir -p /home/runner/.ansible/collections/ansible_collections - name: Run sanity tests - run: ansible-test sanity --docker -v --color --python ${{ matrix.python_version }} + run: ansible-test sanity --docker -v --color --python ${{ matrix.python_version }} --exclude changelogs/fragments/.gitignore working-directory: ./ansible_collections/middleware_automation/keycloak - name: Run molecule test From 609147729447acef7e33e5c55d2b2d8bf38793ba Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Wed, 30 Mar 2022 17:31:15 +0200 Subject: [PATCH 4/5] ci: generate changelog fragments from PR messages --- .github/workflows/docs.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c55a637..cb37a49 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,6 +6,7 @@ on: - main tags: - "[0-9]+.[0-9]+.[0-9]+" + pull_request: env: COLORTERM: 'yes' @@ -40,6 +41,7 @@ jobs: python -m pip install --upgrade pip pip install -r ansible_collections/middleware_automation/keycloak/docs/requirements.txt pip install -r ansible_collections/middleware_automation/keycloak/requirements.txt + sudo apt install -y sed hub - name: Create default collection path run: | @@ -53,6 +55,27 @@ jobs: for role_readme in roles/*/README.md; do ln -f -s ../../$role_readme ./docs/roles/$(basename $(dirname $role_readme)).md; echo " * :doc:\`$(basename $(dirname $role_readme))\`" >> ./docs/roles/index.rst; done working-directory: ansible_collections/middleware_automation/keycloak + - name: Scan PR merges from latest tag + run: | + TYPES=("minor_changes" "major_changes" "bugfixes" "deprecated_features" "removed_features") + TAG=$(git describe --abbrev=0 --tags) + PRS=($(comm -12 <(git log --oneline ${TAG}.. --format="tformat:%H" | sort ) <(hub pr list -s all -f '%sm%n' --color=never | sort ))) + IFS=$'\n' FRAGMENTS=($(hub pr list -s all -f '%sm~%I~%L~%t~%n' --color=never| grep -P "$(echo "^(${PRS[@]})" | tr ' ' '|')")) + for frag in "${FRAGMENTS[@]}"; do + PR=$(echo $frag|cut -d~ -f2) + type="$(echo $frag|cut -d~ -f3)" + msg="$(echo $frag|cut -d~ -f4|sed 's/`/``/g')" + if [[ "${TYPES[*]}" =~ "${type}" ]]; then + echo -e "$type:\n - >\n $msg \`#${PR}\`" \ + > changelogs/fragments/${PR}.yaml + fi + done + antsibull-changelog lint -vvv + antsibull-changelog generate + working-directory: ansible_collections/middleware_automation/keycloak + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run sphinx run: | sphinx-build -M html . _build -v From 5a45d1f4f888a392e339827e9fee4926dba8701e Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Thu, 31 Mar 2022 14:56:41 +0200 Subject: [PATCH 5/5] add prerelease to docs wf, generate on release wf --- .github/workflows/docs.yml | 5 ++- .github/workflows/release.yml | 73 +++++++++++++++++++++++++++++------ 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cb37a49..55eaada 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,7 +6,6 @@ on: - main tags: - "[0-9]+.[0-9]+.[0-9]+" - pull_request: env: COLORTERM: 'yes' @@ -71,7 +70,9 @@ jobs: fi done antsibull-changelog lint -vvv - antsibull-changelog generate + if [[ "${{github.ref}}" == "refs/heads/main" ]]; then + antsibull-changelog release --version "prerelease-$(grep version galaxy.yml | awk -F'"' '{ print $2 }')" + fi working-directory: ansible_collections/middleware_automation/keycloak env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aafcfb1..30e480f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,30 +1,86 @@ --- name: Release collection on: - push: - tags: - - "[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: jobs: release: runs-on: ubuntu-latest + if: github.repository == 'ansible-middleware/keycloak' + permissions: + actions: write + checks: write + contents: write + deployments: write + packages: write + pages: write steps: - name: Checkout code uses: actions/checkout@v2 + - name: Fetch tags + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: Set up Python uses: actions/setup-python@v1 with: python-version: "3.x" - - name: Get Tag Version + - name: Get current version id: get_version - run: echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/} + run: echo "::set-output name=TAG_VERSION::$(grep version galaxy.yml | awk -F'"' '{ print $2 }')" + - name: Check if tag exists + id: check_tag + run: echo "::set-output name=TAG_EXISTS::$(git tag | grep ${{ steps.get_version.outputs.TAG_VERSION }})" + - name: Fail if tag exists + if: ${{ steps.get_version.outputs.TAG_VERSION == steps.check_tag.outputs.TAG_EXISTS }} + uses: actions/github-script@v3 + with: + script: | + core.setFailed('Release tag already exists') - name: Install dependencies run: | python -m pip install --upgrade pip pip install ansible-core + sudo apt install -y sed hub - name: Build collection run: | ansible-galaxy collection build . + - name: Scan PR merges from latest tag + run: | + TYPES=("minor_changes" "major_changes" "bugfixes" "deprecated_features" "removed_features") + TAG=$(git describe --abbrev=0 --tags) + PRS=($(comm -12 <(git log --oneline ${TAG}.. --format="tformat:%H" | sort ) <(hub pr list -s all -f '%sm%n' --color=never | sort ))) + IFS=$'\n' FRAGMENTS=($(hub pr list -s all -f '%sm~%I~%L~%t~%n' --color=never| grep -P "$(echo "^(${PRS[@]})" | tr ' ' '|')")) + for frag in "${FRAGMENTS[@]}"; do + PR=$(echo $frag|cut -d~ -f2) + type="$(echo $frag|cut -d~ -f3)" + msg="$(echo $frag|cut -d~ -f4|sed 's/`/``/g')" + if [[ "${TYPES[*]}" =~ "${type}" ]]; then + echo -e "$type:\n - >\n $msg \`#${PR}\`" \ + > changelogs/fragments/${PR}.yaml + fi + done + antsibull-changelog lint -vvv + antsibull-changelog generate + antsibull-changelog release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Commit changelogs + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add CHANGELOG.rst changelogs/changelog.yaml + git commit -m "Update changelog for release ${{ steps.get_version.outputs.TAG_VERSION }}" || true + git push origin + - name: Publish collection + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY + - name: Create release tag + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git tag -a ${{ steps.get_version.outputs.TAG_VERSION }}" -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true + git push origin --tags - name: Publish Release uses: softprops/action-gh-release@v1 env: @@ -32,11 +88,6 @@ jobs: with: files: "*.tar.gz" body: "Release v${{ steps.get_version.outputs.TAG_VERSION }}" - - name: Publish collection - env: - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} - run: | - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY dispatch: needs: release strategy: @@ -49,5 +100,5 @@ jobs: with: token: ${{ secrets.TRIGGERING_PAT }} repository: ${{ matrix.repo }} - event-type: "Dependency released - Keycloak" + event-type: "Dependency released - Keycloak v${{ steps.get_version.outputs.TAG_VERSION }}" client-payload: '{ "github": ${{toJson(github)}} }'