Azure_DevOps - kamialie/knowledge_corner GitHub Wiki

Contents

Devops

Azure DevOps service:

  • Boards
  • Repositories
  • Pipelines
  • Test plans
  • Artifacts

Boards

Support Agile, Scrum, Basic, CMMI project management methodologies.

Pipelines

Some parts can be omitted. If there is only a single stage, stages can be omitted. Same with jobs.

Extentions marketplace

  • Replace Token - replaces variables with values inside custom declared variable tags (f.r. #{ and #}); can specify root directory and match pattern for files to consider

Templates can be used for repeatable steps. Save common tasks in steps block in separate yaml file and include it in main pipeline file using template keyword.

Agent

Agent pools are configured on organization level. It is possible to add local machine to the pool (default->add agent). Need to pass access token, which can be created for account (top right corner, security).

Agent root directory organization:

_work
|
|-- 1
    |-- a
    |-- b
    |-- s
  • 1 - stands for build number
  • a - artifacts directory
  • b - binaries directory, can be specified to be used as a placement for binary files
  • s - source files directory

To be able to specify particular agent directly add custom variable to the agent (agent pool -> particular agent -> Capabilities -> Add new capability). System capability can be used too, but it could be present in another one as well. Set variable value to true. Now refer to this agent as follows (no equals part would check just the existence of a variable):

pool:
  name: default
  demands: VARIABLE_NAME -equals true

Triggers

Docs

Types:

  • repository
  • resource
  • scheduled

Disable triggers:

trigger: none

Trigger path filter in UI - start with / to specify based on root. Wildcards are not supported.

Variables

Docs

Stored as strings and are mutable. Scoped to root, stage, or job-level, depending where defined. System variables are read-only. Pipeline variables are created in pipeline UI (top-right corner) and can be stored as secret as well. Better idea to use variable groups for storing secret data.

Variable syntax (accessing):

  • macro $(var) - used during runtime, after template expansion
  • template expression ${{ variable.var }} - processed at compile time and replaced before runtime starts
  • runtime $[variable.var] - expanded at runtime

Output variables - ?

Predifined variables.

Variable group

Job

Run on an agent in a pool; can use dependsOn and condition to control run; continueOnError can be used to specify if job failure is pipeline failure.

By default jobs run in parallel.

Task

Build-in tasks:

  • Build - .NET, Ruby, Java, Docker
  • Utility - Archiving, Scripts, Bash
  • Test - App Center, Visual Studio Test
  • Packaging - containers, .NET Core package, Ant
  • Deployment - Azure ARM, AWS
  • Other - install 3rd party tools, like Docker CLI, Helm, Go

Stage

Logical grouping of jobs. Can manage parallel execution or execution on a specific agent. May run on a different agent than a previous stage.

stages:
- stage: string
  displayName: string
  dependsOn: string | [ string ]
  condition: string
  variables: # several syntaxes
  jobs: [ job | templateReference ]

Artifacts