Skip to content

Can't override jobs.yml parameters like disableComponentGovernance from job #8440

@akoeplinger

Description

@akoeplinger
  • This issue is blocking
  • This issue is causing unreasonable pain

Given a .yml like this:

stages:
- stage: build
  jobs:
  - template: /eng/common/templates/jobs/jobs.yml
    parameters:
      jobs:
      - job: Build_Linux
        timeoutInMinutes: 120
        disableComponentGovernance: true    # <--- this causes an error
        steps:
        ....

results in an Azure Pipelines error:

/eng/common/templates/jobs/jobs.yml (Line: 45, Col: 3): 'disableComponentGovernance' is already defined

If I read it correctly this happens because this code passes along parameters from jobs.yml into the job.yml so we end up with one disableComponentGovernance from jobs.yml and one from the job:

jobs:
- ${{ each job in parameters.jobs }}:
- template: ../job/job.yml
parameters:
# pass along parameters
${{ each parameter in parameters }}:
${{ if ne(parameter.key, 'jobs') }}:
${{ parameter.key }}: ${{ parameter.value }}

The same happens with the other parameters that are forwarded, like continueOnError etc.

/cc @mmitche

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions