Get latest version by tag if no release exists (#2435)

* get latest version by tag if no release exisits

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>

* fix generate diff-check

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>

---------

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
This commit is contained in:
Raúl Garcia Sanchez 2024-05-30 10:43:18 +02:00 committed by GitHub
parent 1965e0d8bf
commit d3fa80ee96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View File

@ -30,7 +30,7 @@ The `prometheus-operator` defines a `Probe` resource type that can be used to de
* `_config.namespace`: the namespace where the various generated resources (`ConfigMap`, `Deployment`, `Service`, `ServiceAccount` and `ServiceMonitor`) will reside. This does not affect where you can place `Probe` objects; that is determined by the configuration of the `Prometheus` resource. This option is shared with other `kube-prometheus` components; defaults to `default`.
* `_config.imageRepos.blackboxExporter`: the name of the blackbox exporter image to deploy. Defaults to `quay.io/prometheus/blackbox-exporter`.
* `_config.versions.blackboxExporter`: the tag of the blackbox exporter image to deploy. Defaults to the version `kube-prometheus` was tested with.
* `_config.imageRepos.configmapReloader`: the name of the ConfigMap reloader image to deploy. Defaults to `jimmidyson/configmap-reload`.
* `_config.imageRepos.configmapReloader`: the name of the ConfigMap reloader image to deploy. Defaults to `ghcr.io/jimmidyson/configmap-reload`.
* `_config.versions.configmapReloader`: the tag of the ConfigMap reloader image to deploy. Defaults to the version `kube-prometheus` was tested with.
* `_config.resources.blackbox-exporter.requests`: the requested resources; this is used for each container. Defaults to `10m` CPU and `20Mi` RAM. See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for details.
* `_config.resources.blackbox-exporter.limits`: the resource limits; this is used for each container. Defaults to `20m` CPU and `40Mi` RAM. See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for details.

View File

@ -47,7 +47,7 @@ local utils = import './lib/utils.libsonnet';
prometheusOperator: 'quay.io/prometheus-operator/prometheus-operator:v' + $.values.common.versions.prometheusOperator,
prometheusOperatorReloader: 'quay.io/prometheus-operator/prometheus-config-reloader:v' + $.values.common.versions.prometheusOperator,
kubeRbacProxy: 'quay.io/brancz/kube-rbac-proxy:v' + $.values.common.versions.kubeRbacProxy,
configmapReload: 'jimmidyson/configmap-reload:v' + $.values.common.versions.configmapReload,
configmapReload: 'ghcr.io/jimmidyson/configmap-reload:v' + $.values.common.versions.configmapReload,
},
},
alertmanager: {

View File

@ -58,7 +58,7 @@ spec:
- args:
- --webhook-url=http://localhost:19115/-/reload
- --volume-dir=/etc/blackbox_exporter/
image: jimmidyson/configmap-reload:v0.5.0
image: ghcr.io/jimmidyson/configmap-reload:v0.5.0
name: module-configmap-reloader
resources:
limits:

View File

@ -5,7 +5,12 @@ set -euo pipefail
# Get component version from GitHub API
get_latest_version() {
echo >&2 "Checking release version for ${1}"
curl --retry 5 --silent --fail -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${1}/releases/latest" | jq '.tag_name' | tr -d '"v'
v=$(curl --retry 5 --silent --fail -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${1}/releases/latest" | jq '.tag_name' | tr -d '"v')
if [ "${v}" == "" ]; then
# Get latest tag if no release is generated
v=$(curl --retry 5 --silent --fail -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${1}/tags" | jq '.[].name' | head -n1 | tr -d '"v')
fi
echo "$v"
}
# Get component version from version file