Azure-devops-docs: How to map complex objects?

Created on 21 Feb 2020  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

We have example in this page:

azure-pipelines.yml

jobs:

  • template: process.yml
    parameters:
    pool: # this parameter is called pool
    vmImage: ubuntu-latest # and it's a mapping rather than a string

process.yml

parameters:

  • name: 'pool'
    type: object
    default: {}

jobs:

  • job: build
    pool: ${{ parameters.pool }}

But how to map demands with pool object?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-cictech devopprod doc-bug stale-issue

All 6 comments

@VerdonTrigance -- thank you for your question. You may find answers here:

May I pass template to another template's parameter?

steps.yml

steps:

  • powershell: |
    write-host "do specific stuff here"

tmplt-stage-deploy2dev.yml

parameters:

  • name: stagename
  • name: wspsteps
    type: stepList
    stages: #some general stuff here

azure-pipelines.yml

stages:

  • template: ..\tmplt-stage-deploy2dev.yml
    parameters:
    stagename: Deploy2Dev
    wspsteps: #how to pass first template here

How to do this?

We have example in this page:

azure-pipelines.yml

jobs:

  • template: process.yml
    parameters:
    pool: # this parameter is called pool
    vmImage: ubuntu-latest # and it's a mapping rather than a string

process.yml

parameters:

  • name: 'pool'
    type: object
    default: {}

jobs:

  • job: build
    pool: ${{ parameters.pool }}

But how to map demands with pool object?
```yaml

  • template: process.yml
    parameters:
    pool:
    demands:
    - myCustomCapability
    vmImage: ubuntu-latest

May I pass template to another template's parameter?

steps.yml

steps:

  • powershell: |
    write-host "do specific stuff here"

tmplt-stage-deploy2dev.yml

parameters:

  • name: stagename
  • name: wspsteps
    type: stepList
    stages: #some general stuff here

azure-pipelines.yml

stages:

  • template: ..\tmplt-stage-deploy2dev.yml
    parameters:
    stagename: Deploy2Dev
    wspsteps: #how to pass first template here

How to do this?

```yaml
stages:

  • template: ..\tmplt-stage-deploy2dev.yml
    parameters:
    stagename: Deploy2Dev
    wspsteps:
    - template: steps.yml

This issue hasn't been updated in more than 180 days, so we've closed it. If you feel the issue is still relevant and needs fixed, please reopen it and we'll take another look. We appreciate your feedback and apologize for any inconvenience.

Was this page helpful?
0 / 5 - 0 ratings