Is your feature request related to a problem? Please describe
When building out a task in uds runner, often there could be a need to repeat a set of tasks based on certain criteria, for example package versions, platform or architecture. To facilitate this, the UDS task runner should support some sort of looping or matrix functionality.
Describe the solution you'd like
Take a runner task like the following:
tasks:
- name: packages
description: "Build and publish the UDS packages"
actions:
- description: "Create the UDS Core Standard Zarf Package"
cmd: |
ZARF_ARCHITECTURE=amd64 uds run -f tasks/create.yaml standard-package --no-progress
ZARF_ARCHITECTURE=arm64 uds run -f tasks/create.yaml standard-package --no-progress
- description: "Create the UDS Core Istio Only Zarf Package"
cmd: |
ZARF_ARCHITECTURE=amd64 uds run -f tasks/create.yaml istio-package --no-progress
ZARF_ARCHITECTURE=arm64 uds run -f tasks/create.yaml istio-package --no-progress
- description: "Publish the packages"
cmd: |
zarf package publish build/zarf-package-core-amd64-${VERSION}.tar.zst ${TARGET_REPO}
zarf package publish build/zarf-package-core-arm64-${VERSION}.tar.zst ${TARGET_REPO}
zarf package publish build/zarf-package-core-istio-amd64-${VERSION}.tar.zst ${TARGET_REPO}
zarf package publish build/zarf-package-core-istio-arm64-${VERSION}.tar.zst ${TARGET_REPO}
I should be able to rewrite this as
tasks:
- name: packages
matrix:
ZARF_ARCHITECTURE: [amd64, arm64]
description: "Build and publish the UDS packages"
actions:
- description: "Create the UDS Core Standard Zarf Package"
cmd: |
uds run -f tasks/create.yaml standard-package --no-progress
- description: "Create the UDS Core Istio Only Zarf Package"
cmd: |
uds run -f tasks/create.yaml istio-package --no-progress
- description: "Publish the packages"
cmd: |
zarf package publish build/zarf-package-core-${ZARF_ARCHITECTURE}-${VERSION}.tar.zst ${TARGET_REPO}
zarf package publish build/zarf-package-core-istio-${ZARF_ARCHITECTURE}-${VERSION}.tar.zst ${TARGET_REPO}
- and have the same end result executed as in the former example, except based on the vars provided in `matrix` the tasks should execute in parallel
### Describe alternatives you've considered
We could keep duplicating code and running tasks that could be parallelized, serially.
Additionally, this example should be more than just the flat example i provided above, although this might be fine for an MVP. The functionality should support multiple inputs for example:
```yaml
tasks:
- name: packages
matrix:
ARCH: [amd64, arm64]
PLATFORM:
- Darwin
- Linux
- Windows
actions:
- description: "Create the UDS Core Standard Zarf Package"
cmd: echo "pretend example task"
....
This should run six parallel jobs with the possible combinations of ARCH and PLATFORM provided underneath the matrix key
Is your feature request related to a problem? Please describe
When building out a task in uds runner, often there could be a need to repeat a set of tasks based on certain criteria, for example package versions, platform or architecture. To facilitate this, the UDS task runner should support some sort of looping or matrix functionality.
Describe the solution you'd like
Take a runner task like the following:
I should be able to rewrite this as
This should run six parallel jobs with the possible combinations of ARCH and PLATFORM provided underneath the matrix key
Additional context
Examples of similar functionality in other technologies: gitlab matrix jobs github matrix jobs taskfile loops