Tag Archives: Azure DevOps

Azure DevOps release pipeline

Some days ago I wrote a blog post about Azure release Pipelines (CD) and how we can’t use YAML in that. The only option is to do it visually with designer. If I compare this with GitHub workflows, there we can write CI and CD both in YAML syntax.

After that I found a blog post from Microsoft dev blog saying we can use YAML for CD in Azure Pipelines as well. Designing a release pipeline visually with designer, is a legacy way of doing CD now.

Azure DevOps release pipeline

I recently did some work with Azure DevOps pipeline. It is very powerful in terms of CI CD of software projects. But there is one thing which I did not liked about the release pipeline.

The release pipeline cannot be created with yaml code. It can be created visually which is great for one time creation. But if you need to create same pipeline multiple times or you want to store it in your source control then it is not possible. It can be possible to create the CI pipeline with yaml and store in source control but why can’t be done with release pipeline that I am not sure. I found it is a big disadvantage in Azure DevOps.

Docker with Azure DevOps

Sample YAML file to build and push Docker image with Azure Pipelines.

- main

  vmImage: ubuntu-latest

  buildConfiguration: 'Release'

- script: dotnet restore
  displayName: 'Restore'

- script: dotnet build -c $(buildConfiguration) --no-restore
  displayName: 'Build'

- script: dotnet test -c $(buildConfiguration) --no-build
  displayName: 'Test'

- script: dotnet publish '[csproj location]' -c $(buildConfiguration) -o '[publish folder]'
  displayName: 'Publish'

- script: docker build -f '[Dockerfile location]' -t [server/image-name:tag] .
  displayName: 'Create docker image'

- script: |
    docker login [server] -u [user name] -p $(ACR-PWD) # This is from pipeline variable
    docker push [server/image-name:tag]
    docker logout [server]
  displayName: 'Push docker image'