Pipeline is a solution that automatically build, test and deploy an application. We can split Pipeline to (CI) and (CD) Pipelines.
CI – Continous Integration
CD – Continous Delivery/Deployment
CI – helps maintain code quality by catching errors early in the development process.
CD – streamlines the process of delivering code changes to production environments efficiently and reliably.
Use it in practice!
Today, I’ll show you how to use Azure DevOps Pipeline to deploy your application.
To follow this tutorial, go to Azure DevOps and create a new project.
I created a new organization named “pawelmajewskiblog” and a project named “Pipeline example“.
Now, let’s create a sample WebAPI application that we want to deploy using Azure Pipelines.
[WebApiProject - Minimal API] Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
var startDate = DateTime.Now;
var pipelineVariable = Environment.GetEnvironmentVariable("pipeline_variable");
app.MapGet("/", () =>
{
return new { startDate, pipelineVariable };
})
.WithName("GetVersion")
.WithOpenApi();
app.Run();
This application contains one endpoint named GetVersion, which returns the start date of the application (startData) and the pipeline variable (pipelineVariable) that we will set in the pipeline.
Azure DevOps Pipeline in practice
What is Pipeline?
Pipeline is a solution that automatically build, test and deploy an application. We can split Pipeline to (CI) and (CD) Pipelines.
CI – Continous Integration
CD – Continous Delivery/Deployment
CI – helps maintain code quality by catching errors early in the development process.
CD – streamlines the process of delivering code changes to production environments efficiently and reliably.
Use it in practice!
Today, I’ll show you how to use Azure DevOps Pipeline to deploy your application.
To follow this tutorial, go to Azure DevOps and create a new project.
I created a new organization named “pawelmajewskiblog” and a project named “Pipeline example“.
Now, let’s create a sample WebAPI application that we want to deploy using Azure Pipelines.
[WebApiProject - Minimal API] Program.cs
This application contains one endpoint named GetVersion, which returns the start date of the application (startData) and the pipeline variable (pipelineVariable) that we will set in the pipeline.
Localhost response is presented below.
Push code to the repository
You can add .gitignore file https://raw.githubusercontent.com/github/gitignore/main/VisualStudio.gitignore.
When our repository is ready, we can go to the next step.
Create first pipeline
Go to the
And click “Create Pipeline”.
Select your repository, I’ll choose “Azure Repos Git”
Use the script for pipeline presented below
When you save this pipeline configuration file, then pipeline runs automatically for the first time.
When the pipeline finishes its work, you will be notified by email.
We’ll also receive an email when the build fails.
Archives
Understanding K-Nearest-Neighbors (KNN) – Essential Machine Learning Algorithm
2024-10-06A Step-by-Step Guide to Web Scraping for Beginners
2024-07-12Categories
Meta