4
4
5
5
# Parse command line arguments
6
6
while [[ " $# " -gt 0 ]]; do
7
- case $1 in
8
- --release-sidecar)
9
- RELEASE_SIDECAR=" $2 "
10
- shift 2
11
- ;;
12
- * )
13
- ;;
14
- esac
15
- shift
7
+ case $1 in
8
+ --release-sidecar)
9
+ RELEASE_SIDECAR=" $2 "
10
+ shift 2
11
+ ;;
12
+ * ) ;;
13
+ esac
14
+ shift
16
15
done
17
16
17
+ sed_inplace () {
18
+ if [[ " $OSTYPE " == " darwin" * ]]; then
19
+ sed -i " " -E " $@ "
20
+ else
21
+ sed -i -r " $@ "
22
+ fi
23
+ }
24
+
18
25
get_latest_release () {
19
- curl --silent " https://api.github.com/repos/$1 /releases/latest" | # Get latest release from GitHub api
20
- grep ' "tag_name":' | # Get tag line
21
- sed -E ' s/.*"([^"]+)".*/\1/' # Pluck JSON value
26
+ curl --silent " https://api.github.com/repos/$1 /releases/latest" | # Get latest release from GitHub api
27
+ grep ' "tag_name":' | # Get tag line
28
+ sed -E ' s/.*"([^"]+)".*/\1/' # Pluck JSON value
22
29
}
23
30
24
31
MINIO_RELEASE=$( get_latest_release minio/minio)
25
32
KES_RELEASE=$( get_latest_release minio/kes)
26
- MC_RELEASE=$( get_latest_release minio/mc)
27
33
28
34
MINIO_CURRENT_RELEASE=$( sed -nr ' s/.*(minio\/minio\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go)
29
35
KES_CURRENT_RELEASE=$( sed -nr ' s/.*(minio\/kes\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go)
30
36
31
37
files=(
32
- " README.md"
33
- " pkg/apis/job.min.io/v1alpha1/types.go"
34
- " docs/tenant_crd.adoc"
35
- " docs/policybinding_crd.adoc"
36
- " docs/job_crd.adoc"
37
- " docs/minio-job.md"
38
- " docs/templates/asciidoctor/gv_list.tpl"
39
- " examples/kustomization/base/tenant.yaml"
40
- " examples/kustomization/tenant-certmanager-kes/tenant.yaml"
41
- " examples/kustomization/tenant-kes-encryption/tenant.yaml"
42
- " helm/operator/Chart.yaml"
43
- " helm/operator/values.yaml"
44
- " helm/tenant/Chart.yaml"
45
- " helm/tenant/values.yaml"
46
- " pkg/apis/minio.min.io/v2/constants.go"
47
- " pkg/controller/operator.go"
48
- " resources/base/deployment.yaml"
49
- " testing/console-tenant+kes.sh"
38
+ " README.md"
39
+ " docs/tenant_crd.adoc"
40
+ " docs/policybinding_crd.adoc"
41
+ " docs/templates/asciidoctor/gv_list.tpl"
42
+ " examples/kustomization/base/tenant.yaml"
43
+ " examples/kustomization/tenant-certmanager-kes/tenant.yaml"
44
+ " examples/kustomization/tenant-kes-encryption/tenant.yaml"
45
+ " helm/operator/Chart.yaml"
46
+ " helm/operator/values.yaml"
47
+ " helm/tenant/Chart.yaml"
48
+ " helm/tenant/values.yaml"
49
+ " pkg/apis/minio.min.io/v2/constants.go"
50
+ " pkg/controller/operator.go"
51
+ " resources/base/deployment.yaml"
52
+ " testing/console-tenant+kes.sh"
50
53
)
51
54
52
55
CURRENT_RELEASE=$( get_latest_release minio/operator)
@@ -55,36 +58,33 @@ CURRENT_RELEASE="${CURRENT_RELEASE:1}"
55
58
echo " Upgrade: $CURRENT_RELEASE => $RELEASE "
56
59
echo " MinIO: $MINIO_RELEASE => $MINIO_RELEASE "
57
60
echo " KES: $KES_CURRENT_RELEASE => $KES_RELEASE "
58
- echo " MC: $MC_CURRENT_RELEASE => $MC_RELEASE "
59
61
60
62
if [ -z " $MINIO_RELEASE " ]; then
61
- echo " \$ MINIO_RELEASE is empty"
62
- exit 0
63
+ echo " \$ MINIO_RELEASE is empty"
64
+ exit 0
63
65
fi
64
66
65
67
for file in " ${files[@]} " ; do
66
- sed -i -e " s/${KES_CURRENT_RELEASE} /${KES_RELEASE} /g" " $file "
67
- sed -i -e " s/${MC_CURRENT_RELEASE} /${MC_RELEASE} /g" " $file "
68
- sed -i -e " s/${CURRENT_RELEASE} /${RELEASE} /g" " $file "
69
- sed -i -e " s/${MINIO_CURRENT_RELEASE} /${MINIO_RELEASE} /g" " $file "
68
+ sed_inplace " s/${KES_CURRENT_RELEASE} /${KES_RELEASE} /g" " $file "
69
+ sed_inplace " s/${CURRENT_RELEASE} /${RELEASE} /g" " $file "
70
+ sed_inplace " s/${MINIO_CURRENT_RELEASE} /${MINIO_RELEASE} /g" " $file "
70
71
done
71
72
72
73
annotations_files=(
73
- " pkg/apis/job.min.io/v1alpha1/types.go"
74
- " pkg/apis/minio.min.io/v2/types.go"
75
- " pkg/apis/sts.min.io/v1beta1/types.go"
74
+ " pkg/apis/minio.min.io/v2/types.go"
75
+ " pkg/apis/sts.min.io/v1beta1/types.go"
76
76
)
77
77
78
78
for file in " ${annotations_files[@]} " ; do
79
- sed -i -e " s~operator.min.io/version=.*~operator.min.io/version=v${RELEASE} ~g" " $file "
79
+ sed_inplace " s~operator.min.io/version=.*~operator.min.io/version=v${RELEASE} ~g" " $file "
80
80
done
81
81
82
82
# Update annotation in kustomization yaml
83
- sed -i -e " s~operator.min.io/version: .*~operator.min.io/version: v${RELEASE} ~g" " resources/kustomization.yaml"
83
+ sed_inplace " s~operator.min.io/version: .*~operator.min.io/version: v${RELEASE} ~g" " resources/kustomization.yaml"
84
84
85
85
if [ " ${RELEASE_SIDECAR} " = " true" ]; then
86
86
87
- sed -i -e ' s~quay.io/minio/operator-sidecar:.*\"~quay.io/minio/operator-sidecar:v' $RELEASE ' \"~g' " pkg/resources/statefulsets/minio-sidecar.go"
87
+ sed_inplace ' s~quay.io/minio/operator-sidecar:.*\"~quay.io/minio/operator-sidecar:v' $RELEASE ' \"~g' " pkg/resources/statefulsets/minio-sidecar.go"
88
88
fi
89
89
90
90
# Add all the generated files to git
0 commit comments