Reputation: 11977
I have a repository of yaml based jobs that I'd like to reuse in a number of yaml script. The script that will use the jobs however are in other repository.
The reusable job takes a file path as an input parameter. And for some reason the file can't be found when the imported job executes by the pipeline.
How do I reference the file in the parameter from the main job so it can be found when executing the imported job?
# MyMainScriptTemplate.yml that will be executed by the pipeline
trigger:
- master
resources:
repositories:
- repository: AzureTemplates
type: git
name: AzureTemplates
jobs:
- template: /FunctionApp/DeployFunctionApp.yml@AzureTemplates
parameters:
file: /Azure/Functions/template.json #This can be found when executing ...
# ReusableJobTemplate.yml defines a job that should be referenced from the main script
parameters:
- name: file
type: string
jobs:
- job: DeployFunctionApp
steps:
- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: "Resource Group"
azureResourceManagerConnection: "Dev"
subscriptionId: "XYZ"
action: "Create Or Update Resource Group"
resourceGroupName: "XYZ"
location: "West Europe"
templateLocation: "Linked artifact"
csmFile: ${{ parameters.file }}
deploymentMode: "Incremental"
displayName: "Run a one-line script"
Upvotes: 0
Views: 992
Reputation: 40899
Please check how mulirepo behaves.
I would recommend you two steps:
- checkout: AzureTemplates
step before calling template/Azure/Functions/template.json
to (Agent.BuildDirectory)/AzureTemplates/Azure/Functions/template.json
Upvotes: 1