Todilo
Todilo

Reputation: 1333

Add to default parameter in Azure Devops template

I have a project that uses a template:

Extracted relevant part of the template:

parameters:
  - name: buildArguments
    type: string
    default: 'here are my default build arguments'
  - task: DotNetCoreCLI@2
    displayName: 'Build'
    inputs:
      command: 'build'
      configuration: '${{ parameters.buildConfiguration }}'
      arguments: '${{ parameters.buildArguments }}'
      projects: |
        ${{ parameters.buildProjectNames }}

I want to keep the default buildArguments string and just concatenate/add project specific parts to it. How can I do that?

Part of my project pipeline

- template: build/templates/MyTemplate.yml@templates
  parameters:
    buildArguments: defaultvalue + myProjectSpecificArgumentsHere

Upvotes: 0

Views: 622

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41575

You can use the join expression:

arguments: ${{ join('DEFAULT-VALUE',parameters.buildProjectNames) }}

(remove the default value from the parameters).

Upvotes: 1

Related Questions