Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make downloading of kustomize more robust to GitHub API rate limits #37

Merged
merged 2 commits into from
Dec 22, 2022

Conversation

gozer
Copy link
Contributor

@gozer gozer commented Dec 16, 2022

Also, introduce kustomize_install as a boolean option that can disable
installing kustomize alltogether, assuming you install it some other way,
like with https://github.com/yokawasa/action-setup-kube-tools

Details of Change

Issue

Fixes #35

Test Results

Also, introduce `kustomize_install` as a boolean option that can disable
installing kustomize alltogether, assuming you install it some other way,
like with https://github.com/yokawasa/action-setup-kube-tools

Fixes karancode#35
@nfoucha
Copy link

nfoucha commented Dec 19, 2022

@karancode Any chance of a review and merge of this? Had a pretty rough stretch today trying to get our actions workflows to succeed.

@karancode
Copy link
Owner

@nfoucha sorry for late.. will get it merged today. Thanks @gozer for the PR.

@karancode
Copy link
Owner

@gozer looks like this way will fail for older versions (for ex: 3.0.0). Could you please confirm that once ? Thanks!

@gozer
Copy link
Contributor Author

gozer commented Dec 21, 2022

100% right, I completely misread the loop and thought it was a retry loop, fixed!

INPUT_KUSTOMIZE_VERSION=3.0.0 sh -x entrypoint.sh
+ main ''
++ dirname entrypoint.sh
+ scriptDir=.
+ source ./kustomize_build.sh
+ parse_inputs
+ '[' 3.0.0 '!=' '' ']'
+ kustomize_version=3.0.0
+ kustomize_build_dir=.
+ '[' '' '!=' '' ']'
+ '[' '' '!=' . ']'
+ kustomize_build_dir=
+ kustomize_comment=0
+ '[' '' == 1 ']'
+ '[' '' == true ']'
+ kustomize_install=1
+ '[' '' == 0 ']'
+ '[' '' == false ']'
+ kustomize_output_file=
+ '[' -n '' ']'
+ kustomize_build_options=
+ '[' -n '' ']'
+ enable_alpha_plugins=
+ '[' '' == 1 ']'
+ '[' '' == true ']'
+ '[' 1 == 1 ']'
+ install_kustomize
+ echo 'getting download url for kustomize 3.0.0'
getting download url for kustomize 3.0.0
+ for i in {1..100}
++ curl --retry-all-errors --fail --retry 30 --retry-max-time 120 -s 'https://api.github.com/repos/kubernetes-sigs/kustomize/releases?per_page=100&page=1'
++ jq -r '.[].assets[] | select(.browser_download_url | test("kustomize(_|.)?(v)?3.0.0_linux_amd64"))  | .browser_download_url'
+ url=
+ '[' '!' -z ']'
+ for i in {1..100}
++ curl --retry-all-errors --fail --retry 30 --retry-max-time 120 -s 'https://api.github.com/repos/kubernetes-sigs/kustomize/releases?per_page=100&page=2'
++ jq -r '.[].assets[] | select(.browser_download_url | test("kustomize(_|.)?(v)?3.0.0_linux_amd64"))  | .browser_download_url'
+ url=https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64
+ '[' '!' -z https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64 ']'
+ break
+ '[' '!' -z https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64 ']'
+ echo 'Download URL found in https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64'
Download URL found in https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64
+ echo 'Downloading kustomize v3.0.0'
Downloading kustomize v3.0.0
+ [[ https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64 =~ .tar.gz$ ]]
+ curl --retry 30 --retry-max-time 120 -s -S -L https://github.com/kubernetes-sigs/kustomize/releases/download/v3.0.0/kustomize_3.0.0_linux_amd64 -o /usr/bin/kustomize
curl: (23) Failure writing output to destination
+ '[' 23 -ne 0 ']'
+ echo 'Failed to download kustomize v3.0.0.'
Failed to download kustomize v3.0.0.
+ exit 1

@karancode karancode merged commit 9733fc9 into karancode:master Dec 22, 2022
@karancode
Copy link
Owner

karancode commented Dec 22, 2022

@gozer thanks a lot for the contribution. Changes added in the new release v1.3.0 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Failing to get the kustomize download url
3 participants