YAML pipelines
Comprehensive documentation on YAML schema for Azure Pipelines is available on Microsoft's Azure DevOps documentation pages.
An example azure-pipelines.yml is available below:
1
trigger:
2
- master
3
4
resources:
5
- repo: self
6
7
variables:
8
dockerRegistryServiceConnection: '$(Your-GUID)'
9
imageRepository: '$(Your-Repo-Name)'
10
containerRegistry: '$(Your-Registry-Name)'
11
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
12
manifestfilePath: '$(Build.SourcesDirectory)/manifests/**/*'
13
namespaceApp: '$(Your-Name)'
14
tag: '$(Build.BuildId)'
15
vmImageName: 'ubuntu-latest'
16
17
stages:
18
- stage:
19
jobs:
20
- job:
21
pool:
22
vmImage: $(vmImageName)
23
steps:
25
inputs:
26
serviceConnectionEndpoint: 'Snyk'
27
testType: 'app'
28
monitorOnBuild: true
29
failOnIssues: true
31
inputs:
32
command: 'buildAndPush'
33
repository: $(imageRepository)
34
dockerfile: $(dockerfilePath)
35
containerRegistry: $(dockerRegistryServiceConnection)
36
tags: |
37
$(tag)
39
inputs:
40
action: 'deploy'
41
kubernetesServiceConnection: '$(Your-Name)'
42
namespace: '$(namespaceApp)'
43
manifests: '$(manifestfilePath)'
44
containers: '$(tag)'
Copied!
The example above is only a reference. Your pipeline may differ. In this example, we are scanning our source code in Azure Repo, pushing a container image to ACR, and deploying to AKS. The Snyk Scan is defined in lines 24-29 above.
Export as PDF
Copy link
Edit on GitHub