Reputation: 1081
I want to use a remote repo template in my azure pipeline. But I want to skip some of the steps included. Note: I dont have access to configure the repote pipeline steps.
The remote yml looks like this build.yml
steps:
- download: none
- checkout: ${{ parameters.checkoutRepo }}
- task: Cache@2
displayName: Cache Maven local repo
- task: Maven@3
displayName: 'Maven: validate'
- task: SonarQubePrepare@4
displayName: 'Prepare analysis on SonarQube'
My yml my-build.yml
resources:
repositories:
- repository: my-remote-repo-above
type: git
name: my-remote-repo-above
.
.
.
stages:
- template: build-stage.yml
parameters:
So my question is, can I somehow specify steps from remote to skip OR there is a way to pick the ones I want to execute only?
Upvotes: 0
Views: 660
Reputation: 30372
Basically, we can define a parameter to your template, and use it in a task condition so that we can skip the specific steps based on the condition.
For example, in build-stage.yml
parameters:
enableSonarCloud: false
steps:
- download: none
- checkout: ${{ parameters.checkoutRepo }}
- task: Cache@2
displayName: Cache Maven local repo
- task: Maven@3
displayName: 'Maven: validate'
- task: SonarQubePrepare@4
condition: and(succeeded(), ${{ parameters.enableSonarCloud }} )
displayName: 'Prepare analysis on SonarQube'
And your build.yml
resources:
repositories:
- repository: my-remote-repo-above
type: git
name: my-remote-repo-above
.
.
.
stages:
- template: build-stage.yml
parameters:
enableSonarCloud: true
But in your scenario, you don't have access to configure the remote template steps. In this case, I don't think you can achieve that if the parameter and task condition is not defined in the template.
Upvotes: 1