├── template-steps-build.yaml ├── template-steps-release.yaml ├── template-stages-nested-build.yaml ├── template-jobs-nested-build.yaml ├── template-stages-nested-release.yaml ├── template-jobs-build.yaml ├── template-jobs-nested-release.yaml ├── template-stages-build.yaml ├── template-jobs-release.yaml ├── template-stages-release.yaml ├── LICENSE ├── README.md ├── pipeline.yaml └── .gitignore /template-steps-build.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | message: '' 3 | 4 | steps: 5 | - task: PowerShell@2 6 | displayName: 'Echo Greeting in PowerShell' 7 | inputs: 8 | targetType: Inline 9 | script: | 10 | Write-Host "$(Greeting)" 11 | Write-Host "${{ parameters.message }}" 12 | -------------------------------------------------------------------------------- /template-steps-release.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | message: '' 3 | 4 | steps: 5 | - task: PowerShell@2 6 | displayName: 'Echo Greeting in PowerShell' 7 | inputs: 8 | targetType: Inline 9 | script: | 10 | Write-Host "$(Greeting)" 11 | Write-Host "${{ parameters.message }}" 12 | -------------------------------------------------------------------------------- /template-stages-nested-build.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | vmImage: '' 3 | message: '' 4 | 5 | stages: 6 | - stage: BuildWithNestedStagesTemplate 7 | displayName: 'Build with Nested Stages Template' 8 | 9 | jobs: 10 | - template: 'template-jobs-nested-build.yaml' 11 | parameters: 12 | vmImage: '${{ parameters.vmImage }}' 13 | message: '${{ parameters.message }}' 14 | -------------------------------------------------------------------------------- /template-jobs-nested-build.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | vmImage: '' 3 | message: '' 4 | 5 | jobs: 6 | - job: NestedBuildJob 7 | displayName: 'Nested Build Job on ${{ parameters.vmImage }}' 8 | 9 | pool: 10 | vmImage: '${{ parameters.vmImage }}' 11 | 12 | workspace: 13 | clean: all 14 | 15 | steps: 16 | - template: 'template-steps-build.yaml' 17 | parameters: 18 | message: '${{ parameters.message }}' 19 | -------------------------------------------------------------------------------- /template-stages-nested-release.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | templateLevel: '' 3 | vmImage: '' 4 | message: '' 5 | 6 | stages: 7 | - stage: ReleaseWithNestedStagesTemplate 8 | displayName: 'Release with Nested Stages Template' 9 | 10 | jobs: 11 | - template: 'template-jobs-nested-release.yaml' 12 | parameters: 13 | templateLevel: '${{ parameters.templateLevel }}' 14 | vmImage: '${{ parameters.vmImage }}' 15 | message: '${{ parameters.message }}' 16 | -------------------------------------------------------------------------------- /template-jobs-build.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | vmImage: '' 3 | message: '' 4 | 5 | jobs: 6 | - job: TemplatedJob 7 | displayName: 'Templated Job' 8 | 9 | pool: 10 | vmImage: '${{ parameters.vmImage }}' 11 | 12 | workspace: 13 | clean: all 14 | 15 | steps: 16 | - task: PowerShell@2 17 | displayName: 'Echo Greeting in PowerShell' 18 | inputs: 19 | targetType: Inline 20 | script: | 21 | Write-Host "$(Greeting)" 22 | Write-Host "${{ parameters.message }}" 23 | -------------------------------------------------------------------------------- /template-jobs-nested-release.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | templateLevel: '' 3 | vmImage: '' 4 | message: '' 5 | 6 | jobs: 7 | - deployment: NestedDeploymentJob 8 | displayName: 'Nested Deployment Job on ${{ parameters.vmImage }}' 9 | 10 | pool: 11 | vmImage: '${{ parameters.vmImage }}' 12 | 13 | environment: release-with-${{ parameters.templateLevel }}-template 14 | 15 | strategy: 16 | runOnce: 17 | deploy: 18 | steps: 19 | - template: 'template-steps-release.yaml' 20 | parameters: 21 | message: '${{ parameters.message }}' 22 | -------------------------------------------------------------------------------- /template-stages-build.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | vmImage: '' 3 | message: '' 4 | 5 | stages: 6 | - stage: BuildWithStagesTemplate 7 | displayName: 'Build with Stages Template' 8 | 9 | jobs: 10 | - job: TemplatedStage 11 | displayName: 'Templated Stage' 12 | 13 | pool: 14 | vmImage: '${{ parameters.vmImage }}' 15 | 16 | workspace: 17 | clean: all 18 | 19 | steps: 20 | - task: PowerShell@2 21 | displayName: 'Echo Greeting in PowerShell' 22 | inputs: 23 | targetType: Inline 24 | script: | 25 | Write-Host "$(Greeting)" 26 | Write-Host "${{ parameters.message }}" 27 | -------------------------------------------------------------------------------- /template-jobs-release.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | templateLevel: '' 3 | vmImage: '' 4 | message: '' 5 | 6 | jobs: 7 | - deployment: TemplatedRelease 8 | displayName: 'Templated Release' 9 | 10 | pool: 11 | vmImage: '${{ parameters.vmImage }}' 12 | 13 | environment: release-with-${{ parameters.templateLevel }}-template 14 | 15 | strategy: 16 | runOnce: 17 | deploy: 18 | steps: 19 | - task: PowerShell@2 20 | displayName: 'Echo Greeting in PowerShell' 21 | inputs: 22 | targetType: Inline 23 | script: | 24 | Write-Host "$(Greeting)" 25 | Write-Host "${{ parameters.message }}" 26 | -------------------------------------------------------------------------------- /template-stages-release.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | templateLevel: '' 3 | vmImage: '' 4 | message: '' 5 | 6 | stages: 7 | - stage: ReleaseWithStagesTemplate 8 | displayName: 'Release with Stages Template' 9 | 10 | jobs: 11 | - deployment: TemplatedStage 12 | displayName: 'Templated Stage' 13 | 14 | pool: 15 | vmImage: '${{ parameters.vmImage }}' 16 | 17 | environment: release-with-${{ parameters.templateLevel }}-template 18 | 19 | strategy: 20 | runOnce: 21 | deploy: 22 | steps: 23 | - task: PowerShell@2 24 | displayName: 'Echo Greeting in PowerShell' 25 | inputs: 26 | targetType: Inline 27 | script: | 28 | Write-Host "$(Greeting)" 29 | Write-Host "${{ parameters.message }}" 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Dev Kimchi (https://devkimchi.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Azure Pipelines Template Sample # 2 | 3 | This provides sample YAML pipeline templates for Azure DevOps. 4 | 5 | 6 | ## Contribution ## 7 | 8 | Your contributions are always welcome! All your work should be done in your forked repository. Once you finish your work with corresponding tests, please send us a pull request onto our `master` branch for review. 9 | 10 | 11 | ## License ## 12 | 13 | This is released under [MIT License](http://opensource.org/licenses/MIT) 14 | 15 | > The MIT License (MIT) 16 | > 17 | > Copyright (c) 2019 [DevKimchi](https://devkimchi.com) 18 | > 19 | > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 20 | > 21 | > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 22 | > 23 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /pipeline.yaml: -------------------------------------------------------------------------------- 1 | name: $(Version).$(rev:r) 2 | 3 | variables: 4 | - name: Version 5 | value: '1.0.0' 6 | - name: Greeting 7 | value: "G'day, mate" 8 | 9 | trigger: 10 | branches: 11 | include: 12 | - master 13 | 14 | pr: none 15 | 16 | stages: 17 | - stage: BuildWithoutTemplate 18 | displayName: 'Build without Template' 19 | 20 | jobs: 21 | - job: HostedVs2017 22 | displayName: 'Hosted VS2017' 23 | pool: 24 | name: 'Hosted VS2017' 25 | workspace: 26 | clean: all 27 | 28 | variables: 29 | - name: Greeting 30 | value: 'Hello World' 31 | 32 | steps: 33 | - task: PowerShell@2 34 | displayName: 'Echo Greeting in PowerShell' 35 | inputs: 36 | targetType: Inline 37 | script: 'Write-Host "$(Greeting)"' 38 | 39 | - stage: BuildWithStepsTemplate 40 | displayName: 'Build with Steps Template' 41 | 42 | jobs: 43 | - job: HostedVs2017 44 | displayName: 'Hosted VS2017' 45 | pool: 46 | name: 'Hosted VS2017' 47 | workspace: 48 | clean: all 49 | 50 | variables: 51 | - name: Greeting 52 | value: 'Hello World' 53 | 54 | steps: 55 | - template: 'template-steps-build.yaml' 56 | parameters: 57 | message: 'This is from the steps template' 58 | 59 | - stage: BuildWithJobsTemplate 60 | displayName: 'Build with Jobs Template' 61 | 62 | variables: 63 | - name: Greeting 64 | value: 'Hello World' 65 | 66 | jobs: 67 | - template: 'template-jobs-build.yaml' 68 | parameters: 69 | vmImage: 'vs2017-win2016' 70 | message: 'This is from the jobs template' 71 | 72 | - template: 'template-stages-build.yaml' 73 | parameters: 74 | vmImage: 'ubuntu-16.04' 75 | message: 'This is from the stages template' 76 | 77 | - template: 'template-stages-nested-build.yaml' 78 | parameters: 79 | vmImage: 'macOS-10.13' 80 | message: 'This is from the nested stages template' 81 | 82 | - stage: ReleaseWithoutTemplate 83 | displayName: 'Release without Template' 84 | 85 | jobs: 86 | - deployment: HostedVs2017 87 | displayName: 'Hosted VS2017' 88 | pool: 89 | name: 'Hosted VS2017' 90 | 91 | environment: release 92 | 93 | variables: 94 | - name: Greeting 95 | value: 'Hello World' 96 | 97 | strategy: 98 | runOnce: 99 | deploy: 100 | steps: 101 | - task: PowerShell@2 102 | displayName: 'Echo Greeting in PowerShell' 103 | inputs: 104 | targetType: Inline 105 | script: 'Write-Host "$(Greeting)"' 106 | 107 | - stage: ReleaseWithStepsTemplate 108 | displayName: 'Release with Steps Template' 109 | 110 | jobs: 111 | - deployment: HostedVs2017 112 | displayName: 'Hosted VS2017' 113 | pool: 114 | name: 'Hosted VS2017' 115 | 116 | environment: release 117 | 118 | variables: 119 | - name: Greeting 120 | value: 'Hello World' 121 | 122 | strategy: 123 | runOnce: 124 | deploy: 125 | steps: 126 | - template: 'template-steps-release.yaml' 127 | parameters: 128 | message: 'This is from the steps template' 129 | 130 | - stage: ReleaseWithJobsTemplate 131 | displayName: 'Release with Jobs Template' 132 | 133 | variables: 134 | - name: Greeting 135 | value: 'Hello World' 136 | 137 | jobs: 138 | - template: 'template-jobs-release.yaml' 139 | parameters: 140 | templateLevel: jobs 141 | vmImage: 'vs2017-win2016' 142 | message: 'This is from the jobs template' 143 | 144 | - template: 'template-stages-release.yaml' 145 | parameters: 146 | templateLevel: stages 147 | vmImage: 'ubuntu-16.04' 148 | message: 'This is from the stages template' 149 | 150 | - template: 'template-stages-nested-release.yaml' 151 | parameters: 152 | templateLevel: nested-stages 153 | vmImage: 'macOS-10.13' 154 | message: 'This is from the nested stages template' 155 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | --------------------------------------------------------------------------------