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

When calling a subtask, the passed variable cannot directly overwrite the value in the subtask, which is inconsistent with the document description. #1597

Open
QianChenglong opened this issue Apr 17, 2024 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@QianChenglong
Copy link

image image

If use the template default method, cannot use shell commands to obtain the default value.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Apr 17, 2024
@MarioSchwalbe
Copy link
Contributor

Hi, this is because point 1 (variables declared in the task definition) has precedence. You can use the default function in something like this:

build:
  vars:
    PARAM: '{{ .PARAM | default "foo" }}'
    GOARCH_DEFAULT: { sh: go env GOARCH }
    GOARCH: '{{ .GOARCH | default .GOARCH_DEFAULT }}'
  cmds:
    - echo {{.GOARCH}} {{.PARAM}}

In case of GOARCH, you would need a helper variable, because this cannot be combined with sh:.

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

3 participants