reboottime / Azure-Journey

This repository tracks my azure platform journey systematically.
0 stars 0 forks source link

Azure Devops Solution #9

Open reboottime opened 9 months ago

reboottime commented 9 months ago

Overview

Revisit Azure DevOps as a software development automation solution, to have a systematic understanding.

Other than providing a higher overview of Azure Devops platform, this article also delves the main concepts of Azure pipeline, including

This article is built upon this tutorial


FAQs:

image



image
reboottime commented 9 months ago

Azure Pipeline

Azure supports yaml language to define your code pipeline, which means your pipeline can be part of your code.


There are some main concepts in Azure pipeline


We will explore those concepts by use applications.


The Basics Example

The basic syntax of azure pipeline configuration

trigger:
- main


Bellow is an example of pipeline configuration using yaml language

image
reboottime commented 9 months ago

Azure Pipeline Jobs

1. When you will want to use jobs in pipeline configuration

In some scenarios, you want to test your application on different environments, for example, test your application in Linux and Windows environment.

Yet you do not want to wait for too long for the pipeline to run through, the solution is to define jobs such that your pipeline can be run on two different environment in parallel.

For the above scenario, we will introduce three main concepts

image

2. Illustrations on using job


image



VS

image




For the above example( the second screenshot), each job runs on a different environment and has its own step(s)


image
reboottime commented 9 months ago

Azure Artifacts

Artifacts are the deliverable file(s) that we use to publish our (part of) application(s).

Artifacts differ based on the programming language used for writing the application, for example,

we use zipped file(s) and upload the application deployment environment and unzip the file then deploy the app. This step involves in archive the built artifacts using @ArchiveFiles@1 task, for example, archive the a website's landing page output artifacts built with nextjs SSR code.


- task: ArchiveFiles@1
  displayName: Generate landing page build package
  inputs:
    rootFolder: '$(Build.SourcesDirectory)/landing/out/'
    includeRootFolder: false
    archiveType: 'default'
    archiveFile: '$(Build.ArtifactStagingDirectory)/landing.zip'
    replaceExistingArchive: true

However, in the modern software development we use Docker as artifacts



The container registry way

image image
reboottime commented 9 months ago

Stages in Azure pipeline

image image

What is stage

reboottime commented 9 months ago

Each stage are different, for example, in deployment stage, we do not check out source code from git.

Strategies to deploy code

Usually, we do not deploy code directly to production

We test the code gradually and deploy code gradually.

image



Based on the above strategy, we can have different stages in our pipeline, for example, as follows

image
reboottime commented 9 months ago

Templates in Azure Pipelines

Template is a reusable configuration that you can reuse it in different stages, for example

image
reboottime commented 9 months ago

Azure supports create environment for you for different purposes, here is where you can find the UI exposure to create environment manually


image


Then you can configure your azure pipeline based on different enviroments

image
reboottime commented 9 months ago

Services connections

The cases that we want to connect services to azure Devops workflow


image

Azure has UI exposures to support add credential connections manually

image