Skip to content

Commit

Permalink
Merge pull request #237 from joelsmith/kedamain
Browse files Browse the repository at this point in the history
Fix hack/relprep.sh script to match KEDA repo
  • Loading branch information
joelsmith authored Jul 31, 2024
2 parents 46329e6 + 9a4848c commit 0378497
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions hack/relprep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ set -e
# these components k8s.io/<item> are versioned for each k8s release and should match the version of k8s used in KEDA for a given release
kube_components="api apimachinery apiextensions-apiserver apiserver client-go component-base kube-aggregator"

match_keda_version_deps="sigs.k8s.io/controller-runtime sigs.k8s.io/controller-runtime/tools/setup-envtest sigs.k8s.io/controller-tools"

echo "Fetching sample CRs for KEDA v$ver"
curl -s "https://raw.githubusercontent.com/kedacore/keda/v${ver}/config/samples/kustomization.yaml" > config/samples/kustomization.yaml
for cr in $(sed -n '/^resources:$/,/^[^-]/ { s#[^0-9a-zA-Z_. -]##g; s#^- ##p}' config/samples/kustomization.yaml); do
Expand Down Expand Up @@ -53,8 +55,8 @@ echo
echo 'Running go mod tidy (pass 1)'
go mod tidy

echo "Getting latest tag for keda-tools for version $gover"
bttag=$(skopeo list-tags docker://ghcr.io/kedacore/keda-tools | jq -r '.Tags|.[]' | sort --version-sort -r | head -1)
echo "Getting tag for keda-tools used to build KEDA version $ver"
bttag=$(curl -s "https://raw.githubusercontent.com/kedacore/keda/v${ver}/Dockerfile" | sed -n 's#^FROM.* ghcr.io/kedacore/keda-tools:\([0-9][0-9.]*\) AS builder$#\1#p;T;q')

echo "Updating keda-tools tag to $bttag"
while read f; do
Expand Down Expand Up @@ -111,6 +113,17 @@ for i in $kube_components; do
updated_mods["k8s.io/$i"]=1
done

for i in $match_keda_version_deps; do
echo -n checking upstream version of $i .....
if ! modver=$(echo "$keda_gomod" | grep -Po '(?<=^\t'"$i"' )v[0-9]*\.[0-9]*\.[0-9]*(-[0-9]*(-[0-9a-e]*)?)?$'); then
echo " Unable to find $i in https://raw.githubusercontent.com/kedacore/keda/v${ver}/go.mod . Exiting!"
exit 1
fi
echo " got version $modver"
to_update+=("$i@$modver")
updated_mods["$i"]=1
done

# hack: force version of openshift API module based upon k8s->openshift version skew (e.g. 1.27 -> 4.14)
openshift_branch="release-4.$(($(echo $k8sver | sed 's/v0\.\([0-9]*\)\.[0-9]*$/\1/')-13))"
to_update+=("github.com/openshift/api@$openshift_branch")
Expand Down

0 comments on commit 0378497

Please sign in to comment.