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

feat: print workflow uri immediately even when using --wait flag #663

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dblinkhorn
Copy link
Contributor

No description provided.

@dblinkhorn dblinkhorn requested a review from a team as a code owner December 20, 2024 22:15
@dblinkhorn dblinkhorn changed the title print workflow uri immediately even when using --wait flag feat: print workflow uri immediately even when using --wait flag Dec 20, 2024
Copy link
Contributor

@zerok zerok left a comment

Choose a reason for hiding this comment

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

Looks good 🙂 Just some minor requests.

uri, output := a.outputWithURI(cmdOutput)
uri, out, scanErr := a.outputWithURI(stdoutPipe)
if scanErr != nil {
return uri, out, scanErr
Copy link
Contributor

Choose a reason for hiding this comment

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

Please garbage collect the cmd and the pipe to avoid zombie processes 🙂

Copy link
Contributor Author

@dblinkhorn dblinkhorn Jan 2, 2025

Choose a reason for hiding this comment

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

Thanks for pointing this out. I added a defer function for cleanup. Also, please feel free to nitpick all my PRs since I am very new to Go.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will do :) Regarding the defer: This is now also called in the happy path. IMO it should be enough to just do

_ = stdoutPipe.Close()
_ = cmd.Wait()

in the scanErr case and that's it 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks!

if len(matches) != 2 {
a.logger.Warn("Couldn't find workflow name in output - can't construct URI for launched workflow")
return "", output
matches := nameRe.FindStringSubmatch(line)
Copy link
Contributor

Choose a reason for hiding this comment

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

Even the matching can be skipped if uri is already set, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the flow to address this

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.

trigger-argo-workflow does not print the workflow url until the workflow completion when --wait flag is used
2 participants