Pass variable to task from plan?

Is it possible to pass a variable to a template in the yaml?

Example:

task-build-crosstools: &task-build-crosstools
  platform: linux
  image_resource:
    type: registry-image
    source: { repository: haiku/general-worker }
  inputs:
    - name: haiku-git
    - name: buildtools-git
  run:
    path: /bin/sh
    args:
      - -c
      - |
        ls -la
        cd crosstools.((arch))
        ../haiku-git/configure --build-cross-tools ((arch)) ../buildtools-git -j2
  outputs:
    - name: crosstools.((arch))

# Jobs
jobs:
  - name: buildtools-((branch))
    public: true
    plan:
      - in_parallel:
        - get: haiku-git
          trigger: false
        - get: buildtools-git
          trigger: true
      - task: compile jam
        config:
          << : *task-build-jam
      - task: compile arm crosstools       
        config:
          << : *task-build-crosstools
      - task: compile x86 crosstools       
        config:
          << : *task-build-crosstools
      - task: compile riscv64 crosstools       
        config:
          << : *task-build-crosstools

In the example above, could I pass the “((arch))” var to each common task?

Hi @kallisti5. Welcome to the forum!

The ((var)) syntax only works in the pipeline.yml - not in any external task files. You can read more about it in Stark & Wayne’s great tutorial. If your task config is in-line in the pipeline then what you’re proposing should work. You can see some examples of external vs in-line task here.