Followers

Azure Devops -Azure Pipeline

  Azure pipeline is a process to provide CI/CD pipeline automation process. It has the following compoment. Build Process: - Azure pipeline ...

 


Azure pipeline is a process to provide CI/CD pipeline automation process. It has the following compoment.


Build Process:- Azure pipeline creates a virtual machine( which you can't see in the VMS) and source code ( From Azure Repos) is built on this virtual machine. This virtual machine could be windows/Linux/Mac. It is an intermediate environment to build the application. Once the application is built then this virtual machine is disposed of.

This VM is an agent which is a part of the agent pool and there are different types of agents depending upon which type of VM is selected in the Azure pipeline

Let's Create the first Azure Pipeline using MS-hosted Agent (using the script not the classic editor in this example)

Example-1

1. Select the Azure pipelines and then click on Create Pipeline


2. Select the Azure Repo where the source code is available ( It can be Azure Repo/ Github/Bitbucket etc). You can select Azure Repo in case the code is in the Azure repository.

3. Select the repository where the code is available.

4. Once the repository is selected then it shows the pipeline code so let's replace the code with the below code.

# Agent pool is the collection of vms
# in the below code, ubuntu latest vm image is refered for pipeline to deploy the code
pool:
  vmImage: 'ubuntu-latest'
# Steps are the part of a job which are to be executed on vm
steps:
- bash: echo "Azure Basic Pipeline Code"

5. Click on Save and Run button to run the pipeline, select the branch as master and click on run.

6. Azure pipeline should run a job 



Example -2

Follow the same steps as mentioned above to create a new pipeline using the below code. In this example, there are multiple jobs that are configured in the pipeline

# Agent pool is the collection of vms
# in the below code, ubuntu latest vm image is refered for pipeline to deploy the code
pool:
  vmImage: 'ubuntu-latest'
# jobs to execute the steps on vm
jobs:
- job: Firstjob
  timeoutInMinutes: 10
  steps:
  - bash: echo "The First job"
 
- job: Secondjob
  steps:
  - bash: echo "Our Second Pipeline"


Output




Azure pipeline for an Asp.net Core application

1. In Azure pipelines select New Pipeline.

2. Select Azure Repo which has asp.net core app source code.

3. Select the pipeline build platform (Aspnet core) .NET Framework

4. Write the pipeline code similar to the given below

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
 
# Trigger indicates that whenever there is a change in the master branch then
# this pipeline will be executed automatically
trigger:
- master
 # VM image is windows latest
pool:
  vmImage: 'windows-latest'
 # variables are defined whichare used in the tasks
variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
 # job with multiple steps and steps are furhter having one or multiple tasks
 # NuGetToolInstaller@1 it is inbuilt step to download NuGet tool on the VM
 # NuGetToolInstaller@2 it is inbuilt step to Configure the NugetCommand for the solution (defined as variable)
 # VSBuild@1 to build the solution using MSBuild with given parameters
steps:
- task: NuGetToolInstaller@1
 
- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'
 
- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

5. Save and run the pipeline.

Note:- Change the source code in the master branch and you will notice that the pipeline is executed automatically.


COMMENTS

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
ltr
item
DevOpsWorld: Azure Devops -Azure Pipeline
Azure Devops -Azure Pipeline
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW1sDB_4vq3tCbb5F8KdRqwK4waOR4Qbz8yVUUNWi-B00qDi4fRGw2NcdMQApW21glPol0j6aC5YxU7okVEUWFlLqmKoHHKylnyhvPQoAWDIPy-vkmv_Zc7JOah_LL6Au5v_wxRj_21b4W3dcydirxuRQZtP2AuoO57tSq9HuY1U5P_G4t9ZrjbKnZ/s320/ImportAzureRepos-2.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW1sDB_4vq3tCbb5F8KdRqwK4waOR4Qbz8yVUUNWi-B00qDi4fRGw2NcdMQApW21glPol0j6aC5YxU7okVEUWFlLqmKoHHKylnyhvPQoAWDIPy-vkmv_Zc7JOah_LL6Au5v_wxRj_21b4W3dcydirxuRQZtP2AuoO57tSq9HuY1U5P_G4t9ZrjbKnZ/s72-c/ImportAzureRepos-2.jpg
DevOpsWorld
https://www.devopsworld.co.in/2022/05/azure-devops-continuous-integration_28.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/2022/05/azure-devops-continuous-integration_28.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content