Other

Azure DevOps: Dry Run a Pipeline with the Preview REST API

Jaliya Udagedara Jaliya Udagedara
Other

Until now the only way to see what a YAML pipeline really turns into was to queue it. The Preview REST API does a dry run instead: Azure DevOps compiles the YAML exactly as for a real run and returns the resulting finalYaml, without creating any run.

Key points

  • The endpoint is a POST to /_apis/pipelines/{pipelineId}/preview with previewRun=true (api-version 7.1).
  • Parameter values go in templateParameters, the same way as when queueing a run.
  • The response carries a single finalYaml property with expressions resolved and steps wrapped in a default stage and job.
  • A script step becomes the CmdLine@2 task and the pool is moved down to the job during compilation.
  • An invalid parameter value fails with the same PipelineValidationException a real run would raise.
  • yamlOverride previews uncommitted YAML, and resources.repositories.self.refName previews another branch.

Real-world use

  • Diffing a feature branch's finalYaml against main before merging
  • Validating uncommitted YAML edits without queueing a run
  • Catching invalid values for required parameters early

This summary was generated by the agent from the original post on Jaliya Udagedara. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message