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: url parsing for non git urls: oci://, no protocol (#11816) #11819

Merged
merged 2 commits into from Jan 6, 2023

Conversation

alexef
Copy link
Member

@alexef alexef commented Dec 23, 2022

fixes: #11816
Screenshot 2022-12-23 at 10 03 10
Screenshot 2022-12-23 at 10 03 39

Signed-off-by: Alex Eftimie alex.eftimie@getyourguide.com

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
@alexef
Copy link
Member Author

alexef commented Dec 23, 2022

@crenshaw-dev / @rbreeze please have a look

@alexef alexef added bug Something isn't working breaking/high A possibly breaking change with high impact labels Dec 23, 2022
@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Base: 47.32% // Head: 47.32% // No change to project coverage 👍

Coverage data is based on head (64551ee) compared to base (8f0ef8d).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11819   +/-   ##
=======================================
  Coverage   47.32%   47.32%           
=======================================
  Files         245      245           
  Lines       41545    41545           
=======================================
  Hits        19661    19661           
  Misses      19903    19903           
  Partials     1981     1981           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alexef alexef changed the title bug: fix url parsing for non git urls: oci://, no protocol (#11816) fix: url parsing for non git urls: oci://, no protocol (#11816) Dec 23, 2022
@alexef alexef added this to the v2.6 milestone Dec 23, 2022
@RomanBats
Copy link

Looks good to me, can we merge it? 😅

@alexef alexef requested a review from rbreeze January 4, 2023 14:15
try {
const parsed = GitUrlParse(url);
} catch {
// URL Parsing failed
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you like to print error on the console log?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, tbh this function should not be invoked for non-git sources, so console.log would not help on the long term.
I didn't have time to investigate why this is called, made the fix just to unblock 2.6

const parsed = GitUrlParse(url);
} catch {
// URL Parsing failed
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of null should an empty string be returned?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, see line 43, null is expected

Copy link
Member

@rbreeze rbreeze left a comment

Choose a reason for hiding this comment

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

LGTM!

@rbreeze rbreeze merged commit 052a5d2 into argoproj:master Jan 6, 2023
@alexef alexef deleted the fix-url-parsing branch January 7, 2023 07:51
@RomanBats
Copy link

So it looks like the "parsed" constant is not visible outside the scope of try and it gets removed:
image
image

@alexef
Copy link
Member Author

alexef commented Jan 9, 2023

@RomanBats so you get this stack trace after the fix was merged? it was working fine on my machine, not sure what is going on.

@RomanBats
Copy link

@alexef, yes, I used this quay.io/argoproj/argocd@sha256:a315769f630c730485c974ff31007fa9aedf9294faf9404d858315d06afd8a18 nightly build.
I am not very good with JS, but maybe my version is optimized and minified.

@woehrl01
Copy link
Contributor

woehrl01 commented Jan 9, 2023

@alexef this definetly is an issue as the const value is block scoped to the try catch.

It should only fail for non oci repos now.

@alexef
Copy link
Member Author

alexef commented Jan 9, 2023

@woehrl01 can you check #11916? - I'm not very good with JS either, hoping this will work correctly now.

crenshaw-dev pushed a commit that referenced this pull request Jan 10, 2023

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
@crenshaw-dev
Copy link
Collaborator

Cherry-picked onto release-2.6 for 2.6.0-rc3.

@alexef alexef removed the breaking/high A possibly breaking change with high impact label Jan 16, 2023
emirot pushed a commit to emirot/argo-cd that referenced this pull request Jan 27, 2023
…proj#11819)

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>
schakrad pushed a commit to schakrad/argo-cd that referenced this pull request Mar 14, 2023
…proj#11819)

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Signed-off-by: schakrad <chakradari.sindhu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2.6 RC1 - 'URL parsing failed' error when opening application sourced from OCI registry (ECR)
6 participants