diff --git a/.github/workflows/versions.yaml b/.github/workflows/versions.yaml index 0230d4414b2c34e34b453b6b38a1d64364581c2f..654ac3352cee81d89572fe7ca6fdb26a8b30fe03 100644 --- a/.github/workflows/versions.yaml +++ b/.github/workflows/versions.yaml @@ -23,11 +23,15 @@ jobs: with: go-version: 1.16 - name: Upgrade versions + id: versions run: | export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} # Write to temporary file to make update atomic scripts/generate-versions.sh > /tmp/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' - name: Update jsonnet dependencies run: | @@ -49,7 +53,12 @@ jobs: 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 diff --git a/scripts/get-new-changelogs.sh b/scripts/get-new-changelogs.sh new file mode 100755 index 0000000000000000000000000000000000000000..a37adee7898e708a2bbb85a7d0efd8bb5f0fab3d --- /dev/null +++ b/scripts/get-new-changelogs.sh @@ -0,0 +1,64 @@ +#!/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