Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit ff84253

Browse files
committed
update release branch for helm
1 parent 3f6d12f commit ff84253

File tree

3 files changed

+97
-97
lines changed

3 files changed

+97
-97
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ workflows:
3333
tags:
3434
ignore: /.*/
3535
branches:
36-
only: remote-helm-chart
36+
only: master

.circleci/release.sh

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -14,120 +14,120 @@ readonly REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel)}"
1414
IMG="${IMG:-flink-operator:latest}"
1515

1616
main() {
17-
pushd "$REPO_ROOT" > /dev/null
18-
19-
echo "Fetching tags..."
20-
git fetch --tags
21-
22-
local latest_tag
23-
latest_tag=$(find_latest_tag)
24-
25-
local latest_tag_rev
26-
latest_tag_rev=$(git rev-parse --verify "$latest_tag")
27-
echo "$latest_tag_rev $latest_tag (latest tag)"
28-
29-
local head_rev
30-
head_rev=$(git rev-parse --verify HEAD)
31-
echo "$head_rev HEAD"
17+
pushd "$REPO_ROOT" > /dev/null
18+
19+
echo "Fetching tags..."
20+
git fetch --tags
21+
22+
local latest_tag
23+
latest_tag=$(find_latest_tag)
24+
25+
local latest_tag_rev
26+
latest_tag_rev=$(git rev-parse --verify "$latest_tag")
27+
echo "$latest_tag_rev $latest_tag (latest tag)"
28+
29+
local head_rev
30+
head_rev=$(git rev-parse --verify HEAD)
31+
echo "$head_rev HEAD"
32+
33+
if [[ $latest_tag_rev == "$head_rev" ]]; then
34+
echo "No code changes. Nothing to release."
35+
exit
36+
fi
37+
38+
rm -rf .deploy
39+
mkdir -p .deploy
40+
41+
echo "Identifying changed charts since tag '$latest_tag'..."
42+
43+
local changed_charts=()
44+
readarray -t changed_charts <<< "$(git diff --find-renames --name-only "$latest_tag_rev" -- helm-chart | cut -d '/' -f 2 | uniq)"
45+
46+
if [[ -n ${changed_charts[*]} ]]; then
47+
git clone https://github.com/GoogleCloudPlatform/flink-on-k8s-operator.git
48+
sed -e 's#image: .*#image: '"${IMG}"'#' flink-on-k8s-operator/config/default/manager_image_patch.template > flink-on-k8s-operator/config/default/manager_image_patch.yaml
49+
sed -i '/- \.\.\/crd/d' flink-on-k8s-operator/config/default/kustomization.yaml
50+
kustomize build flink-on-k8s-operator/config/default | tee flink-operator.yaml
51+
sed -i '1s/^/{{- if .Values.rbac.create }}\n/' flink-operator.yaml
52+
sed -i -e "\$a{{- end }}\n" flink-operator.yaml
53+
sed -i 's/flink-operator-system/{{ .Values.flinkOperatorNamespace }}/g' flink-operator.yaml
54+
sed -i 's/replicas: 1/replicas: {{ .Values.replicas }}/g' flink-operator.yaml
55+
sed -i "s/$IMG/{{ .Values.operatorImage.name }}/g" flink-operator.yaml
56+
mv flink-operator.yaml helm-chart/flink-operator/templates/flink-operator.yaml
57+
cp flink-on-k8s-operator/config/crd/bases/flinkoperator.k8s.io_flinkclusters.yaml helm-chart/flink-operator/templates/flink-cluster-crd.yaml
58+
sed -i '1s/^/{{ if .Values.rbac.create }}\n/' helm-chart/flink-operator/templates/flink-cluster-crd.yaml
59+
sed -i -e "\$a{{ end }}\n" helm-chart/flink-operator/templates/flink-cluster-crd.yaml
60+
awk '{sub(/\{\{\$clusterName\}\}\.example\.com/, "clusterName.example.com")}1' helm-chart/flink-operator/templates/flink-cluster-crd.yaml > temp.yaml && mv temp.yaml helm-chart/flink-operator/templates/flink-cluster-crd.yaml
61+
62+
for chart in "${changed_charts[@]}"; do
63+
echo "Packaging chart '$chart'..."
64+
package_chart "helm-chart/$chart"
65+
done
3266

33-
if [[ "$latest_tag_rev" == "$head_rev" ]]; then
34-
echo "No code changes. Nothing to release."
35-
exit
36-
fi
67+
release_charts
68+
sleep 5
69+
update_index
70+
else
71+
echo "Nothing to do. No chart changes detected."
72+
fi
3773

38-
rm -rf .deploy
39-
mkdir -p .deploy
40-
41-
echo "Identifying changed charts since tag '$latest_tag'..."
42-
43-
local changed_charts=()
44-
readarray -t changed_charts <<< "$(git diff --find-renames --name-only "$latest_tag_rev" -- helm-chart | cut -d '/' -f 2 | uniq)"
45-
46-
if [[ -n "${changed_charts[*]}" ]]; then
47-
git clone https://github.com/GoogleCloudPlatform/flink-on-k8s-operator.git
48-
sed -e 's#image: .*#image: '"${IMG}"'#' flink-on-k8s-operator/config/default/manager_image_patch.template >flink-on-k8s-operator/config/default/manager_image_patch.yaml
49-
sed -i '/- \.\.\/crd/d' flink-on-k8s-operator/config/default/kustomization.yaml
50-
kustomize build flink-on-k8s-operator/config/default | tee flink-operator.yaml
51-
sed -i '1s/^/{{- if .Values.rbac.create }}\n/' flink-operator.yaml
52-
sed -i -e "\$a{{- end }}\n" flink-operator.yaml
53-
sed -i 's/flink-operator-system/{{ .Values.flinkOperatorNamespace }}/g' flink-operator.yaml
54-
sed -i 's/replicas: 1/replicas: {{ .Values.replicas }}/g' flink-operator.yaml
55-
sed -i "s/$IMG/{{ .Values.operatorImage.name }}/g" flink-operator.yaml
56-
mv flink-operator.yaml helm-chart/flink-operator/templates/flink-operator.yaml
57-
cp flink-on-k8s-operator/config/crd/bases/flinkoperator.k8s.io_flinkclusters.yaml helm-chart/flink-operator/templates/flink-cluster-crd.yaml
58-
sed -i '1s/^/{{ if .Values.rbac.create }}\n/' helm-chart/flink-operator/templates/flink-cluster-crd.yaml
59-
sed -i -e "\$a{{ end }}\n" helm-chart/flink-operator/templates/flink-cluster-crd.yaml
60-
awk '{sub(/\{\{\$clusterName\}\}\.example\.com/, "clusterName.example.com")}1' helm-chart/flink-operator/templates/flink-cluster-crd.yaml > temp.yaml && mv temp.yaml helm-chart/flink-operator/templates/flink-cluster-crd.yaml
61-
62-
for chart in "${changed_charts[@]}"; do
63-
echo "Packaging chart '$chart'..."
64-
package_chart "helm-chart/$chart"
65-
done
66-
67-
release_charts
68-
sleep 5
69-
update_index
70-
else
71-
echo "Nothing to do. No chart changes detected."
72-
fi
73-
74-
popd > /dev/null
74+
popd > /dev/null
7575
}
7676

7777
find_latest_tag() {
78-
if ! git describe --tags --abbrev=0 2> /dev/null; then
79-
git rev-list --max-parents=0 --first-parent HEAD
80-
fi
78+
if ! git describe --tags --abbrev=0 2> /dev/null; then
79+
git rev-list --max-parents=0 --first-parent HEAD
80+
fi
8181
}
8282

8383
package_chart() {
84-
local chart="$1"
85-
helm dependency build "$chart"
86-
helm package "$chart" --destination .deploy
84+
local chart="$1"
85+
helm dependency build "$chart"
86+
helm package "$chart" --destination .deploy
8787
}
8888

8989
release_charts() {
90-
chart-releaser upload -o "$GIT_USERNAME" -r "$GIT_REPOSITORY_NAME" -p .deploy
90+
chart-releaser upload -o "$GIT_USERNAME" -r "$GIT_REPOSITORY_NAME" -p .deploy
9191
}
9292

9393
update_index() {
94-
chart-releaser index -o "$GIT_USERNAME" -r "$GIT_REPOSITORY_NAME" -p .deploy/index.yaml
95-
96-
git config user.email "$GIT_EMAIL"
97-
git config user.name "$GIT_USERNAME"
98-
99-
rm -rf flink-on-k8s-operator
100-
git checkout remote-helm-chart
101-
if [ -z "$(git status --porcelain)" ]; then
102-
echo "nothing to commit."
103-
else
104-
git add .
105-
git commit -m "Update CRDs"
106-
git push "$GIT_REPOSITORY_URL" remote-helm-chart
94+
chart-releaser index -o "$GIT_USERNAME" -r "$GIT_REPOSITORY_NAME" -p .deploy/index.yaml
95+
96+
git config user.email "$GIT_EMAIL"
97+
git config user.name "$GIT_USERNAME"
98+
99+
rm -rf flink-on-k8s-operator
100+
git checkout master
101+
if [ -z "$(git status --porcelain)" ]; then
102+
echo "nothing to commit."
103+
else
104+
git add .
105+
git commit -m "Update CRDs"
106+
git push "$GIT_REPOSITORY_URL" master
107+
fi
108+
109+
for file in helm-chart/*/*.md; do
110+
if [[ -e $file ]]; then
111+
mkdir -p ".deploy/docs/$(dirname "$file")"
112+
cp --force "$file" ".deploy/docs/$(dirname "$file")"
107113
fi
114+
done
108115

109-
for file in helm-chart/*/*.md; do
110-
if [[ -e $file ]]; then
111-
mkdir -p ".deploy/docs/$(dirname "$file")"
112-
cp --force "$file" ".deploy/docs/$(dirname "$file")"
113-
fi
114-
done
115-
116-
git checkout gh-pages
117-
cp --force .deploy/index.yaml index.yaml
116+
git checkout gh-pages
117+
cp --force .deploy/index.yaml index.yaml
118118

119-
if [[ -e ".deploy/docs/" ]]; then
120-
mkdir -p charts
121-
cp --force --recursive .deploy/docs/* charts/
122-
fi
119+
if [[ -e ".deploy/docs/" ]]; then
120+
mkdir -p charts
121+
cp --force --recursive .deploy/docs/* charts/
122+
fi
123123

124-
git checkout master -- README.md
124+
git checkout master -- README.md
125125

126-
if ! git diff --quiet; then
127-
git add .
128-
git commit --message="Update index.yaml" --signoff
129-
git push "$GIT_REPOSITORY_URL" gh-pages
130-
fi
126+
if ! git diff --quiet; then
127+
git add .
128+
git commit --message="Update index.yaml" --signoff
129+
git push "$GIT_REPOSITORY_URL" gh-pages
130+
fi
131131
}
132132

133133
main

helm-chart/flink-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
name: flink-operator
33
appVersion: "1.0"
44
description: A Helm chart for flink on Kubernetes operator
5-
version: "0.1.0"
5+
version: "0.1.1"
66
keywords:
77
- flink
88
home: https://github.com/GoogleCloudPlatform/flink-on-k8s-operator

0 commit comments

Comments
 (0)