Skip to content

Commit ea53024

Browse files
ajanikowneunhoef
authored andcommitted
Prepare release scripts (#455)
1 parent 3b93ae8 commit ea53024

File tree

4 files changed

+50
-9
lines changed

4 files changed

+50
-9
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ endif
366366
patch-readme:
367367
$(ROOTDIR)/scripts/patch_readme.sh $(VERSION_MAJOR_MINOR_PATCH)
368368

369+
.PHONY: patch-chart
370+
patch-chart:
371+
$(ROOTDIR)/scripts/patch_chart.sh "$(VERSION_MAJOR_MINOR_PATCH)" "$(OPERATORIMAGE)"
372+
369373
.PHONY: changelog
370374
changelog:
371375
docker run --rm \

scripts/patch_chart.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Updates the versions in helm charts to reflect the current
4+
# version.
5+
6+
VERSION=$1
7+
IMAGE=$2
8+
9+
if [ -z $VERSION ]; then
10+
echo "Specify a version argument"
11+
exit 1
12+
fi
13+
14+
function replaceInFile {
15+
local EXPR=$1
16+
local FILE=$2
17+
case $(uname) in
18+
Darwin)
19+
sed -e "${EXPR}" -i "" ${FILE}
20+
;;
21+
*)
22+
sed -i --expression "${EXPR}" ${FILE}
23+
;;
24+
esac
25+
}
26+
27+
for f in kube-arangodb kube-arangodb-crd kube-arangodb-test; do
28+
replaceInFile "s@^version: .*\$@version: ${VERSION}@g" "chart/${f}/Chart.yaml"
29+
if [[ -f "chart/${f}/values.yaml" ]]; then
30+
replaceInFile "s@^ image: .*\$@ image: ${IMAGE}@g" "chart/${f}/values.yaml"
31+
fi
32+
done

scripts/patch_readme.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,5 @@ replaceInFile "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/ku
3030
replaceInFile "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-deployment-replication.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-deployment-replication.yaml@g" ${f}
3131
replaceInFile "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-storage.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-storage.yaml@g" ${f}
3232

33-
replaceInFile "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb-crd.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb-crd.tgz@g" ${f}
34-
replaceInFile "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb.tgz@g" ${f}
35-
replaceInFile "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb-storage.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb-storage.tgz@g" ${f}
33+
replaceInFile "s@https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb-crd\(-[0-9]+\.[0-9]+\.[0-9]+\)\?.tgz@https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb-crd-${VERSION}.tgz@g" ${f}
34+
replaceInFile "s@https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb\(-[0-9]+\.[0-9]+\.[0-9]+\)\?.tgz@https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb-${VERSION}.tgz@g" ${f}

tools/release/release.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ var (
4545
ghRepo string // Github repository name to create release in
4646
binFolder string // Folder containing binaries
4747

48-
binaries = map[string]string{
49-
"kube-arangodb.tgz": "charts/kube-arangodb.tgz",
50-
"kube-arangodb-storage.tgz": "charts/kube-arangodb-storage.tgz",
51-
"kube-arangodb-crd.tgz": "charts/kube-arangodb-crd.tgz",
52-
}
48+
binaries map[string]string
5349
)
5450

5551
func init() {
@@ -66,14 +62,24 @@ func main() {
6662
ensureGithubToken()
6763
checkCleanRepo()
6864
version := bumpVersion(releaseType)
65+
binaries = map[string]string{
66+
fmt.Sprintf("kube-arangodb-%s.tgz", version): fmt.Sprintf("charts/kube-arangodb-%s.tgz", version),
67+
fmt.Sprintf("kube-arangodb-crd-%s.tgz", version): fmt.Sprintf("charts/kube-arangodb-crd-%s.tgz", version),
68+
}
6969
make("clean", nil)
70+
make("patch-readme", nil)
71+
make("patch-chart", map[string]string{
72+
"ALLOWCHAOS": "false",
73+
"DOCKERNAMESPACE": "arangodb",
74+
"IMAGETAG": version,
75+
"MANIFESTSUFFIX": "-",
76+
})
7077
make("all", map[string]string{
7178
"ALLOWCHAOS": "false",
7279
"DOCKERNAMESPACE": "arangodb",
7380
"IMAGETAG": version,
7481
"MANIFESTSUFFIX": "-",
7582
})
76-
make("patch-readme", nil)
7783
make("build-ghrelease", nil)
7884
createSHA256Sums()
7985
gitCommitAll(fmt.Sprintf("Updated manifest to %s", version)) // Commit manifest

0 commit comments

Comments
 (0)