UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 3c06c3e2 authored by Joe Foster's avatar Joe Foster :speech_balloon:
Browse files

Merge branch '36-add-postupgradecommand-for-upgrading-alloy-wrapper-chart-dependencies' into 'main'

Resolve "Add postUpgradeCommand for upgrading Alloy wrapper chart dependencies"

Closes #36

See merge request !50
parents 266250e5 0bbe155e
No related branches found
Tags 3.2.4-bb.0
1 merge request!50Resolve "Add postUpgradeCommand for upgrading Alloy wrapper chart dependencies"
Pipeline #3807437 passed
......@@ -27,7 +27,8 @@ module.exports = {
"^bump-changelog '- {{{replace 'registry1\.dso\.mil\/' '' depName}}} updated from {{{currentVersion}}} to {{{newVersion}}}'$",
"^bump-changelog '- {{{replace 'registry1\.dso\.mil\/' '' depName}}} updated from {{{replace 'v' '' currentVersion}}} to {{{replace 'v' '' newVersion}}}'$",
"^upgrade-gitlabrunner '{{{newValue}}}'$",
"^map-chart-yaml-appversion$"
"^map-chart-yaml-appversion$",
"^update-alloy-subcharts$"
],
packageRules: [
{
......
#!/usr/bin/env bash
echo "update-alloy-subcharts begin"
helm repo add "repo_grafana" "https://grafana.github.io/helm-charts"
helm repo update
# Pull k8s-monitoring repo and unpack in temp directory, deleting at end of script
helm pull repo_grafana/k8s-monitoring --untar --untardir temp
LOCAL_CHART_YAML="./chart/Chart.yaml"
LOCAL_VALUES_YAML="./chart/values.yaml"
LOCAL_CHANGELOG_FILE="./CHANGELOG.md"
ALLOY_CHART_YAML="./temp/k8s-monitoring/charts/alloy/Chart.yaml"
ALLOY_CHART_VERSION=$(helm dep list temp/k8s-monitoring | grep alloy | uniq | awk '{print $2}')
echo "Alloy Version: $ALLOY_CHART_VERSION"
# Alloy Version: 0.10.0
CONFIG_RELOADER_IMG_TAG=$(helm show values repo_grafana/alloy | yq '.configReloader.image.tag')
ALLOY_APP_VERSION=$(helm search repo repo_grafana/alloy --version $ALLOY_CHART_VERSION | tail -n 1 | awk '{print $3}')
# Update Chart
sed -i "s/\(image: registry1.dso.mil\/ironbank\/opensource\/grafana\/alloy:\).*$/\1${ALLOY_APP_VERSION}/" $LOCAL_CHART_YAML
sed -i "s/\(image: registry1.dso.mil\/ironbank\/opensource\/jimmidyson\/configmap-reload:\).*$/\1${CONFIG_RELOADER_IMG_TAG}/" $LOCAL_CHART_YAML
# Update Values
sed -i -E "/alloy:/,/tag:/s/(tag: ).*/\1\"${ALLOY_APP_VERSION}\"/" $LOCAL_VALUES_YAML
sed -i -E "/configReloader:/,/tag:/s/(tag: ).*/\1\"${CONFIG_RELOADER_IMG_TAG}\"/" $LOCAL_VALUES_YAML
# Bump Wrapper Chart App Version
echo "update-alloy-subcharts appversion begin"
K8S_MONITORING_VERSION=$(helm search repo grafana/k8s-monitoring | tail -n 1 | awk '{print $3}')
echo "k8s monitoring version: $K8S_MONITORING_VERSION"
sed -i -E "/^appVersion:/s/(appVersion: ).*/\1${K8S_MONITORING_VERSION}/" $LOCAL_CHART_YAML
echo "update-alloy-subcharts appversion complete"
# Delete ./temp directory that is created by helm pull
rm -rf temp
echo "update-alloy-subcharts complete"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment