feat: add Artifacthub annotation 'artifacthub.io/changes'
All checks were successful
commitlint / check-and-test (pull_request) Successful in 6s
check-and-test / check-and-test (pull_request) Successful in 50s

The following PR add the annotation 'artifacthub.io/changes'. For each semantic commit will be the annotation extended. Further information can be found in the documentation of [Artifacthub.io](https://artifacthub.io/docs/topics/annotations/helm/#supported-annotations). The CI has been adapted. The binary jq as well as yq in >= v4.0 is required. Otherwise will not be concatenated the YAML file correctly via the yq expression, because the `loadstr()` expression is not available in lower versions. Additionally the relation between the semantic commit and the Artifacthub.io change log type should be clarified. The current relationshiop can be adapted if needed. Furthermore, yq will be installed as part of the CI steps. It would be great if yq is also available as deb package in >=v4.0. This would reduce the boiler plate to install yq and maintain the version via renovate. Regarding the renovate expression. In my environment works this expression, but I don't know if it also works in this gitea/renovate instance.
This commit is contained in:
2025-06-04 20:02:07 +02:00
parent 0d532363eb
commit 2ecde05582

114
.gitea/scripts/add-annotations.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/bin/bash
set -e
CHART_FILE="Chart.yaml"
if [ ! -f "${CHART_FILE}" ]; then
echo "ERROR: ${CHART_FILE} not found!" 1>&2
exit 1
fi
DEFAULT_NEW_TAG="$(git tag --sort=-version:refname | head -n 1)"
DEFAULT_OLD_TAG="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)"
if [ -z "${1}" ]; then
read -p "Enter start tag [${DEFAULT_OLD_TAG}]: " OLD_TAG
if [ -z "${OLD_TAG}" ]; then
OLD_TAG="${DEFAULT_OLD_TAG}"
fi
while [ -z "$(git tag --list "${OLD_TAG}")" ]; do
echo "ERROR: Tag '${OLD_TAG}' not found!" 1>&2
read -p "Enter start tag [${DEFAULT_OLD_TAG}]: " OLD_TAG
if [ -z "${OLD_TAG}" ]; then
OLD_TAG="${DEFAULT_OLD_TAG}"
fi
done
else
OLD_TAG=${1}
if [ -z "$(git tag --list "${OLD_TAG}")" ]; then
echo "ERROR: Tag '${OLD_TAG}' not found!" 1>&2
exit 1
fi
fi
if [ -z "${2}" ]; then
read -p "Enter end tag [${DEFAULT_NEW_TAG}]: " NEW_TAG
if [ -z "${NEW_TAG}" ]; then
NEW_TAG="${DEFAULT_NEW_TAG}"
fi
while [ -z "$(git tag --list "${NEW_TAG}")" ]; do
echo "ERROR: Tag '${NEW_TAG}' not found!" 1>&2
read -p "Enter end tag [${DEFAULT_NEW_TAG}]: " NEW_TAG
if [ -z "${NEW_TAG}" ]; then
NEW_TAG="${DEFAULT_NEW_TAG}"
fi
done
else
NEW_TAG=${2}
if [ -z "$(git tag --list "${NEW_TAG}")" ]; then
echo "ERROR: Tag '${NEW_TAG}' not found!" 1>&2
exit 1
fi
fi
CHANGE_LOG_YAML=$(mktemp)
echo "[]" > "${CHANGE_LOG_YAML}"
function map_type_to_kind() {
case "${1}" in
feat)
echo "added"
;;
fix)
echo "fixed"
;;
chore|style|test|ci|docs|refac)
echo "changed"
;;
revert)
echo "removed"
;;
sec)
echo "security"
;;
*)
echo "skip"
;;
esac
}
COMMIT_TITLES="$(git log --pretty=format:"%s" "${OLD_TAG}..${NEW_TAG}")"
echo "INFO: Generate change log entries from ${OLD_TAG} until ${NEW_TAG}"
while IFS= read -r line; do
if [[ "${line}" =~ ^([a-zA-Z]+)(\([^\)]+\))?\:\ (.+)$ ]]; then
TYPE="${BASH_REMATCH[1]}"
KIND=$(map_type_to_kind "${TYPE}")
if [ "${KIND}" == "skip" ]; then
continue
fi
DESC="${BASH_REMATCH[3]}"
echo "- ${KIND}: ${DESC}"
jq --arg kind changed --arg description "$DESC" '. += [ $ARGS.named ]' < ${CHANGE_LOG_YAML} > ${CHANGE_LOG_YAML}.new
mv ${CHANGE_LOG_YAML}.new ${CHANGE_LOG_YAML}
fi
done <<< "${COMMIT_TITLES}"
if [ -s "${CHANGE_LOG_YAML}" ]; then
yq --inplace --input-format json --output-format yml "${CHANGE_LOG_YAML}"
yq --no-colors --inplace ".annotations.\"artifacthub.io/changes\" |= loadstr(\"${CHANGE_LOG_YAML}\") | sort_keys(.)" "${CHART_FILE}"
else
echo "ERROR: Changelog file is empty: ${CHANGE_LOG_YAML}" 1>&2
exit 1
fi
rm "${CHANGE_LOG_YAML}"

View File

@@ -32,6 +32,8 @@ jobs:
apt update -y
apt install -y python3 python3-pip apt-transport-https docker-ce-cli
pip install awscli --break-system-packages
# jq
apt install -y jq
- name: Import GPG key
id: import_gpg
@@ -41,6 +43,26 @@ jobs:
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0
- name: Add Artifacthub.io annotations
env:
YQ_VERSION: v4.45.4 # renovate: datasource=github-releases depName=mikefarah/yq
run: |
# determine operating system
OS=$(uname | tr '[:upper:]' '[:lower:]')
# determine architecture
ARCH="$(uname -m)"
case "${ARCH}" in
x86_64) ARCH=amd64;;
esac
# Download yq
curl --silent --fail --location https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${OS}_${ARCH}.tar.gz --output /dev/stdout | tar --extract --gzip && mv yq_${OS}_${ARCH} /usr/bin/yq
NEW_TAG="$(git tag --sort=-version:refname | head -n 1)"
OLD_TAG="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)"
.gitea/scripts/add-annotations.sh "${OLD_TAG}" "${NEW_TAG}"
# Using helm gpg plugin as 'helm package --sign' has issues with gpg2: https://github.com/helm/helm/issues/2843
- name: package chart
run: |

View File

@@ -1,37 +1,60 @@
annotations:
artifacthub.io/changes: |
- kind: changed
description: fix release workflow
- kind: changed
description: ingress unittests
- kind: changed
description: refine v12 update notes
- kind: changed
description: remove ingressClassName (not in use yet)
- kind: changed
description: execute releases via `git-sv` (#865)
- kind: changed
description: 'update dependency go-gitea/gitea to v1.23.8 (#867) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: 'update dependency helm-unittest/helm-unittest to v0.8.2 (#866) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: update postgresql-ha docker tag to v16 (#864)
- kind: changed
description: update workflow dependencies (minor & patch) (#862)
- kind: changed
description: refine CODEOWNERS to skip request triggers for CI yaml changes
- kind: changed
description: 'update subcharts (minor & patch) (#863) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: 'update subcharts (minor & patch) (#853) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: migrate renovate config (#861)
- kind: changed
description: update docker.io/thegeeklab/git-sv docker tag to v2 (#860)
- kind: changed
description: 'update docker.io/thegeeklab/git-sv docker tag to v1.0.14 (#858) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: 'update unittests/bash/bats digest to fed179f (#857) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: 'update dependency go-gitea/gitea to v1.23.7 (#852) Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>'
- kind: changed
description: check actions is not configured (#849)
- kind: changed
description: update dependency helm-unittest/helm-unittest to v0.8.1 (#851)
- kind: changed
description: 'remove obsolete gitea.act_runner.local_root_url (#850) Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de>'
- kind: changed
description: make it configurable of the initContainers volume mount path for scripts (#848)
- kind: changed
description: reverting use of TPL in "gitea.inline_configuration" (#846)
- kind: changed
description: group bats framework dependencies (#844)
- kind: changed
description: adding dry support to gitea additional config from envs parameter (#840)
- kind: changed
description: update workflow dependencies (minor & patch) (#827)
- kind: changed
description: update subcharts (minor & patch) (#816)
apiVersion: v2
name: gitea
description: Gitea Helm chart for Kubernetes
type: application
version: 0.0.0
# renovate datasource=github-releases depName=go-gitea/gitea extractVersion=^v(?<version>.*)$
appVersion: 1.23.8
icon: https://gitea.com/assets/img/logo.svg
keywords:
- git
- issue tracker
- code review
- wiki
- gitea
- gogs
sources:
- https://gitea.com/gitea/helm-gitea
- https://github.com/go-gitea/gitea
- https://docker.gitea.com/gitea
maintainers:
- name: Charlie Drage
email: charlie@charliedrage.com
- name: Gitea Authors
email: maintainers@gitea.io
- name: Konrad Lother
email: konrad.lother@novum-rgi.de
- name: Lucas Hahn
email: lucas.hahn@novum-rgi.de
- name: Steven Kriegler
email: sk.bunsenbrenner@gmail.com
- name: Patrick Schratz
email: patrick.schratz@gmail.com
dependencies:
# https://github.com/bitnami/charts/blob/main/bitnami/postgresql
- name: postgresql
@@ -53,3 +76,32 @@ dependencies:
repository: oci://registry-1.docker.io/bitnamicharts
version: 3.0.9
condition: valkey.enabled
description: Gitea Helm chart for Kubernetes
icon: https://gitea.com/assets/img/logo.svg
keywords:
- git
- issue tracker
- code review
- wiki
- gitea
- gogs
maintainers:
- name: Charlie Drage
email: charlie@charliedrage.com
- name: Gitea Authors
email: maintainers@gitea.io
- name: Konrad Lother
email: konrad.lother@novum-rgi.de
- name: Lucas Hahn
email: lucas.hahn@novum-rgi.de
- name: Steven Kriegler
email: sk.bunsenbrenner@gmail.com
- name: Patrick Schratz
email: patrick.schratz@gmail.com
name: gitea
sources:
- https://gitea.com/gitea/helm-gitea
- https://github.com/go-gitea/gitea
- https://docker.gitea.com/gitea
type: application
version: 0.0.0