You have a project in Azure DevOps. Template1.yml contains the following steps: npm install, yarn install, and npm run compile. File1.yml currently defines a parameter usersteps and includes tasks MyTask@1 and a script to echo Done. You must ensure that Template1.yml is executed before File1.yml. How should you update File1.yml?
Choose an answer
Tap an option to check your answer.
Correct answer: extends: template: templatel.yml parameters: usersteps: - task: MyTask@1 - script: echo Done.
Why this is the answer
The extends keyword is used to reference a template that serves as the base for the current YAML file, effectively executing the extended template first. In this case, extends: template: template1.yml ensures that Template1.yml runs before the steps defined in File1.yml. The parameters section then passes the usersteps parameter, which includes MyTask@1 and the echo Done script, to the extended template if it's designed to accept such parameters. Incorrect options: The first option incorrectly places extends inside parameters, which is not a valid YAML structure for template extension. The second option uses template at the root level, which is used for inserting templates as steps, not for extending the entire pipeline. This would insert Template1.yml as a step, not execute it as the base. The fourth option incorrectly places template: template1.yml as an item within the usersteps parameter, which is not how template extension is defined.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed