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

fix get latest version #63

Conversation

versus
Copy link

@versus versus commented Apr 8, 2022

Checklist

  • All new jobs, commands, executors, parameters have descriptions
  • Examples have been added for any significant new features
  • README has been updated, if necessary

Motivation, issues

Fix issues with non binary releases of aws-iam-authenticator who broken pipelines

Description

Add check and download to get latest version of release aws-iam-authenticator

@pedroMMM
Copy link
Contributor

pedroMMM commented Apr 9, 2022

I tested the script and it still tries to download the broken version v0.5.7

./test.sh
+ which aws-iam-authenticator
+ PLATFORM=linux
+ uname
+ grep -q Darwin
+ FILENAME=aws-iam-authenticator
++ curl -Ls --fail --retry 3 -o /dev/null -w '%{url_effective}' https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/latest
++ sed 's:.*/::'
++ sed s/v//g
+ VERSION=0.5.7
+ '[' -n '' ']'
++ curl -Ls --fail --retry 3 https://api.github.com/repos/kubernetes-sigs/aws-iam-authenticator/releases
++ grep tag_name
++ awk -F : '{print $2}'
+ versions_raw=' "v0.5.7",
 "v0.5.6",
 "v0.5.5",
 "v0.5.4",
 "v0.5.3",
 "v0.5.2",
 "v0.5.1",
 "v0.5.1-alpha.1",
 "v0.5.0",
 "v0.4.0",
 "0.4.0-alpha.3",
 "0.4.0-alpha.1",
 "v0.3.0",
 "v0.1.0",'
+ IFS=', '
+ read -ra versions
++ tr -d '"'
++ echo '"v0.5.7",' '"v0.5.6",' '"v0.5.5",' '"v0.5.4",' '"v0.5.3",' '"v0.5.2",' '"v0.5.1",' '"v0.5.1-alpha.1",' '"v0.5.0",' '"v0.4.0",' '"0.4.0-alpha.3",' '"0.4.0-alpha.1",' '"v0.3.0",' '"v0.1.0",'
+ for i in "${!versions[@]}"
++ echo v0.5.7
++ sed s/v//g
+ ver=0.5.7
+ DOWNLOAD_URL=https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.7/aws-iam-authenticator_0.5.7_linux_amd64
++ curl --write-out '%{http_code}' --silent --output /dev/null https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.7/aws-iam-authenticator_0.5.7_linux_amd64
+ status_code=404
+ [[ 404 -eq 302 ]]
+ for i in "${!versions[@]}"
++ echo v0.5.6
++ sed s/v//g
+ ver=0.5.6
+ DOWNLOAD_URL=https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.6/aws-iam-authenticator_0.5.6_linux_amd64
++ curl --write-out '%{http_code}' --silent --output /dev/null https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.6/aws-iam-authenticator_0.5.6_linux_amd64
+ status_code=302
+ [[ 302 -eq 302 ]]
+ break
+ DOWNLOAD_URL=https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.7/aws-iam-authenticator_0.5.7_linux_amd64
+ curl -L --fail --retry 3 -o aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.7/aws-iam-authenticator_0.5.7_linux_amd64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
+ chmod +x ./aws-iam-authenticator
chmod: cannot access './aws-iam-authenticator': No such file or directory
++ id -u
+ '[' 0 -ne 0 ']'

@z00b z00b force-pushed the master branch 2 times, most recently from d81b0f7 to 0e9caab Compare April 9, 2022 18:25
@versus
Copy link
Author

versus commented Apr 11, 2022

Fixed

@versus
Copy link
Author

versus commented May 13, 2022

Do you have any issue to this fix?

@pieterocp
Copy link

Given the lack of binaries in some releases, e.g. see kubernetes-sigs/aws-iam-authenticator#657, adding a fallback of finding a previous version in the case that a explicit version hasn't been pinned might be behaviour that is preferred to failing when the latest release has no binary.

Ofc an even nicer approach is to have an approved list of versions pulled, we select the latest version there and use that, so that it can be tested in here so that if the binary works as expected, it builds accordingly, if it doesn't, it won't.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion (optional): Given checksums are provided with binaries, it might be prudent to compare the downloaded binary with the checksum so its what we expect, not what we get.

@stoiev
Copy link

stoiev commented Dec 1, 2023

It's a nice approach, but why not just pin aws-iam-authenticator latest version as default value to get closer to a reproducible behavior (by default)?

This is an ancient tradeoff between stability and others properties, but for CI, stability is a strong one.

@brivu
Copy link
Contributor

brivu commented Jan 12, 2024

Hey Everyone, thanks for your input and contributions. I reworked the command to always install the latest version of the aws iam authenticator unless a version is specified. Please check out PR #80 and let me know what you think!

@brivu brivu closed this Jan 12, 2024
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.

5 participants