0
votes

I have a pipeline yaml file that runs a series of stages, each of which runs a single deployment job that has been templatized. The code itself is pretty straightforward:

template.yaml

jobs:
- deployment: foo
...

pipeline.yaml

stages:
- stage: Uno
  displayName: Numero_uno
  jobs:
  - job: Foo
    steps:
    - template:  template.yaml
      parameters:
     stuff: things
- stage: Dos
  displayName: Numero_dos
  jobs:
  - job: Foo
    steps:
    - template:  template.yaml
      parameters:
     stuff: things

I've discovered that one of my stages needs some extra scripting run within it, so I want to add some extra jobs to this particular stage:

- stage: Cuarenta_y_dos
  displayName: Numero_cuarenta_y_dos
  jobs:
  - job: prep
    steps:
    - task: ...
  - job: Foo
    steps:
      - template: template.yaml
        parameters:
          stuff: things
  - job: unprep
    steps:
    - task: ...

Doing so breaks the entire pipeline though, as my template is constructed around re-usable jobs and it immediately throws an error about "Unexpected value 'jobs'".

I understand why it's happening, but I'm not sure how to address it. Is what I want to do even possible?