I'm trying to create two pipeline templates used to integrate with an API which 1) installs an application 2) deploys the application to some devices that the API administers. The install template handles the install and gets back an application ID that the deploy template will require in order to deploy the app. There is no way to query the API later on to get the app ID so I must make it available for the install template for use later on by the deploy template. The install task will be called once, but the deploy task can be called multiple times for different device "rings".
I need to support the following scenario where the deploy template can have a dependency on both a job in the current stage, and can be dependent on the same job in a later stage.
stages:
- stage: NonProd
jobs:
- template: install.yml@pipeline_template
- template: deploy.yml@pipeline_template
- stage: Prod
dependsOn: NonProd
jobs:
- template: deploy.yml@pipeline_template
I read we can do create these types of dependencies now here, but is it possible to set the dependencies to come from either a prior stage or a prior job?
I considered trying to combine these into a single template, but unfortunately if the same version of the app already exists the install step will not provide the app id back, just an error.