forked from minio/operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·71 lines (57 loc) · 2.35 KB
/
release.sh
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
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -e
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
MINIO_RELEASE=$(get_latest_release minio/minio)
KES_RELEASE=$(get_latest_release minio/kes)
KES_CURRENT_RELEASE=$(sed -nr 's/.*(minio\/kes\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go)
files=(
"README.md"
"api/consts.go"
"docs/tenant_crd.adoc"
"docs/policybinding_crd.adoc"
"docs/templates/asciidoctor/gv_list.tpl"
"examples/kustomization/base/tenant.yaml"
"examples/kustomization/tenant-certmanager-kes/tenant.yaml"
"examples/kustomization/tenant-kes-encryption/tenant.yaml"
"helm/operator/Chart.yaml"
"helm/operator/values.yaml"
"helm/tenant/Chart.yaml"
"helm/tenant/values.yaml"
"pkg/apis/minio.min.io/v2/constants.go"
"pkg/controller/operator.go"
"resources/base/deployment.yaml"
"resources/base/console-ui.yaml"
"testing/console-tenant+kes.sh"
"web-app/src/screens/Console/Tenants/AddTenant/Steps/Images.tsx"
"web-app/src/screens/Console/Tenants/TenantDetails/TenantEncryption.tsx")
CURRENT_RELEASE=$(get_latest_release minio/operator)
CURRENT_RELEASE="${CURRENT_RELEASE:1}"
echo "MinIO: $MINIO_RELEASE"
echo "Upgrade: $CURRENT_RELEASE => $RELEASE"
echo "KES: $KES_CURRENT_RELEASE => $KES_RELEASE"
if [ -z "$MINIO_RELEASE" ]; then
echo "\$MINIO_RELEASE is empty"
exit 0
fi
for file in "${files[@]}"; do
sed -i -e "s/${CURRENT_RELEASE}/${RELEASE}/g" "$file"
sed -i -e "s/RELEASE\.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]-[0-9][0-9]-[0-9][0-9]Z/${MINIO_RELEASE}/g" "$file"
sed -i -e "s/${KES_CURRENT_RELEASE}/${KES_RELEASE}/g" "$file"
done
annotations_files=(
"pkg/apis/job.min.io/v1alpha1/types.go"
"pkg/apis/minio.min.io/v2/types.go"
"pkg/apis/sts.min.io/v1beta1/types.go"
)
for file in "${annotations_files[@]}"; do
sed -i -e "s~operator.min.io/version=.*~operator.min.io/version=v${RELEASE}~g" "$file"
done
# Update annotation in kustomization yaml
sed -i -e "s~operator.min.io/version: .*~operator.min.io/version: v${RELEASE}~g" "resources/kustomization.yaml"
# Add all the generated files to git
echo "clean -e files"
rm -vf $(git ls-files --others | grep -e "-e$" | awk '{print $1}')