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

Variable with list of namespace names for included files #1862

Open
postlund opened this issue Oct 11, 2024 · 0 comments
Open

Variable with list of namespace names for included files #1862

postlund opened this issue Oct 11, 2024 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@postlund
Copy link

I quite often end up in this situation when building monorepos using task:

version: "3"

includes:
  app1: ./app1
  app2: ./app2
  app3: ./app3
  app4: ./app4

vars:
  APPS:
    - app1
    - app2
    - app3
    - app4

tasks:
  build:
    deps:
      - for: { var:  APPS }
        task: "{{ .ITEM }}:build"

  clean:
    deps:
      - for: { var:  APPS }
        task: "{{ .ITEM }}:clean"

  test:
    deps:
      - for: { var:  APPS }
        task: "{{ .ITEM }}:test"

The same kind of pattern might exist in multiple places within a repository (e.g. for applications, libraries, test tools, etc.). It's OK syntax as it's quite easy to add new entries by just updating (in this case) APPS. But it would be very convenient with a variable containing the namespace name of all includes in the current file. So I basically could write something like this:

version: "3"

includes:
  app1: ./app1
  app2: ./app2
  app3: ./app3
  app4: ./app4

tasks:
  build:
    deps:
      - for: { var:  INCLUDE_NAMESPACES }
        task: "{{ .ITEM }}:build"

  clean:
    deps:
      - for: { var:  INCLUDE_NAMESPACES }
        task: "{{ .ITEM }}:clean"

  test:
    deps:
      - for: { var:  INCLUDE_NAMESPACES }
        task: "{{ .ITEM }}:test"

In the long run, it would also be convenient to have some kind of wildcard support for includes as well (to make this situation even more automagic). But that's out of scope for this request.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Oct 11, 2024
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