Skip to content

Commit

Permalink
Get latest version by tag if no release exists (#2435)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
rgarcia89 committed May 30, 2024
1 parent 1965e0d commit d3fa80e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/blackbox-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion jsonnet/kube-prometheus/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion manifests/blackboxExporter-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion scripts/generate-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3fa80e

Please sign in to comment.