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

Task label not reflected in logs when using output prefixed #1750

Open
nathanperkins opened this issue Aug 10, 2024 · 1 comment
Open

Task label not reflected in logs when using output prefixed #1750

nathanperkins opened this issue Aug 10, 2024 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@nathanperkins
Copy link

  • Task version: v3.38.0 (h1:O7kgA6BfwktXHPrheByQO46p3teKtRuq1EpGnFxNzbo=)
  • Operating system: Linux
  • Experiments enabled: None

With task:

...

output: prefixed

tasks:
  build-image:
    label: build-image-{{.IMAGE_NAME}}
    requires:
      vars:
        - IMAGE_NAME
  ...

I expected the logging output to include the image name in the prefixed output, but it does not.

...
task: [build-image-foo] docker build \
...

...
[docker:build-image] #8 CACHED
[docker:build-image]
[docker:build-image] #9 exporting to image
[docker:build-image] #9 exporting layers done
...
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 10, 2024
@nathanperkins
Copy link
Author

nathanperkins commented Aug 10, 2024

I guess this is a dupe of #893 and I need to use prefix instead. But the description of the label field is a bit misleading:

label - Overrides the name of the task in the output when a task is run. Supports variables.

When I read this, I thought for sure "in the output when a task is run" meant the logs.

It's not until you look way down the page that you see prefix, which is what you really want:

prefix - Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is prefixed.

It's surprising that we need to specify the name twice to make the name consistent in the logs and the task summary. Maybe in v4 they could be merged?

At least, I'd suggest clarifying the description of label with something like:

Overrides the name of the task in the output summary when a task is started. Supports variables. Does not prefix log lines (see 'prefix' field instead).

If that description sounds good, I can make the change :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants