Azure/Azure Devops + az extension
What is Azure DevOps:
- Azure Repos - SCM/VCS system hosted in Azure
- Azure Pipelines - Build, test, release automations
- Azure Boards - Kanban board; JIRA like to track work, code defects, issues using Kanban or Scrum
- Azure Test Plans
- Azure Artifacts - share Maven, npm, NuGet from private and public sources
dotnet commands reference
dotnet restore **/*.csproj # Restores the dependencies and tools of a project dotnet build # Builds a project and all of its dependencies dotnet test **/*[Tt]ests/*.csproj # .NET test driver used to execute unit tests dotnet publish # Publishes the application and its dependencies to a folder for deployment to a hosting system
az-cli with azure-devops extension
<syntaxhighlightjs lang="bash"> az extension list az extension show --name azure-devops az extension add --name azure-devops [
{ "experimental": false, "extensionType": "whl", "name": "azure-devops", "path": "/home/piotr/.azure/cliextensions/azure-devops", "preview": false, "version": "0.18.0" }
] az login # login to get subscription level authentication az devops login # login to Azure DevOps Token: **** # <- generate a token in AzureDevops > UserSerrings > Personal tokens
- Optional set default organization and project, or add them per each command
az devops configure --defaults organization=https://dev.azure.com/contoso project=ContosoWebApp
- List all repos
- Linux
az repos list --organization=https://dev.azure.com/contoso/ --project=ContosoWebApp --query '[].{Name:name, Url:remoteUrl}' -o json | jq -r .[].Name
- PowerShell
(az repos list --query '[].{Name:name, Url:remoteUrl}' -o json | ConvertFrom-Json) | %{ git clone $_.Url } </syntaxhighlightjs>
Azure pipeline agents
Software included:
Environment:
# Default working directory, also where repos get cloned $(Build.SourcesDirectory): /home/vsts/work/1/s # Published artifacts cd ../name-of-artifact/ # Layout $pwd; cd .. # level up from pwd drwxr-xr-x 7 vsts docker 4096 Sep 1 22:11 . drwxr-xr-x 7 vsts root 4096 Sep 1 22:11 .. drwxr-xr-x 2 vsts docker 4096 Sep 1 22:11 TestResults drwxr-xr-x 2 vsts docker 4096 Sep 1 22:11 a # pipeline artifact dir drwxr-xr-x 2 vsts docker 4096 Sep 1 22:11 b # ? drwxr-xr-x 2 vsts docker 4096 Sep 1 22:11 s # source directory often $PWD, where the repo code gets checked out drwxr-xr-x 6 vsts docker 4096 Sep 1 22:11 name-of-artifact
Pipeline variables
Variables are available in expressions as well as scripts; see variables to learn more about how to use them. There are some predefined build and release variables you can also rely on. Syntax
regionName : "${{ variables.aws_region }}" regionName : $(aws_region)
Resources
- Code Assessment Tools
- Security Tools
- SonarCloud
- SonarAnalyzer
- FxCop - check your code for security, performance, and design issues by Microsoft