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

if statement for version check fix #1369

Merged
merged 2 commits into from
Aug 29, 2023
Merged

if statement for version check fix #1369

merged 2 commits into from
Aug 29, 2023

Conversation

afastronomer
Copy link
Contributor

if statement for version check fix

Description

In some shells if statement doesn't work correct.

🎟 Issue(s)

Related #XXX

🧪 Functional Testing

Script was executed w/ and w/o specified value for version.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

if statement for version check fix
@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (f142e1d) 86.89% compared to head (7a824a7) 86.89%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1369   +/-   ##
=======================================
  Coverage   86.89%   86.89%           
=======================================
  Files         114      114           
  Lines       13912    13912           
=======================================
  Hits        12089    12089           
  Misses       1087     1087           
  Partials      736      736           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

godownloader.sh Outdated
version=$(curl https://api.github.com/repos/${owner_repo}/releases/latest -s | tr -s '\n' ' ' | sed 's/.*"tag_name": "//' | sed 's/".*//')
elif [[ "$version" =~ ^v[0-9]+\.[0-9]+$ ]]; then
elif [ $version = ^v[0-9]+\.[0-9]+$ ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to keep version as string? or does this work for you regardless

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might need to continue to use double brackets, in order to support regex in the elif clause. Any reason to change this as well?

It is supposed to support a case when users try to send in a request to install a version without mentioning the patch number, then that logic would pick up the latest patch for the mentioned version.

The ideal output would be that v1.18.2 is installed when we pass v1.18, but with the current change, it is not able to find any version.

neel@Neels-MacBook-Pro astro-cli % bash godownloader.sh -- v1.18
astronomer/astro-cli info checking GitHub for tag 'v1.18'
astronomer/astro-cli crit unable to find 'v1.18' - use 'latest' or see https://github.com/astronomer/astro-cli/releases for details
neel@Neels-MacBook-Pro astro-cli % 

Ideal output:

neel@Neels-MacBook-Pro astro-cli % bash godownloader.sh -- v1.18
astronomer/astro-cli info checking GitHub for tag 'v1.18'
astronomer/astro-cli info found version: 1.18.2 for v1.18.2/darwin/arm64
astronomer/astro-cli info installed ./bin/astro
neel@Neels-MacBook-Pro astro-cli %

Copy link
Contributor

@neel-astro neel-astro left a comment

Choose a reason for hiding this comment

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

Left a minor comment on one of the edge case

godownloader.sh Outdated
version=$(curl https://api.github.com/repos/${owner_repo}/releases/latest -s | tr -s '\n' ' ' | sed 's/.*"tag_name": "//' | sed 's/".*//')
elif [[ "$version" =~ ^v[0-9]+\.[0-9]+$ ]]; then
elif [ $version = ^v[0-9]+\.[0-9]+$ ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might need to continue to use double brackets, in order to support regex in the elif clause. Any reason to change this as well?

It is supposed to support a case when users try to send in a request to install a version without mentioning the patch number, then that logic would pick up the latest patch for the mentioned version.

The ideal output would be that v1.18.2 is installed when we pass v1.18, but with the current change, it is not able to find any version.

neel@Neels-MacBook-Pro astro-cli % bash godownloader.sh -- v1.18
astronomer/astro-cli info checking GitHub for tag 'v1.18'
astronomer/astro-cli crit unable to find 'v1.18' - use 'latest' or see https://github.com/astronomer/astro-cli/releases for details
neel@Neels-MacBook-Pro astro-cli % 

Ideal output:

neel@Neels-MacBook-Pro astro-cli % bash godownloader.sh -- v1.18
astronomer/astro-cli info checking GitHub for tag 'v1.18'
astronomer/astro-cli info found version: 1.18.2 for v1.18.2/darwin/arm64
astronomer/astro-cli info installed ./bin/astro
neel@Neels-MacBook-Pro astro-cli %

Copy link
Contributor

@neel-astro neel-astro left a comment

Choose a reason for hiding this comment

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

LGTM

@kushalmalani kushalmalani merged commit 10ba7e2 into main Aug 29, 2023
@kushalmalani kushalmalani deleted the version-check-fix branch August 29, 2023 15:14
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.

3 participants