Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-prometheus
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
prometheus-operator
kube-prometheus
Commits
16c05d16
Unverified
Commit
16c05d16
authored
4 years ago
by
paulfantom
Browse files
Options
Downloads
Patches
Plain Diff
jsonnet,scripts: better version updater
parent
ebd4b28b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jsonnet/kube-prometheus/versions.json
+1
-0
1 addition, 0 deletions
jsonnet/kube-prometheus/versions.json
scripts/generate-versions.sh
+35
-7
35 additions, 7 deletions
scripts/generate-versions.sh
with
36 additions
and
7 deletions
jsonnet/kube-prometheus/versions.json
+
1
−
0
View file @
16c05d16
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
"alertmanager"
:
"0.21.0"
,
"alertmanager"
:
"0.21.0"
,
"blackboxExporter"
:
"0.18.0"
,
"blackboxExporter"
:
"0.18.0"
,
"grafana"
:
"7.4.3"
,
"grafana"
:
"7.4.3"
,
"kubeStateMetrics"
:
"1.9.8"
,
"nodeExporter"
:
"1.1.1"
,
"nodeExporter"
:
"1.1.1"
,
"prometheus"
:
"2.25.0"
,
"prometheus"
:
"2.25.0"
,
"prometheusAdapter"
:
"0.8.3"
,
"prometheusAdapter"
:
"0.8.3"
,
...
...
This diff is collapsed.
Click to expand it.
scripts/generate-versions.sh
+
35
−
7
View file @
16c05d16
...
@@ -2,11 +2,38 @@
...
@@ -2,11 +2,38 @@
set
-euo
pipefail
set
-euo
pipefail
# Get component version from GitHub API
get_latest_version
()
{
get_latest_version
()
{
echo
>
&2
"Checking release version for
${
1
}
"
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'
curl
--retry
5
--silent
--fail
-H
"Authorization: token
$GITHUB_TOKEN
"
"https://api.github.com/repos/
${
1
}
/releases/latest"
| jq
'.tag_name'
|
tr
-d
'"v'
}
}
# Get component version from version file
get_current_version
()
{
echo
>
&2
"Reading currently used version of
${
1
}
"
jq
-r
".
${
1
}
"
"
$VERSION_FILE
"
}
# Get version from online source and filter out unstable releases. In case of unstable release use what is set in version file
get_version
()
{
component
=
"
${
1
}
"
v
=
"
$(
get_latest_version
"
${
component
}
"
)
"
# Advanced AI heurestics to filter out common patterns suggesting new version is not stable /s
if
[[
"
$v
"
==
*
"alpha"
*
]]
||
[[
"
$v
"
==
*
"beta"
*
]]
||
[[
"
$v
"
==
*
"rc"
*
]]
||
[[
"
$v
"
==
*
"helm"
*
]]
;
then
component
=
"
$(
convert_to_camel_case
"
$(
echo
"
${
component
}
"
|
sed
's/^.*\///'
)
"
)
"
v
=
"
$(
get_current_version
"
${
component
}
"
)
"
fi
echo
"
$v
"
}
convert_to_camel_case
()
{
echo
"
${
1
}
"
|
sed
-E
's/[ _-]([a-z])/\U\1/gi;s/^([A-Z])/\l\1/'
}
# File is used to read current versions
VERSION_FILE
=
"jsonnet/kube-prometheus/versions.json"
# token can be passed as `GITHUB_TOKEN` variable or passed as first argument
# token can be passed as `GITHUB_TOKEN` variable or passed as first argument
GITHUB_TOKEN
=
${
GITHUB_TOKEN
:-${
1
}}
GITHUB_TOKEN
=
${
GITHUB_TOKEN
:-${
1
}}
...
@@ -17,12 +44,13 @@ fi
...
@@ -17,12 +44,13 @@ fi
cat
<<-
EOF
cat
<<-
EOF
{
{
"alertmanager": "
$(
get_latest_version
"prometheus/alertmanager"
)
",
"alertmanager": "
$(
get_version
"prometheus/alertmanager"
)
",
"blackboxExporter": "
$(
get_latest_version
"prometheus/blackbox_exporter"
)
",
"blackboxExporter": "
$(
get_version
"prometheus/blackbox_exporter"
)
",
"grafana": "
$(
get_latest_version
"grafana/grafana"
)
",
"grafana": "
$(
get_version
"grafana/grafana"
)
",
"nodeExporter": "
$(
get_latest_version
"prometheus/node_exporter"
)
",
"kubeStateMetrics": "
$(
get_version
"kubernetes/kube-state-metrics"
)
",
"prometheus": "
$(
get_latest_version
"prometheus/prometheus"
)
",
"nodeExporter": "
$(
get_version
"prometheus/node_exporter"
)
",
"prometheusAdapter": "
$(
get_latest_version
"kubernetes-sigs/prometheus-adapter"
)
",
"prometheus": "
$(
get_version
"prometheus/prometheus"
)
",
"prometheusOperator": "
$(
get_latest_version
"prometheus-operator/prometheus-operator"
)
"
"prometheusAdapter": "
$(
get_version
"kubernetes-sigs/prometheus-adapter"
)
",
"prometheusOperator": "
$(
get_version
"prometheus-operator/prometheus-operator"
)
"
}
}
EOF
EOF
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment