-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcut-new-release
executable file
·60 lines (53 loc) · 1.6 KB
/
cut-new-release
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
set -e
function die {
echo "$1"
exit 1
}
OPTS=$(getopt -o '' -a --longoptions 'url:,version:,dry-run' -n "$0" -- "$@")
set -- $OPTS
while true; do
case "$1" in
--version )
version=$(echo "${2:1:-1}" | tr '[:upper:]' '[:lower:]') # remove '' and lowercase
if [[ "$version" == *"rc"* ]]; then
release="$version"
else
release="${version::-2}" # remove .z from xxxx.y.z TODO handle -RC.Z
fi
shift 2
;;
--dry-run )
DRY_RUN_CMD="echo"
shift 1
;;
--)
shift
break
;;
*)
echo ""
echo "Error in given Parameters. Undefined: "
echo "$*"
echo ""
echo "Usage: $0 --version XXXX.Y.Z [--dry-run]"
exit 1
esac
done
[[ -z "$version" ]] && die "--version must be provided"
index="$(cat releases/$release/index.yaml)"
$DRY_RUN_CMD helm repo add "$version" "s3://$HELM_BUCKET_NAME/$version" || $DRY_RUN_CMD helm s3 init "s3://$HELM_BUCKET_NAME/$version" && $DRY_RUN_CMD helm repo add "$version" "s3://$HELM_BUCKET_NAME/$version"
$DRY_RUN_CMD rm -rf dist
$DRY_RUN_CMD mkdir -p dist
$DRY_RUN_CMD cd dist
for component in $(echo "$index" | yq eval '.components | keys | .[]' -)
do
tag="$(echo "$index" | yq eval ".components[\"$component\"]" -)"
echo "Downloading component '$component' version $tag"
chart="$component-$tag.tgz"
$DRY_RUN_CMD fetch --repo="https://github.com/karavel-io/platform-component-$component" \
--tag="$tag" \
--release-asset="$chart" \
.
$DRY_RUN_CMD helm s3 push "./$chart" "$version" --relative
done