Created
August 24, 2019 05:43
-
-
Save justinyoo/41e3c56debe1eaa0bb1d0ac062bb38b9 to your computer and use it in GitHub Desktop.
Azure DevOps Pipelines Refactoring Technics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- stage: BuildWithJobsTemplate | |
displayName: 'Build with Jobs Template' | |
variables: | |
- name: Greeting | |
value: 'Hello World' | |
jobs: | |
- template: 'template-jobs-build.yaml' | |
parameters: | |
vmImage: 'vs2017-win2016' | |
message: 'This is from the jobs template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
variables: | |
- name: Greeting | |
value: "G'day, mate" | |
... | |
stages: | |
... | |
- template: 'template-stages-nested-build.yaml' | |
parameters: | |
vmImage: 'macOS-10.13' | |
message: 'This is from the nested stages template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
variables: | |
- name: Greeting | |
value: "G'day, mate" | |
... | |
stages: | |
... | |
- template: 'template-stages-build.yaml' | |
parameters: | |
vmImage: 'ubuntu-16.04' | |
message: 'This is from the stages template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- stage: BuildWithStepsTemplate | |
displayName: 'Build with Steps Template' | |
jobs: | |
- job: HostedVs2017 | |
displayName: 'Hosted VS2017' | |
pool: | |
name: 'Hosted VS2017' | |
workspace: | |
clean: all | |
variables: | |
- name: Greeting | |
value: 'Hello World' | |
steps: | |
- template: 'template-steps-build.yaml' | |
parameters: | |
message: 'This is from the steps template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- stage: BuildWithoutTemplate | |
displayName: 'Build without Template' | |
jobs: | |
- job: HostedVs2017 | |
displayName: 'Hosted VS2017' | |
pool: | |
name: 'Hosted VS2017' | |
workspace: | |
clean: all | |
variables: | |
- name: Greeting | |
value: 'Hello World' | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: 'Write-Host "$(Greeting)"' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- stage: ReleaseWithJobsTemplate | |
displayName: 'Release with Jobs Template' | |
variables: | |
- name: Greeting | |
value: 'Hello World' | |
jobs: | |
- template: 'template-jobs-release.yaml' | |
parameters: | |
templateLevel: jobs | |
vmImage: 'vs2017-win2016' | |
message: 'This is from the jobs template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- template: 'template-stages-nested-release.yaml' | |
parameters: | |
templateLevel: nested-stages | |
vmImage: 'macOS-10.13' | |
message: 'This is from the nested stages template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- template: 'template-stages-release.yaml' | |
parameters: | |
templateLevel: stages | |
vmImage: 'ubuntu-16.04' | |
message: 'This is from the stages template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- stage: ReleaseWithStepsTemplate | |
displayName: 'Release with Steps Template' | |
jobs: | |
- deployment: HostedVs2017 | |
displayName: 'Hosted VS2017' | |
pool: | |
name: 'Hosted VS2017' | |
environment: release-with-steps-template | |
variables: | |
- name: Greeting | |
value: 'Hello World' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- template: 'template-steps-release.yaml' | |
parameters: | |
message: 'This is from the steps template' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipeline.yaml | |
... | |
stages: | |
... | |
- stage: ReleaseWithoutTemplate | |
displayName: 'Release without Template' | |
jobs: | |
- deployment: HostedVs2017 | |
displayName: 'Hosted VS2017' | |
pool: | |
name: 'Hosted VS2017' | |
environment: release-without-template | |
variables: | |
- name: Greeting | |
value: 'Hello World' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: 'Write-Host "$(Greeting)"' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-jobs-build.yaml | |
parameters: | |
vmImage: '' | |
message: '' | |
jobs: | |
- job: TemplatedJob | |
displayName: 'Templated Job' | |
pool: | |
vmImage: '${{ parameters.vmImage }}' | |
workspace: | |
clean: all | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: | | |
Write-Host "$(Greeting)" | |
Write-Host "${{ parameters.message }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-jobs-nested-build.yaml | |
parameters: | |
vmImage: '' | |
message: '' | |
jobs: | |
- job: NestedBuildJob | |
displayName: 'Nested Build Job on ${{ parameters.vmImage }}' | |
pool: | |
vmImage: '${{ parameters.vmImage }}' | |
workspace: | |
clean: all | |
steps: | |
- template: 'template-steps-build.yaml' | |
parameters: | |
message: '${{ parameters.message }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-jobs-nested-release.yaml | |
parameters: | |
templateLevel: '' | |
vmImage: '' | |
message: '' | |
jobs: | |
- deployment: NestedDeploymentJob | |
displayName: 'Nested Deployment Job on ${{ parameters.vmImage }}' | |
pool: | |
vmImage: '${{ parameters.vmImage }}' | |
environment: release-with-${{ parameters.templateLevel }}-template | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- template: 'template-steps-release.yaml' | |
parameters: | |
message: '${{ parameters.message }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-jobs-release.yaml | |
parameters: | |
templateLevel: '' | |
vmImage: '' | |
message: '' | |
jobs: | |
- deployment: TemplatedRelease | |
displayName: 'Templated Release' | |
pool: | |
vmImage: '${{ parameters.vmImage }}' | |
environment: release-with-${{ parameters.templateLevel }}-template | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: | | |
Write-Host "$(Greeting)" | |
Write-Host "${{ parameters.message }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-stages-build.yaml | |
parameters: | |
vmImage: '' | |
message: '' | |
stages: | |
- stage: BuildWithStagesTemplate | |
displayName: 'Build with Stages Template' | |
jobs: | |
- job: TemplatedStage | |
displayName: 'Templated Stage' | |
pool: | |
vmImage: '${{ parameters.vmImage }}' | |
workspace: | |
clean: all | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: | | |
Write-Host "$(Greeting)" | |
Write-Host "${{ parameters.message }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-stages-nested-build.yaml | |
parameters: | |
vmImage: '' | |
message: '' | |
stages: | |
- stage: BuildWithNestedStagesTemplate | |
displayName: 'Build with Nested Stages Template' | |
jobs: | |
- template: 'template-jobs-nested-build.yaml' | |
parameters: | |
vmImage: '${{ parameters.vmImage }}' | |
message: '${{ parameters.message }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-stages-nested-release.yaml | |
parameters: | |
templateLevel: '' | |
vmImage: '' | |
message: '' | |
stages: | |
- stage: ReleaseWithNestedStagesTemplate | |
displayName: 'Release with Nested Stages Template' | |
jobs: | |
- template: 'template-jobs-nested-release.yaml' | |
parameters: | |
templateLevel: '${{ parameters.templateLevel }}' | |
vmImage: '${{ parameters.vmImage }}' | |
message: '${{ parameters.message }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-steps-build.yaml | |
parameters: | |
message: '' | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: | | |
Write-Host "$(Greeting)" | |
Write-Host "${{ parameters.message }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template-steps-release.yaml | |
parameters: | |
message: '' | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: | | |
Write-Host "$(Greeting)" | |
Write-Host "${{ parameters.message }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tmplate-stages-release.yaml | |
parameters: | |
templateLevel: '' | |
vmImage: '' | |
message: '' | |
stages: | |
- stage: ReleaseWithStagesTemplate | |
displayName: 'Release with Stages Template' | |
jobs: | |
- deployment: TemplatedStage | |
displayName: 'Templated Stage' | |
pool: | |
vmImage: '${{ parameters.vmImage }}' | |
environment: release-with-${{ parameters.templateLevel }}-template | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Echo Greeting in PowerShell' | |
inputs: | |
targetType: Inline | |
script: | | |
Write-Host "$(Greeting)" | |
Write-Host "${{ parameters.message }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment