Skip to content

Commit 0b141fb

Browse files
committed
Added helm support to release
1 parent faa4199 commit 0b141fb

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ it is intended to be.
3434
| Minikube | 1.10 | >= 3.3.13 | Runs | Not intended |
3535
| Docker for Mac Edge | 1.10 | >= 3.3.13 | Runs | Not intended |
3636

37-
## Installation of latest release
37+
## Installation of latest release using Helm
38+
39+
```bash
40+
# The following will install the operator for `ArangoDeployment` &
41+
# `ArangoDeplomentReplication` resources.
42+
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.2.2/kube-arangodb.tgz
43+
# To use `ArangoLocalStorage`, also run
44+
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.2.2/kube-arangodb-storage.tgz
45+
```
46+
47+
## Installation of latest release using Kubectl
3848

3949
```bash
4050
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/0.2.2/manifests/crd.yaml

scripts/patch_readme.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-aran
1515
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-deployment.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-deployment.yaml@g" -i "" $f
1616
sed -e "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" -i "" $f
1717
sed -e "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" -i "" $f
18+
19+
sed -e "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" -i "" $f
20+
sed -e "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" -i "" $f

tools/release/release.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
package main
2424

2525
import (
26+
"crypto/sha256"
27+
"encoding/hex"
2628
"flag"
2729
"fmt"
2830
"io/ioutil"
@@ -41,6 +43,12 @@ var (
4143
ghRelease string // Full path of github-release tool
4244
ghUser string // Github account name to create release in
4345
ghRepo string // Github repository name to create release in
46+
binFolder string // Folder containing binaries
47+
48+
binaries = map[string]string{
49+
"kube-arangodb.tgz": "charts/kube-arangodb.tgz",
50+
"kube-arangodb-storage.tgz": "charts/kube-arangodb-storage.tgz",
51+
}
4452
)
4553

4654
func init() {
@@ -49,6 +57,7 @@ func init() {
4957
flag.StringVar(&ghRelease, "github-release", ".gobuild/bin/github-release", "Full path of github-release tool")
5058
flag.StringVar(&ghUser, "github-user", "arangodb", "Github account name to create release in")
5159
flag.StringVar(&ghRepo, "github-repo", "kube-arangodb", "Github repository name to create release in")
60+
flag.StringVar(&binFolder, "bin-folder", "./bin", "Folder containing binaries")
5261
}
5362

5463
func main() {
@@ -65,6 +74,7 @@ func main() {
6574
})
6675
make("patch-readme", nil)
6776
make("build-ghrelease", nil)
77+
createSHA256Sums()
6878
gitCommitAll(fmt.Sprintf("Updated manifest to %s", version)) // Commit manifest
6979
gitTag(version)
7080
make("changelog", nil)
@@ -155,6 +165,23 @@ func gitTag(version string) {
155165
}
156166
}
157167

168+
func createSHA256Sums() {
169+
sums := []string{}
170+
for name, p := range binaries {
171+
blob, err := ioutil.ReadFile(filepath.Join(binFolder, p))
172+
if err != nil {
173+
log.Fatalf("Failed to read binary '%s': %#v\n", name, err)
174+
}
175+
bytes := sha256.Sum256(blob)
176+
sha := hex.EncodeToString(bytes[:])
177+
sums = append(sums, sha+" "+name)
178+
}
179+
sumsPath := filepath.Join(binFolder, "SHA256SUMS")
180+
if err := ioutil.WriteFile(sumsPath, []byte(strings.Join(sums, "\n")+"\n"), 0644); err != nil {
181+
log.Fatalf("Failed to write '%s': %#v\n", sumsPath, err)
182+
}
183+
}
184+
158185
func githubCreateRelease(version string) {
159186
// Create draft release
160187
args := []string{
@@ -167,6 +194,26 @@ func githubCreateRelease(version string) {
167194
if err := run(ghRelease, args, nil); err != nil {
168195
log.Fatalf("Failed to create github release: %v\n", err)
169196
}
197+
// Upload binaries
198+
assets := map[string]string{
199+
"SHA256SUMS": "SHA256SUMS",
200+
}
201+
for k, v := range binaries {
202+
assets[k] = v
203+
}
204+
for name, file := range assets {
205+
args := []string{
206+
"upload",
207+
"--user", ghUser,
208+
"--repo", ghRepo,
209+
"--tag", version,
210+
"--name", name,
211+
"--file", filepath.Join(binFolder, file),
212+
}
213+
if err := run(ghRelease, args, nil); err != nil {
214+
log.Fatalf("Failed to upload asset '%s': %v\n", name, err)
215+
}
216+
}
170217
// Finalize release
171218
args = []string{
172219
"edit",

0 commit comments

Comments
 (0)