-
Notifications
You must be signed in to change notification settings - Fork 43
Provide a syntax for repeating a block with a Job configuration for each item in a list #26
Comments
I think this would be better served with something like this (more or less stolen from ansible): - project:
name: foo
jobs:
- '{{name}}-thing':
with_overrides:
- env: f1,
- env: l1,
- env: d1 That would take the job entry '{{name}}-thing' and execute it passing in each element of the array. That way the used job has the exact same syntax as if the jobs were declared not in a 'loop'. Would that still work for you? |
That would work just as well. I like include the name of the env I'm I had also imagined that this looping could be used as a crude form of
|
Do we want to append something to the job name similar to how PRs work? Otherwise we risk errors due to several jobs having the same name. Something like foo-env-{{env_val}} |
I think that the generator should raise an error if the names won't be unique. Or, at least if one of the passed vars isn't in the name. I'm not sure what would make sense to have it automagically add. |
Won't having the user modify the name cause scoping issues (Or my idea of how scope works is incorrect for this)?
Env is undefined in the scope that {{name}}-thing-{{env}} is used, so the job {{name}}-thing-{{env}} cannot be referenced in the jobs section. If we append to the name something like {{name}}-thing-{{override_key}}-{{override_value}} we can reference the job like the below snippet, similar to how the PR generators work:
But generated jobs would have the name foo-thing-env-f1, foo-thing-env-l1, foo-thing-env-d1 |
The resolution happens in two parts. First the generator tries to find the job by the unresolved name, then it substitutes all the variables in. So, as long as the overrides are added to the variables by that point everything should work. Currently, you should be able to override a variable thats in a name. jobs:
- '{{name}}-thing':
name: first
- '{{name}}-thing':
name: second That should work right now, the idea here would be to remove the duplication of having to specify the job more than once. |
Here is one idea of how this could be done. It would generate a Release Stage multi-job with sub jobs for l1,f1, and d1.
In project.yaml
In Job-Release-Stage.yaml
The text was updated successfully, but these errors were encountered: