mirror of
				https://github.com/prometheus-operator/kube-prometheus.git
				synced 2025-11-04 01:51:01 +01:00 
			
		
		
		
	Merge pull request #1412 from dgrisonnet/add-changelogs
Add changelogs to automated version updates
This commit is contained in:
		
						commit
						50e926f0d4
					
				
							
								
								
									
										11
									
								
								.github/workflows/versions.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/versions.yaml
									
									
									
									
										vendored
									
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										64
									
								
								scripts/get-new-changelogs.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										64
									
								
								scripts/get-new-changelogs.sh
									
									
									
									
									
										Executable file
									
								
							@ -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
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user