-
Notifications
You must be signed in to change notification settings - Fork 19
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 CLI Client Handling Non-Interactive Terminal and Error Message for Non-Canonical Repo #247
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Linostar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -49,12 +49,16 @@ func InferBuildMetadata() BuildMetadata { | |||
// use regex to match the repo location | |||
regex := regexp.MustCompile("github.com[:/](canonical/.*).git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should only match "Push URL: ..." (even without ".git"), because there can be the case the the developer pulls from upstream and updates the repo in canonical. (Suggested by @clay-lake )
if len(matches) < 2 { | ||
fmt.Fprintf(os.Stderr, "oci-factory must be called in a git local repository under organization [canonical]\n") | ||
os.Exit(1) | ||
} | ||
source := matches[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we should use matches[0]
and if len(matches) == 1
to match with this change.
Ping the @canonical/rocks team.
Description
This PR fixes the following issues: