Skip to content
Snippets Groups Projects
Commit aab8d8eb authored by Damien Grisonnet's avatar Damien Grisonnet
Browse files

ci: add changelogs to automated version updates


Add the links to the changelogs of the freshly updated components to the
automated PR that does the update. This allow verifying that we are not
missing any important changes before merging the update. This happened
recently with node-exporter 1.2 which changed some flag names that we
took 3 months to update.

Signed-off-by: default avatarDamien Grisonnet <dgrisonn@redhat.com>
parent fc136a84
No related branches found
No related tags found
No related merge requests found
...@@ -23,11 +23,15 @@ jobs: ...@@ -23,11 +23,15 @@ jobs:
with: with:
go-version: 1.16 go-version: 1.16
- name: Upgrade versions - name: Upgrade versions
id: versions
run: | run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
# Write to temporary file to make update atomic # Write to temporary file to make update atomic
scripts/generate-versions.sh > /tmp/versions.json scripts/generate-versions.sh > /tmp/versions.json
mv /tmp/versions.json jsonnet/kube-prometheus/versions.json mv /tmp/versions.json jsonnet/kube-prometheus/versions.json
# Get the links to the changelogs of the updated versions and make them
# available to the reviewers
echo ::set-output name=new_changelogs::$(scripts/get-new-changelogs.sh)
if: matrix.branch == 'main' if: matrix.branch == 'main'
- name: Update jsonnet dependencies - name: Update jsonnet dependencies
run: | run: |
...@@ -49,7 +53,12 @@ jobs: ...@@ -49,7 +53,12 @@ jobs:
This is an automated version and jsonnet dependencies update performed from CI. This is an automated version and jsonnet dependencies update performed from CI.
Configuration of the workflow is located in `.github/workflows/versions.yaml` Please review the following changelogs to make sure that we don't miss any important
changes before merging this PR.
${{ steps.versions.outputs.new_changelogs }}
Configuration of the workflow is located in `.github/workflows/versions.yaml`.
## Type of change ## Type of change
......
#!/bin/bash
set -euo pipefail
# Get the freshly updated components versions.
# Should be only used after running ./scripts/generate-versions and before
# committing any changes.
get_updated_versions() {
# Get only the newly updated versions from the versions file.
echo "$(git diff -U0 -- "${VERSION_FILE}" | grep '^[+]' | grep -Ev '^(--- a/|\+\+\+ b/)' | tr -d '",:+' | awk -F'"' '{print $1}')"
}
# Returns github changelog url based on a given repository url and tag.
get_changelog_url() {
echo "https://github.com/${1}/releases/tag/v${2}"
}
# Gets all the new changelogs from the updated components version.
get_changelog_urls() {
while IFS= read -r updated_version; do
read -r component version <<< "${updated_version}"
case "${component}" in
alertmanager)
get_changelog_url "prometheus/alertmanager" "${version}"
;;
blackboxExporter)
get_changelog_url "prometheus/blackbox_exporter" "${version}"
;;
grafana)
get_changelog_url "grafana/grafana" "${version}"
;;
kubeStateMetrics)
get_changelog_url "kubernetes/kube-state-metrics" "${version}"
;;
nodeExporter)
get_changelog_url "prometheus/node_exporter" "${version}"
;;
prometheus)
get_changelog_url "prometheus/prometheus" "${version}"
;;
prometheusAdapter)
get_changelog_url "kubernetes-sigs/prometheus-adapter" "${version}"
;;
prometheusOperator)
get_changelog_url "prometheus-operator/prometheus-operator" "${version}"
;;
kubeRbacProxy)
get_changelog_url "brancz/kube-rbac-proxy" "${version}"
;;
configmapReload)
get_changelog_url "jimmidyson/configmap-reload" "${version}"
;;
*)
echo "Unknown component ${component} updated"
exit 1
;;
esac
done <<< "$(get_updated_versions)"
}
# File is used to read current versions
VERSION_FILE="$(pwd)/jsonnet/kube-prometheus/versions.json"
get_changelog_urls
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment