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

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

Open
fornfrey opened this issue Mar 21, 2024 · 3 comments · May be fixed by #663
Assignees

Comments

@fornfrey
Copy link

When submitting a workflow with the --wait flag, the process blocks until the workflow is completed. This results in the workflow URL being printed to the output only after workflow completion.

Sample job output to compare the time of logs:

Notice: running command
  time: "2024-03-18T15:26:48.022Z"
  level: INFO
  extraArgs:
  - --wait
Notice: workflow URI
  time: "2024-03-18T15:35:27.592Z"
  level: INFO
  uri: https://argo-workflows/workflows/k6-cloud-cd/my-workflow-1
@dblinkhorn
Copy link
Contributor

dblinkhorn commented Dec 4, 2024

newbie question...is the workflow uri returned by the argo CLI prior to completion when using the --wait flag, for us to access then log?

@fornfrey
Copy link
Author

fornfrey commented Dec 5, 2024

@dblinkhorn We build the URI ourselves from the preconfigured server and namespace, and the workflow name returned by argo cli:

func (a App) outputWithURI(input *bytes.Buffer) (string, string) {
output := strings.TrimSuffix(input.String(), "\n")
matches := nameRe.FindStringSubmatch(output)
if len(matches) != 2 {
a.logger.Warn("Couldn't find workflow name in output - can't construct URI for launched workflow")
return "", output
}
uri := fmt.Sprintf("https://%s/workflows/%s/%s", a.server(), a.namespace, matches[1])
return uri, output
}
.

I ran a small test that confirmed the name is printed as soon as the workflow is submitted:

❯ argo submit --wait workflow.yaml
Name:                argo-cli-test-28m7t
Namespace:           k6-cloud-cd
ServiceAccount:      unset (will run with the default ServiceAccount)
Status:              Pending
Created:             Thu Dec 05 18:07:28 +0000 (now)
Progress:            
# the workflow is submitted at this point, the process waits for its completion 
argo-cli-test-28m7t Succeeded at 2024-12-05 18:08:11 +0000 GMT  # printed at the very end

Also, I noticed the same can be achieved with 2 consecutive commands:

❯ argo submit workflow.yaml
Name:                argo-cli-test-d8jx8
Namespace:           k6-cloud-cd
ServiceAccount:      unset (will run with the default ServiceAccount)
Status:              Pending
Created:             Thu Dec 05 18:15:04 +0000 (now)
Progress:            
❯ argo wait argo-cli-test-d8jx8
argo-cli-test-d8jx8 Succeeded at 2024-12-05 18:15:47 +0000 GMT

I assume the latter will also make parsing the name from the output easier.

@dblinkhorn
Copy link
Contributor

@fornfrey thanks for this helpful response! I'll get to work on the issue.

@dblinkhorn dblinkhorn self-assigned this Dec 9, 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 a pull request may close this issue.

2 participants