updates #302
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: updates | |
on: | |
schedule: | |
- cron: '42 0 * * *' # every day at 00:42 | |
jobs: | |
kube-state-metrics: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Install extra tooling | |
run: | | |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0 | |
- name: Check for image updates | |
run: | | |
export PATH=$PATH:$(go env GOPATH)/bin | |
image_ref=$(yq '.image.repository' charts/kube-state-metrics/values.yaml) | |
latest_version=$(skopeo list-tags docker://$image_ref | jq -r '.Tags | map(. | select(. | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+$"))) | sort | last'); export latest_version | |
next_chart_version=$(yq '.version' charts/kube-state-metrics/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_chart_version | |
branch=feature/upgrade-kube-state-metrics-$latest_version | |
if git ls-remote | grep "$branch"; then | |
echo Checkout existing branch $branch | |
git checkout $branch | |
else | |
echo Create new branch $branch | |
git checkout -b $branch | |
fi | |
current_version=$(yq '.appVersion' charts/kube-state-metrics/Chart.yaml) | |
echo "Comparing $current_version == $latest_version" | |
if [ "$current_version" == "$latest_version" ]; then | |
echo "New image version $latest_version already present on branch" | |
exit 0 | |
fi | |
yq '.appVersion=strenv(latest_version)' -i charts/kube-state-metrics/Chart.yaml | |
echo Creating PR - if necressary | |
git update-index -q --really-refresh | |
if [ -n "$(git diff-index --name-only HEAD --)" ]; then | |
yq '.version=strenv(next_chart_version)' -i charts/kube-state-metrics/Chart.yaml | |
helm-docs | |
git config user.email "support@netic.dk" | |
git config user.name "Upgrade Automation" | |
git add charts/kube-state-metrics | |
git commit -m "feat(kube-state-metrics): Upgrade kube-state-metrics image to $latest_version" | |
git push --set-upstream origin $branch | |
gh pr create --base main --title "feat(kube-state-metrics): Upgrade kube-state-metrics image to $latest_version" --body "Upgrade kube-state-metrics image version to $latest_version" | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} | |
prometheus-node-exporter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Install extra tooling | |
run: | | |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0 | |
- name: Add dependency chart repos | |
run: ./.github/scripts/helm-repos.sh | |
shell: bash | |
- name: Check for image updates | |
run: | | |
export PATH=$PATH:$(go env GOPATH)/bin | |
image_ref=$(yq '.image.repository' charts/prometheus-node-exporter/values.yaml) | |
latest_version=$(skopeo list-tags docker://$image_ref | jq -r '.Tags | map(. | select(. | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+$"))) | sort | last'); export latest_version | |
next_chart_version=$(yq '.version' charts/prometheus-node-exporter/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_chart_version | |
next_oaas_version=$(yq '.version' charts/oaas-observability/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_oaas_version | |
branch=feature/upgrade-prometheus-node-exporter-$latest_version | |
if git ls-remote | grep "$branch"; then | |
echo Checkout existing branch $branch | |
git checkout $branch | |
else | |
echo Create new branch $branch | |
git checkout -b $branch | |
fi | |
current_version=$(yq '.appVersion' charts/prometheus-node-exporter/Chart.yaml) | |
echo "Comparing $current_version == $latest_version" | |
if [ "$current_version" == "$latest_version" ]; then | |
echo "New image version $latest_version already present on branch" | |
exit 0 | |
fi | |
yq '.appVersion=strenv(latest_version)' -i charts/prometheus-node-exporter/Chart.yaml | |
echo Creating PR - if necressary | |
git update-index -q --really-refresh | |
if [ -n "$(git diff-index --name-only HEAD --)" ]; then | |
yq '.version=strenv(next_chart_version)' -i charts/prometheus-node-exporter/Chart.yaml | |
yq '.version=strenv(next_oaas_version)' -i charts/oaas-observability/Chart.yaml | |
helm dependency update charts/oaas-observability | |
helm-docs | |
git config user.email "support@netic.dk" | |
git config user.name "Upgrade Automation" | |
git add charts/prometheus-node-exporter | |
git add charts/oaas-observability | |
git commit -m "feat(prometheus-node-exporter): Upgrade prometheus-node-exporter image to $latest_version" | |
git push --set-upstream origin $branch | |
gh pr create --base main --title "feat(prometheus-node-exporter): Upgrade prometheus-node-exporter image to $latest_version" --body "Upgrade prometheus-node-exporter image version to $latest_version" | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} | |
oaas-observability: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Install extra tooling | |
run: | | |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0 | |
- name: Add dependency chart repos | |
run: ./.github/scripts/helm-repos.sh | |
shell: bash | |
- name: Check for chart updates | |
run: | | |
export PATH=$PATH:$(go env GOPATH)/bin | |
next_oaas_version=$(yq '.version' charts/oaas-observability/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_oaas_version | |
branch=feature/upgrade-oaas-observability-$next_oaas_version | |
if git ls-remote | grep "$branch"; then | |
echo Checkout existing branch $branch | |
git checkout $branch | |
else | |
echo Create new branch $branch | |
git checkout -b $branch | |
fi | |
grafana_version=$(helm search repo grafana -ojson | jq -r '.[0].version'); export grafana_version | |
yq '.dependencies.[] |= (select(.name=="grafana") | .version = strenv(grafana_version))' -i charts/oaas-observability/Chart.yaml | |
promtail_version=$(helm search repo promtail -ojson | jq -r '.[0].version'); export promtail_version | |
yq '.dependencies.[] |= (select(.name=="promtail") | .version = strenv(promtail_version))' -i charts/oaas-observability/Chart.yaml | |
kube_state_metrics_version=$(helm search repo kube-state-metrics -ojson | jq -r '.[0].version'); export kube_state_metrics_version | |
yq '.dependencies.[] |= (select(.name=="kube-state-metrics") | .version = strenv(kube_state_metrics_version))' -i charts/oaas-observability/Chart.yaml | |
opentelemetry_version=$(helm search repo opentelemetry-operator -ojson | jq -r '.[0].version'); export opentelemetry_version | |
yq '.dependencies.[] |= (select(.name=="opentelemetry-operator") | .version = strenv(opentelemetry_version))' -i charts/oaas-observability/Chart.yaml | |
echo Creating PR - if necressary | |
git update-index -q --really-refresh | |
if [ -n "$(git diff-index --name-only HEAD --)" ]; then | |
yq '.version=strenv(next_oaas_version)' -i charts/oaas-observability/Chart.yaml | |
helm dependency update charts/oaas-observability | |
helm-docs | |
git config user.email "support@netic.dk" | |
git config user.name "Upgrade Automation" | |
git add charts/oaas-observability | |
git commit -m "feat(oaas-observability): Upgrade oaas-observability dependencies" | |
git push --set-upstream origin $branch | |
gh pr create --base main --title "feat(oaas-observability): Upgrade oaas-observability dependencies" --body "Upgrade oaas-observability dependencies" | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} |