Azure DevOps Flashcards
What is variable group in Azure DevOps?
It is variable group which you define in Azure DevOps and choose as per the environment
What the different between stages and jobs in the Azure Pipeline
A stage is one or more jobs, which are units of work assignable to the same machine. You can arrange both stages and jobs into dependency graphs. Examples include “Run this stage before that one” and “This job depends on the output of that job.”
```yaml
Pipeline
Stage A
Job 1
Step 1.1
Step 1.2
…
Job 2
Step 2.1
Step 2.2
…
Stage B
…
~~~
What is branch policies and approvals?
Similar to branch protections and CODEOWNER file. Number of approvals on PR
If Azure pipeline is running, you need to cancel it. Azure doesn’t allow you to cancel. How to you troubleshoot it
IAM for Azure DevOps, cancel right
Allow stop build, check notion
YAML Pipeline, what is trigger. How to configure to run on certain branch
Trigger pipeline on Azure DevOps, it will ask you on UI which branch you need to run the pipeline
Another way is code, in the trigger, specify the branch which you want this pipeline to run
Branch name as parameter
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/trigger?view=azure-pipelines
```yaml
trigger:
batch: true
branches:
include:
- features/*
exclude:
- features/experimental/*
paths:
exclude:
- README.md
pool:
vmImage: ‘ubuntu-latest’
steps: - task: Maven@3 inputs: mavenPomFile: 'pom.xml' mavenOptions: '-Xmx3072m' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false testResultsFiles: '**/surefire-reports/TEST-*.xml' goals: 'package'
~~~
YAML Pipeline, deploy to dev on feature branch, deploy to prod on Main branch
Azure Pipeline YAML have expressions
variables: - group: PROD - name: env ${{ if eq(variables['Build.SourceBranchName'], 'master') }}: value: a ${{ else }}: value: b
steps:
- script: |
echo ‘$(name)’
echo ‘$(env)’
~~~
~~~
Strategy use of pipeline? Strategy keyword use in the pipeline YAML.
Strategy in the pipeline are two type
- Matrix
- Parallel
Matrix: It will run number of parallel jobs base on number of rows in the matrix and each job will do what configure in the matrix row block
Parallel: Simply run same job in parallel, e.g. load generator in performance testing