1
votes

I am trying to convert classic Azure pipelines to YAML.

however, I couldn't find any documents on how can I have an environment deployment utilize a previous build artifact? i.e. if we build and deploy to dev, after testing how can we build that exact same artifact of the build to another environment (such as integration or staging slot)? I don't want to do a whole build again as then we will have a different code base if changes were made in master in the meantime.

I that something possible with YAML pipeline, if so should I approach to implement this?

2

2 Answers

1
votes

Your YAML pipeline can specify what resources it needs. You can specify an existing build or another pipeline.

resources:
  pipelines:
  - pipeline: SmartHotel-resource # identifier for the resource (used in pipeline resource variables)
    source: SmartHotel-CI # name of the pipeline that produces an artifact

see:

As an alternative, you can create a multi-stage pipeline. Where your pipeline specifies both the build as well as the deployment steps:

stages:
- stage: A
  jobs:
  - job: A1
  - job: A2

- stage: B
  jobs:
  - job: B1
  - job: B2 

See:

0
votes

Is that something possible with YAML pipeline, if so should I approach to implement this?

Download artifact task will be auto injected only in the deploy hook for deployment jobs. To stop downloading artifacts, use - download: none or choose specific artifacts to download by specifying Download Pipeline Artifact task.

You can refer to the document about descriptions of lifecycle hooks and Artifacts in release and deployment jobs.