Skip to content

Commit

Permalink
[release-1.8] pull in e2e fixes (#13751)
Browse files Browse the repository at this point in the history
* use GITHUB_TOKEN when querying net-istio releases (#13681)

* use GITHUB_TOKEN when querying net-istio releases

* don't error out if GITHUB_TOKEN is unbound

* fix curl invocation (#13683)

Building up bash args as strings with quotes was problematic
  • Loading branch information
dprotaso committed Feb 27, 2023
1 parent 95294cd commit 0ad6c37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
KAPP_VERSION: 0.46.0
YTT_VERSION: 0.40.1
KO_FLAGS: --platform=linux/amd64
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
Expand Down
22 changes: 19 additions & 3 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,26 @@ export QUOTA=${QUOTA:-1}
# Receives the latest serving version and searches for the same version with major and minor and searches for the latest patch
function latest_net_istio_version() {
local serving_version=$1
local major_minor
major_minor=$(echo "$serving_version" | cut -d '.' -f 1,2)
local major_minor=$(echo "$serving_version" | cut -d '.' -f 1,2)

curl -L --silent "https://api.github.com/repos/knative/net-istio/releases" | jq --arg major_minor "$major_minor" -r '[.[].tag_name] | map(select(. | startswith($major_minor))) | sort_by( sub("knative-";"") | sub("v";"") | split(".") | map(tonumber) ) | reverse[0]'
local url="https://api.github.com/repos/knative/net-istio/releases"
local curl_output=$(mktemp)
local curl_flags='-L --show-error --silent'

if [ -n "${GITHUB_TOKEN-}" ]; then
curl $curl_flags -H "Authorization: Bearer $GITHUB_TOKEN" $url > $curl_output
else
curl $curl_flags $url > $curl_output
fi

jq --arg major_minor "$major_minor" -r \
'[.[].tag_name] |
map(select(. | startswith($major_minor))) |
sort_by( sub("knative-";"") |
sub("v";"") |
split(".") |
map(tonumber) ) |
reverse[0]' $curl_output
}

# Latest serving release. If user does not supply this as a flag, the latest
Expand Down

0 comments on commit 0ad6c37

Please sign in to comment.