Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML Extend Stage Template #568

Open
deckerbr1979 opened this issue Jun 6, 2022 · 0 comments
Open

YAML Extend Stage Template #568

deckerbr1979 opened this issue Jun 6, 2022 · 0 comments

Comments

@deckerbr1979
Copy link

deckerbr1979 commented Jun 6, 2022

Hello All,

Looking to try and get some help figuring out a solution to what seems like a simple task. I am trying to develop some extend YAML templates for security within our ADO pipelines but first I have to get passed this error I am experiencing.

The error being returned by ADO when I try to validate or run the pipeline is "/ADO_Stage_Restrictions_Dev.yml@AdoRestrictions (Line: 7, Col: 3): Unexpected value 'job'".

Working Extend Template YAML
This template validates and executes without issue, which to me means I am successfully passing the stages object into the extends template

parameters:
  - name: stageObjs
    type: stageList
    default: []

stages:
- ${{ each stage in parameters.stageObjs }}:
    ${{ stage }}
  

Broken Extend Template YAML
This template does not validate and throws the 'Unexpected value job' exception. based on the stage schema I would assume that I would be able to loop the jobs property within the stage.

parameters:
  - name: stageObjs
    type: stageList
    default: []

stages:
- ${{ each stage in parameters.stageObjs }}:
  - ${{ each job in stage.jobs }}:
      ${{ job }}

Build YAML

The main yaml file that extends stages

resources:
  repositories:
    - repository: self
      type: git
      ref: refs/heads/Development
      
    - repository: AdoRestrictions
      type: git
      name: utl-yaml-templates
      ref: refs/heads/main

trigger: none

pool:
    name: PROD    

extends:
  template: ADO_Stage_Restrictions_Dev.yml@AdoRestrictions
  parameters:
    stageObjs:
      - stage: 'BuildStage'
        displayName: 'Build Test'
        jobs:
          - job: 'BuildJob'
            displayName: 'Build'
            steps:
            - task: PowerShell@2
              displayName: 'Hello World'
              inputs:
                targetType: inline
                script: |
                  Write-Host "Hello World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant