Skip to content

Commit

Permalink
Prepare release scripts (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow authored and neunhoef committed Sep 25, 2019
1 parent 3b93ae8 commit ea53024
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ endif
patch-readme:
$(ROOTDIR)/scripts/patch_readme.sh $(VERSION_MAJOR_MINOR_PATCH)

.PHONY: patch-chart
patch-chart:
$(ROOTDIR)/scripts/patch_chart.sh "$(VERSION_MAJOR_MINOR_PATCH)" "$(OPERATORIMAGE)"

.PHONY: changelog
changelog:
docker run --rm \
Expand Down
32 changes: 32 additions & 0 deletions scripts/patch_chart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Updates the versions in helm charts to reflect the current
# version.

VERSION=$1
IMAGE=$2

if [ -z $VERSION ]; then
echo "Specify a version argument"
exit 1
fi

function replaceInFile {
local EXPR=$1
local FILE=$2
case $(uname) in
Darwin)
sed -e "${EXPR}" -i "" ${FILE}
;;
*)
sed -i --expression "${EXPR}" ${FILE}
;;
esac
}

for f in kube-arangodb kube-arangodb-crd kube-arangodb-test; do
replaceInFile "s@^version: .*\$@version: ${VERSION}@g" "chart/${f}/Chart.yaml"
if [[ -f "chart/${f}/values.yaml" ]]; then
replaceInFile "s@^ image: .*\$@ image: ${IMAGE}@g" "chart/${f}/values.yaml"
fi
done
5 changes: 2 additions & 3 deletions scripts/patch_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ replaceInFile "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/ku
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}
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}

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}
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}
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}
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}
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}
18 changes: 12 additions & 6 deletions tools/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ var (
ghRepo string // Github repository name to create release in
binFolder string // Folder containing binaries

binaries = map[string]string{
"kube-arangodb.tgz": "charts/kube-arangodb.tgz",
"kube-arangodb-storage.tgz": "charts/kube-arangodb-storage.tgz",
"kube-arangodb-crd.tgz": "charts/kube-arangodb-crd.tgz",
}
binaries map[string]string
)

func init() {
Expand All @@ -66,14 +62,24 @@ func main() {
ensureGithubToken()
checkCleanRepo()
version := bumpVersion(releaseType)
binaries = map[string]string{
fmt.Sprintf("kube-arangodb-%s.tgz", version): fmt.Sprintf("charts/kube-arangodb-%s.tgz", version),
fmt.Sprintf("kube-arangodb-crd-%s.tgz", version): fmt.Sprintf("charts/kube-arangodb-crd-%s.tgz", version),
}
make("clean", nil)
make("patch-readme", nil)
make("patch-chart", map[string]string{
"ALLOWCHAOS": "false",
"DOCKERNAMESPACE": "arangodb",
"IMAGETAG": version,
"MANIFESTSUFFIX": "-",
})
make("all", map[string]string{
"ALLOWCHAOS": "false",
"DOCKERNAMESPACE": "arangodb",
"IMAGETAG": version,
"MANIFESTSUFFIX": "-",
})
make("patch-readme", nil)
make("build-ghrelease", nil)
createSHA256Sums()
gitCommitAll(fmt.Sprintf("Updated manifest to %s", version)) // Commit manifest
Expand Down

0 comments on commit ea53024

Please sign in to comment.