Skip to content

Commit d8bbf23

Browse files
authoredDec 9, 2024··
Update release scripts (#2365)
* Update release scripts * Update controller-gen 0.16.5 * Add `sed_inplace` method in bash script to make the sed syntax compatible in Linux and MacOS * Remove files that reference MCJob in release.sh * Update vulnerable package Update `github.com/golang-jwt/jwt/v4` from v4.5.0 to github.com/golang-jwt/jwt/v4 v4.5.1 to fix `CVE-2024-51744`
1 parent b5dd4cf commit d8bbf23

File tree

6 files changed

+51
-47
lines changed

6 files changed

+51
-47
lines changed
 

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ clean:
6666
@rm -rf dist/
6767

6868
regen-crd:
69-
@go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
69+
@go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5
7070
@${GOPATH}/bin/controller-gen crd:maxDescLen=0,generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=$(KUSTOMIZE_CRDS)
7171
@sed 's#namespace: minio-operator#namespace: {{ .Release.Namespace }}#g' resources/base/crds/minio.min.io_tenants.yaml > $(HELM_TEMPLATES)/minio.min.io_tenants.yaml
7272
@sed 's#namespace: minio-operator#namespace: {{ .Release.Namespace }}#g' resources/base/crds/sts.min.io_policybindings.yaml > $(HELM_TEMPLATES)/sts.min.io_policybindings.yaml

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/fatih/color v1.17.0 // indirect
1010
github.com/go-openapi/swag v0.23.0 // indirect
1111
github.com/golang-jwt/jwt v3.2.2+incompatible
12-
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
12+
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
1313
github.com/google/go-containerregistry v0.19.2
1414
github.com/google/uuid v1.6.0 // indirect
1515
github.com/gorilla/mux v1.8.1

‎go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL
6666
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
6767
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
6868
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
69+
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
70+
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
6971
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
7072
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
7173
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=

‎release.sh

+44-44
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,52 @@ set -e
44

55
# Parse command line arguments
66
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
1615
done
1716

17+
sed_inplace() {
18+
if [[ "$OSTYPE" == "darwin"* ]]; then
19+
sed -i "" -E "$@"
20+
else
21+
sed -i -r "$@"
22+
fi
23+
}
24+
1825
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
2229
}
2330

2431
MINIO_RELEASE=$(get_latest_release minio/minio)
2532
KES_RELEASE=$(get_latest_release minio/kes)
26-
MC_RELEASE=$(get_latest_release minio/mc)
2733

2834
MINIO_CURRENT_RELEASE=$(sed -nr 's/.*(minio\/minio\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go)
2935
KES_CURRENT_RELEASE=$(sed -nr 's/.*(minio\/kes\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go)
3036

3137
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"
5053
)
5154

5255
CURRENT_RELEASE=$(get_latest_release minio/operator)
@@ -55,36 +58,33 @@ CURRENT_RELEASE="${CURRENT_RELEASE:1}"
5558
echo "Upgrade: $CURRENT_RELEASE => $RELEASE"
5659
echo "MinIO: $MINIO_RELEASE => $MINIO_RELEASE"
5760
echo "KES: $KES_CURRENT_RELEASE => $KES_RELEASE"
58-
echo "MC: $MC_CURRENT_RELEASE => $MC_RELEASE"
5961

6062
if [ -z "$MINIO_RELEASE" ]; then
61-
echo "\$MINIO_RELEASE is empty"
62-
exit 0
63+
echo "\$MINIO_RELEASE is empty"
64+
exit 0
6365
fi
6466

6567
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"
7071
done
7172

7273
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"
7676
)
7777

7878
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"
8080
done
8181

8282
# 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"
8484

8585
if [ "${RELEASE_SIDECAR}" = "true" ]; then
8686

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"
8888
fi
8989

9090
# Add all the generated files to git

‎sidecar/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/goccy/go-json v0.10.3 // indirect
3030
github.com/gogo/protobuf v1.3.2 // indirect
3131
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
32-
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
32+
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
3333
github.com/golang/protobuf v1.5.4 // indirect
3434
github.com/google/gnostic-models v0.6.8 // indirect
3535
github.com/google/go-cmp v0.6.0 // indirect

‎sidecar/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL
3232
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
3333
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
3434
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
35+
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
36+
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
3537
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
3638
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
3739
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=

0 commit comments

Comments
 (0)
Please sign in to comment.