Docker4dotnet #5 Use VSTS/TFS to build a container-based continuous delivery pipeline,

Source: Internet
Author: User
Tags docker hub docker registry

Docker4dotnet #5 Use VSTS/TFS to build a container-based continuous delivery pipeline,

In the past several d4d series, I have introduced how to use docker to support application development and packaging of asp.net core. The cross-platform development capability of Asp.net core is. net developers provide the ability to use containers for application development, this article describes how to use Microsoft's full lifecycle management platform VSTS/TFS to build a container-based CI/CD pipeline to support team development scenarios.

#1 hello, past, present, and World
#2 containerized hosts
#3 Use Visual Studio Code and Docker on macOS to develop asp.net core and mysql applications
#4 Use Azure cloud storage to build a high-speed Docker registry

Visual Studio Team Services/Team Foundation Server

VSTS/TFS is a full-lifecycle management platform provided by the Microsoft Visual Studio product group to developers. Visual Studio Team Service (VSTS) it is a development platform built on Microsoft's public cloud Azure platform with an Saas architecture. It provides end-to-end management capabilities for Small and Medium-sized teams and large teams across regions in the software development process, this platform is free for small teams with less than five development teams (with any number of managers involved at the same time, VSTS distinguishes between stakeholder and developer roles, provides a free access permission for stakeholder, who only need to manage the process without modifying the code ). The Team Foundation Server is an enterprise edition of VSTS. It can be independently deployed in a private cloud or data center by an enterprise and provides the same functional experience as VSTS.

For more information about VSTS and TFS functions, see this blog or related articles in the public account. The links are as follows:

Http://devopshub.cn/tag/vsts/

Container-based CI/CD

The main problem solved by the container technology is the consistency of the environment and the migration of applications of the same version in different environments. Although it provides a more efficient development mode for a single developer, however, the role of containers in team development and management of development/testing/pre-production/production environments will be more valuable. All the technical staff engaged in software development know that it is very difficult to maintain a uniform environment for different developers/testers during the development process, many problems in the process are caused by inconsistent environments. Containers are an effective way to solve this problem.

To build container-based CI/CD, we need the following tool chain:

Demonstrate the relationship and workflow of the above tool chain

We can see that to build a complete release tool, we need a multi-level technical stack. The Docker container tool reduces the complexity of the underlying environment and application technology stack, this makes the release process easier.

Next we will look at how to configure such a set of container-based CI/CD Environment

1. Create a containerized host as a development/test/production environment

For more information about how to create containerized hosts in the development environment to support encoding and debugging, see

#1 hello, past, present, and World

For more information about how to create a container-based host in a cloud environment to support testing and production, see

#2 containerized hosts

2. Configure TFS build proxy on Linux Server

For more information about how to configure a proxy on a Linux server, see

Build an iOS continuous integration environment with VSTS/TFS

3. Connect the containerized host to TFS

Go to the TFS background and clickService | new service endpoint | Dcoker Host

Container host url, and ~ The content of the pem file in the/. docker/machine/machines/{machine-name} directory is copied to the configuration page according to the following link.

Repeat the preceding process to bind the container host configuration in the user test and production environments, and create the following docker host endpoint

○ Dockerhost-test
○ Dockerhost-pro

4. Connect the docker hub account to TFS

Go to the TFS background and clickService | create a service endpoint | Docker Registry

Enter your docker hub user name, password, and email address. If you use a private registry, update the Docker Regsitry address.

5. Configure CI Definitions

Create a production definition and point the default proxy queue to the corresponding build proxy queue on the Linux Server

Add the following build tasks in the build process:

Specifically
A. dotnet restore
B. dotnet build
C. dotnet publish
D. docker build
E. docker push

The detailed configuration of the docker build procedure is as follows. Note that $ (Build. buildNumber) This environment variable is used as the tag of the container image, so that we can use a unified build number to manage different versions of the container image.

The following is the detailed configuration of docker push. This step uploads the built container to docker hub and uses $ (Build. BuildNumber) as the version number tag.

6. Create a CD publishing Pipeline

Create the following release pipeline configuration to specify the deployment steps for the test environment and production respectively.

In each environment, perform the following steps:
○ Stop running container
○ Remove container
○ Run container

The test environment and production environment respectively use different containerized host connections (the connections created in step 1-2 ).

7. Configure the upgrade policy from the test environment to the production environment

The following configuration requires that the production environment can be deployed only when the test environment is successfully deployed.

The following configuration requires that the deployment of the production environment must be approved by a specific user before execution.

So far, we have completed the container-based CI/CD release pipeline configuration.

 

Follow the public account devopshub to obtain

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.