-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease_args.sh
More file actions
35 lines (28 loc) · 1.69 KB
/
release_args.sh
File metadata and controls
35 lines (28 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
# this function will be sourced from release.sh and be called from release_functions.sh
update_versions_modify_files() {
newReleaseVersion="${1}"
valuesYAML=k8s/helm/values.yaml
componentPatchTplYAML=k8s/helm/component-patch-tpl.yaml
chartLockYAML=k8s/helm/Chart.lock
# Set new version for defaultConfig image
./.bin/yq -i ".defaultConfig.image.tag = \"${newReleaseVersion}\"" "${valuesYAML}"
./.bin/yq -i ".values.images.defaultConfig |= sub(\":(([0-9]+)\.([0-9]+)\.([0-9]+)((?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))|(?:\+[0-9A-Za-z-]+))?)\", \":${newReleaseVersion}\")" "${componentPatchTplYAML}"
# Extract component-operator chart
local componentOperatorVersion
componentOperatorVersion=$(./.bin/yq '.dependencies[] | select(.name=="k8s-component-operator").version' < ${chartLockYAML})
./.bin/yq -i ".k8s-component-operator.manager.image.tag = \"${componentOperatorVersion}\"" "${valuesYAML}"
./.bin/yq -i ".values.images.componentOperator |= sub(\":(([0-9]+)\.([0-9]+)\.([0-9]+)((?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))|(?:\+[0-9A-Za-z-]+))?)\", \":${componentOperatorVersion}\")" "${componentPatchTplYAML}"
# set kubectl-version in component-patch-tpl.yaml
local kubectlVersion
kubectlVersion=$(./.bin/yq '.cleanup.image.tag' < ${valuesYAML})
./.bin/yq -i ".values.images.kubectl |= sub(\":(([0-9]+)\.([0-9]+)\.([0-9]+)((?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))|(?:\+[0-9A-Za-z-]+))?)\", \":${kubectlVersion}\")" "${componentPatchTplYAML}"
}
update_versions_stage_modified_files() {
valuesYAML=k8s/helm/values.yaml
componentPatchTplYAML=k8s/helm/component-patch-tpl.yaml
git add "${valuesYAML}" "${componentPatchTplYAML}"
}