@@ -13,21 +13,22 @@ mainBranch := "main"
13
13
workingBranchPrefix := " chore/update-"
14
14
targetBranchPrefix := " release-"
15
15
16
- # Show available commands
16
+ [ private ]
17
17
default :
18
18
@ just --list --justfile {{ justfile () }}
19
19
20
20
# Show available commands
21
+ [group (' General' )]
21
22
help : default
22
23
23
- # Check if csctl and clusterstack-provider-openstack are available and build them if neccessary
24
- [no-cd ]
25
- ensure- dependencies:
24
+ # Check if csctl and clusterstack-provider-openstack are available and build them if neccessary. Checks for helm and yq
25
+ [group ( ' General' ) ]
26
+ dependencies :
26
27
#!/usr/bin/env bash
27
- set -euxo pipefail
28
+ set -euo pipefail
28
29
export PATH=${path}
29
- if ! which csctl >/ dev/ null 2 >&1 ;then
30
- echo " csctl not found, building it from source."
30
+ if ! which csctl >/ dev/ null 2 >&1 ; then
31
+ echo -e " \e [33m \e [1mcsctl not found, building it from source.\e [0m "
31
32
mkdir -p bin
32
33
pushd bin
33
34
git clone https:// github.com/ SovereignCloudStack/ csctl csctl-git
@@ -38,9 +39,8 @@ ensure-dependencies:
38
39
rm -rf csctl-git
39
40
popd
40
41
fi
41
-
42
42
if ! which csctl-openstack >/ dev/ null 2 >&1 ; then
43
- echo " csctl -plugin-openstack not found, building it from source."
43
+ echo -e " \e [33m \e [1mcsctl -plugin-openstack not found, building it from source.\e [0m "
44
44
mkdir -p bin
45
45
pushd bin
46
46
git clone https:// github.com/ SovereignCloudStack/ csctl-plugin-openstack
@@ -51,67 +51,125 @@ ensure-dependencies:
51
51
rm -rf csctl-plugin-openstack
52
52
popd
53
53
fi
54
-
55
54
if ! which yq; then
55
+ echo -e " \e [33m\e [1myq not found. Installing from GitHub.\e [0m"
56
56
mkdir -p bin
57
- wget https:// github.com/ mikefarah/ yq/ releases/ latest/ download/ yq_linux_amd64 -O bin/ yq && \
58
- chmod + x bin/ yq
57
+ wget https:// github.com/ mikefarah/ yq/ releases/ latest/ download/ yq_linux_amd64 -O bin/ yq
58
+ chmod + x bin/ yq
59
+ fi
60
+ if ! which helm; then
61
+ echo -e " \e [31m\e [1mHelm not found. Please install it.\e [0m"
59
62
fi
60
63
61
64
# Clean temporary files and binaries
62
- [no-cd ]
65
+ [group ( ' General' ) ]
63
66
clean :
67
+ @ echo -e " \e [33m\e [1mClean Buildtools\e [0m"
64
68
rm -rf bin
69
+ @ echo -e " \e [33m\e [1mClean Provider Versions\e [0m"
70
+ rm -rf providers/ openstack/ out
71
+ @ echo -e " \e [33m\e [1mClean Assets\e [0m"
72
+ rm -rf .release
73
+
74
+ # Calculate the diff in the versions.yaml against main/HEAD to get relevant versions
75
+ [group (' General' )]
76
+ diff :
77
+ #!/usr/bin/env bash
78
+ set -euxo pipefail
79
+ versionsPath=" providers/openstack/scs/versions.yaml"
80
+ currentVersions=$(cat ${versionsPath})
81
+ mainVersions=$(git show ${mainBranch}:${versionsPath})
82
+ kubernetesVersions=$(yq -r ' .[].kubernetes' ${versionsPath} | grep -Po " 1\.\d +" )
83
+ toTest=()
84
+ for version in ${kubernetesVersions}; do
85
+ currentManifest=$(echo " ${currentVersions}" | yq --sort-keys " .[] | select(.kubernetes | test(\" ${version}\" ))" )
86
+ mainManifest=$(echo " ${mainVersions}" | yq --sort-keys " .[] | select(.kubernetes | test(\" ${version}\" ))" )
87
+ if ! diff -q <(echo " $currentManifest" ) <(echo " $mainManifest" ) >/ dev/ null; then
88
+ toTest=(" ${toTest[@]}" " ${version}" )
89
+ fi
90
+ done
91
+ echo " ${toTest[@]}"
92
+
65
93
66
94
# Build Clusterstacks version directories according to changes in versions.yaml. Builds out directoy
67
- [no-cd ]
68
- build-versions : ensure- dependencies
95
+ [group ( ' Building Manifests' ) ]
96
+ build-versions : dependencies
69
97
#!/usr/bin/env bash
98
+ set -euxo pipefail
70
99
changedVersions=$(just diff)
71
100
for version in ${changedVersions[@]}; do
72
- . / hack / generate_version.py --target -version ${version}
101
+ just build -version ${version}
73
102
done
74
103
75
104
# Generate manifest for all Kubernetes Version regardless of changes to versions.
76
- [no-cd ]
77
- build-versions-all : ensure-dependencies
78
- ./ hack/ generate_version.py --build
105
+ [group (' Building Manifests' )]
106
+ build-versions-all : dependencies
107
+ #!/usr/bin/env bash
108
+ set -euxo pipefail
109
+ versionsPath=" providers/openstack/scs/versions.yaml"
110
+ currentVersions=$(cat ${versionsPath})
111
+ kubernetesVersions=$(yq -r ' .[].kubernetes' ${versionsPath} | grep -Po " 1\.\d +" )
112
+ for version in ${kubernetesVersions}; do
113
+ just build-version ${version}
114
+ done
79
115
80
116
# Generate Manifest for a specific Kubernetes version. Builds out directory
81
- [no-cd ]
117
+ [group ( ' Building Manifests' ) ]
82
118
build-version VERSION :
83
- ./ hack/ generate_version.py --target-version {{ VERSION}}
119
+ #!/usr/bin/env bash
120
+ set -euxo pipefail
121
+ echo -e " \e [33m\e [1mBuild Manifests for {{ VERSION }} \e [0m"
122
+ ## CHECK IF THERE IS A CHANGE IN THE COMPONENT VERSIONS
123
+ if [[ -e providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }} ]]; then
124
+ versionsFile=" providers/openstack/scs/versions.yaml"
125
+ k8sVersion=$(yq -r " .[] | select(.kubernetes | test(\" {{ replace (VERSION, " -" , " ." ) }} \" )).kubernetes" ${versionsFile})
126
+ cinder_csiVersion=$(yq -r " .[] | select(.kubernetes | test(\" {{ replace (VERSION, " -" , " ." ) }} \" )).cinder_csi" ${versionsFile})
127
+ occmVersion=$(yq -r " .[] | select(.kubernetes | test(\" {{ replace (VERSION, " -" , " ." ) }} \" )).occm" ${versionsFile})
128
+ k8sVersionCmp=$(yq -r .config.kubernetesVersion providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }}/ csctl.yaml)
129
+ cinder_csiVersionCmp=$(yq -r " .dependencies[] | select(.name | test(\" openstack-cinder-csi\" )).version" providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }}/ cluster-addon/ Chart.yaml)
130
+ occmVersionCmp=$(yq -r " .dependencies[] | select(.name | test(\" openstack-cloud-controller-manager\" )).version" providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }}/ cluster-addon/ Chart.yaml)
131
+ if [[ ${k8sVersion} != ${k8sVersionCmp#v} ]] || [[ ${cinder_csiVersion} != ${cinder_csiVersionCmp} ]] || [[ ${occmVersion} != ${occmVersionCmp} ]]; then
132
+ ./ hack/ generate_version.py --target-version {{ replace (VERSION, " -" , " ." ) }}
133
+ fi
134
+ else
135
+ ./ hack/ generate_version.py --target-version {{ replace (VERSION, " -" , " ." ) }}
136
+ fi
137
+
84
138
85
139
# Build assets for a certain Kubernetes Version. Out directory needs to be present.
86
- [no-cd ]
87
- build-assets-local-for VERSION : ensure-dependencies
88
- csctl create -m hash providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" )}} /
140
+ [group (' Building Assets' )]
141
+ build-assets-local-for VERSION : dependencies
142
+ #!/usr/bin/env bash
143
+ export PATH=${path}
144
+ set -euxo pipefail
145
+ just build-version {{ VERSION }}
146
+ echo -e " \e [33m\e [1mBuild Assets for {{ VERSION }} \e [0m"
147
+ if ! [[ -e providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }} / cluster-addon/ Chart.lock ]]; then
148
+ helm dependency up providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }} / cluster-addon/
149
+ fi
150
+ if ! [[ -e providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }} / cluster-class/ Chart.lock ]]; then
151
+ helm dependency up providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }} / cluster-class/
152
+ fi
153
+ csctl create -m hash providers/ openstack/ out/ {{ replace (VERSION, " ." , " -" ) }} /
89
154
90
155
# Build assets for a certain Kubernetes Version. Out directory needs to be present.
91
- [no-cd ]
92
- build-assets-local : ensure-dependencies
156
+ [group ( ' Building Assets' ) ]
157
+ build-assets-local : build-versions
93
158
#!/usr/bin/env bash
94
159
export PATH=${path}
95
160
changedVersions=$(just diff)
96
161
for version in ${changedVersions[@]}; do
97
- csctl create -m hash providers / openstack / out / ${version// . / -} /
162
+ just build-assets-local-for ${version}
98
163
done
99
164
100
- # Calculate the diff in the versions.yaml files to get relevant versions
101
- [no-cd ]
102
- diff :
165
+ # Build assets for a certain Kubernetes Version.
166
+ [group ( ' Building Assets' ) ]
167
+ build-assets-all-local : build-versions-all
103
168
#!/usr/bin/env bash
104
- set -euo pipefail
105
- versionsPath=" providers/openstack/scs/versions.yaml"
106
- currentVersions=$(cat ${versionsPath})
107
- mainVersions=$(git show ${mainBranch}:${versionsPath})
108
- kubernetesVersions=$(yq -r ' .[].kubernetes' ${versionsPath} | grep -Po " 1\.\d +" )
109
- toTest=()
110
- for version in ${kubernetesVersions}; do
111
- currentManifest=$(echo " ${currentVersions}" | yq --sort-keys " .[] | select(.kubernetes | test(\" ${version}\" ))" )
112
- mainManifest=$(echo " ${mainVersions}" | yq --sort-keys " .[] | select(.kubernetes | test(\" ${version}\" ))" )
113
- if ! diff -q <(echo " $currentManifest" ) <(echo " $mainManifest" ) >/ dev/ null; then
114
- toTest=(" ${toTest[@]}" " ${version}" )
115
- fi
169
+ export PATH=${path}
170
+ set -euxo pipefail
171
+ versions=" $(cd providers/openstack/out/ && echo *)"
172
+ for version in ${versions[@]}; do
173
+ just build-assets-local-for ${version}
116
174
done
117
- echo " ${toTest[@]}"
175
+
0 commit comments