ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 308 - AZ-400 discussion

Report
Export

You have a project in Azure DevOps.

You create the following YAML template named Template1.yml.

steps:

- script: npm install

- script: yarn install

- script: npm run compile

You create the following pipeline named File1.yml.

parameters: usersteps: - task: MyTask@1

- script: echo Done

You need to ensure that Template1.yaml runs before File1.yml.

How should you update File1.yml?

A.
parameters: usersteps: extends: template: template1.yml- task: MyTask@1 - script: echo Done
Answers
A.
parameters: usersteps: extends: template: template1.yml- task: MyTask@1 - script: echo Done
B.
template: template1.yml parameters: usersteps:- task: MyTask@1 - script: echo Done
Answers
B.
template: template1.yml parameters: usersteps:- task: MyTask@1 - script: echo Done
C.
extends: template: templatel.yml parameters: usersteps:- task: MyTask@1 - script: echo Done
Answers
C.
extends: template: templatel.yml parameters: usersteps:- task: MyTask@1 - script: echo Done
D.
parameters: usersteps: - template: templatel.yml- task: MyTask@1 - script: echo Done
Answers
D.
parameters: usersteps: - template: templatel.yml- task: MyTask@1 - script: echo Done
Suggested answer: C

Explanation:

Azure Pipelines offers two kinds of templates: includes and extends. Included templates behave like #include in C++: it's as if you paste the template's code right into the outer file, which references it. To continue the C++ metaphor, extends templates are more like inheritance: the template provides the outer structure of the pipeline and a set of places where the template consumer can make targeted alterations.

Example: extends: template: template.yml@templates parameters: usersteps:

- script: echo This is my first step - script: echo This is my second step

Reference: https://docs.microsoft.com/en-us/azure/devops/pipelines/security/templates

asked 02/10/2024
RODRIGO BALISTA
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first