@@ -13,21 +13,22 @@ mainBranch := "main"
1313workingBranchPrefix := " chore/update-"
1414targetBranchPrefix := " release-"
1515
16- # Show available commands
16+ [ private ]
1717default :
1818 @ just --list --justfile {{ justfile () }}
1919
2020# Show available commands
21+ [group (' General' )]
2122help : default
2223
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 :
2627 #!/usr/bin/env bash
27- set -euxo pipefail
28+ set -euo pipefail
2829 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 "
3132 mkdir -p bin
3233 pushd bin
3334 git clone https:// github.com/ SovereignCloudStack/ csctl csctl-git
@@ -38,9 +39,8 @@ ensure-dependencies:
3839 rm -rf csctl-git
3940 popd
4041 fi
41-
4242 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 "
4444 mkdir -p bin
4545 pushd bin
4646 git clone https:// github.com/ SovereignCloudStack/ csctl-plugin-openstack
@@ -51,67 +51,125 @@ ensure-dependencies:
5151 rm -rf csctl-plugin-openstack
5252 popd
5353 fi
54-
5554 if ! which yq; then
55+ echo -e " \e [33m\e [1myq not found. Installing from GitHub.\e [0m"
5656 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"
5962 fi
6063
6164# Clean temporary files and binaries
62- [no-cd ]
65+ [group ( ' General' ) ]
6366clean :
67+ @ echo -e " \e [33m\e [1mClean Buildtools\e [0m"
6468 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+
6593
6694# 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
6997 #!/usr/bin/env bash
98+ set -euxo pipefail
7099 changedVersions=$(just diff)
71100 for version in ${changedVersions[@]}; do
72- . / hack / generate_version.py --target -version ${version}
101+ just build -version ${version}
73102 done
74103
75104# 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
79115
80116# Generate Manifest for a specific Kubernetes version. Builds out directory
81- [no-cd ]
117+ [group ( ' Building Manifests' ) ]
82118build-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+
84138
85139# 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, " ." , " -" ) }} /
89154
90155# 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
93158 #!/usr/bin/env bash
94159 export PATH=${path}
95160 changedVersions=$(just diff)
96161 for version in ${changedVersions[@]}; do
97- csctl create -m hash providers / openstack / out / ${version// . / -} /
162+ just build-assets-local-for ${version}
98163 done
99164
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
103168 #!/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}
116174 done
117- echo " ${toTest[@]}"
175+
0 commit comments