当前位置:网站首页>Coding CD of Devops

Coding CD of Devops

2022-06-24 03:13:00 Baoyuanlin

CI Article see :https://cloud.tencent.com/developer/article/1889086

Use Coding stay TKE Initial deployment of the application on , The following steps are required :

  • Configure cloud account
  • Configure the application
  • Configure the deployment process
  • Issuance of bill of lading

Configure cloud account

Only configuration TKE Authentication information of the cluster ,Coding You have the permission to deploy , Thus using Coding CD The first step is to configure the cloud account . As shown in the figure below , stay Coding Select... From the deployment console navigation bar menu 【 Cloud accounts 】, On the cloud account management page, select 【 Bind cloud accounts 】, Select Tencent cloud as the cloud account type TKE, Follow the instructions to complete the cluster binding under the cloud account name .

add-tke-cluster-account.png

NOTE: The deployment console can be accessed through CODING The left navigation bar of the team home page quickly enters , For more help, see :https://help.coding.net/docs/cd/console.html

Configure the application

The application is CODING CD Basic deployment unit in ,Coding The recommended practice is that an application corresponds to a service in the microservice architecture . stay CODING Click... On the left navigation bar of the deployment console 【 application 】 Go to the application page ; Then click on 【 Create an 】 Button , Enter the application name in the pop-up create application dialog box , Deployment mode selection TKE, Then confirm to create an application

add-app-step-2.png

If you want to submit a release form in the project, execute the application release process , You also need to associate the application with a project . The following two figures show how to apply order-service And projects QCBM Association .

guan-lian-project-1.png
guan-lian-project-2.png

Configure the deployment process

be based on TCR Automatic triggering process of

After configuring the cloud account and Application , You can create the deployment process in the deployment console . Here's the picture , Click... On the application page order-service Enter the deployment process page , Select Create process . In the create deployment process dialog box , You can select the deployment template according to your needs . Example order-service The deployment process selects a blank process template .

create-cd-flow.png

Click OK in the above figure , Get into order-service Deployment process edit page . stay 【 Basic configuration 】 in , Add an automatic trigger to the process :TCR Personal warehouse triggers . say concretely , Click on “ Add trigger ” after , Select... In the trigger type “TCR Personal warehouse triggers ”, Then select a good area 、 Namespace 、 Warehouse and other information .

cd-trigger.png

next , Click on 【 Basic configuration 】 Dexter 【 Add phase 】 Button , And select “ Deploy (Manifest)” .

add-deploy-manifest.png

In the deployment (Manifest) Select the cloud account configured above from the basic settings of .

manifest-basic-config.png

Next, we will Manifest To configure ,Coding Two kinds of support manifest source : Use products and Input content .

  • Use products

This method uses the pre written , And upload it to the deployment description file in the code warehouse . such as , The following figure shows the use of order-service Deployment of yaml, The yaml be located Coding Code warehouse qcbm-deployments in ( It's available through the link https://jishufanganzhongxin.coding.net/public/qcbm/qcbm-deployments/git/files/master/deployments/order-service.yaml see ).

manifest-source-git.png
  • Input content

seeing the name of a thing one thinks of its function , Directly input the deployment of the application yaml, As shown in the figure below .

manifest-source-input.png

thus , be based on TCR The automatically triggered deployment process is configured , Save the configuration process as shown in the following figure .

save-cd-flow.png

Manually trigger the deployment process based on approval and confirmation

The last section talked about “ be based on TCR Automatic triggering process of ” For development / Test environment . For the deployment of production environment , Usually very careful , Manual approval is required 、 Post deployment validation 、 And rollback after deployment failure . This section is order-service Create a new deployment process , Realize manual confirmation 、 Rollback and other functions , See the new process shown in the figure below for details order-service-deployment-with-approve.

order-service-deployment-with-approve.png

In the second step of process configuration , choice “ Generic type ” Under the “ Manual confirmation ”, Here's the picture :

add-manual-confirm.png

Then add a manual confirmation message , Including confirmer and confirmation options , Here's the picture :

config-manual-confirm.png

Fill in the confirmation information of the laborer , Add a follow-up “ Deploy Manifest” And named “ Deploy GZ-AZ3”, The configuration is described in the previous section , Skip here .

add-step-deploy-manifest.png

next , Steps in “ Deploy GZ-AZ3” Then add a manual confirmation step , Name it “GZ-AZ3 Deployment confirmation ”, It is used to confirm the deployment results of the three districts in Guangzhou . The following steps will be judged according to the confirmation results of this step , If the confirmation is passed , Continue to deploy the four districts of Guangzhou , Otherwise, roll back to the third district of Guangzhou .

gz-az3-dep-confirm.png

Next , Add the steps to continue to deploy the Fourth District of Guangzhou , For the basic configuration of this step, see... In the previous section “ Deploy Manifest” Description of . The difference is this , This step needs to judge whether to continue according to the confirmation result of the previous step . here , You need to configure... For the step “ Execution Options ”, As shown in the figure below . Here you need to check “ Conditional expression ” And configure the following expression statement :

${#judgment("GZ-AZ3  Deployment confirmation ") == ' Deployment success , Continue deployment  AZ4'}  

Current step “GZ-AZ3 Deployment confirmation ” in , The user selected the option “ Deployment success , Continue deployment AZ4”, Then the above expression is true , This step will continue , Otherwise skip this step .

continue-deploy-az4.png

Next, add a rollback step , stay “GZ-AZ3 Deployment confirmation ” Add a new step after , Type selection “ Roll back (Manifest)”, And named it “ Roll back GZ-AZ3” . Roll back Manifest Configure the cloud account selection AZ3 TKE The cloud account corresponding to the cluster ( See cloud account configuration in Section 2 ); The resource type is selected according to the actual situation , because AZ3 Use K8S Deployment Deployed , So here we choose deployment; Select... From the resource name order-service( If there is no such option , Enter a resource name manually according to the following figure ).

roll-back-basic.png

continue “ Roll back GZ-AZ3” Configuration of . The next step is to configure the number of fallback versions and conditional expressions . The number of fallback versions is 1 , Indicates rollback to the previous version docker Mirror image . The configuration of condition expression is as follows :

${#judgment("GZ-AZ3  Deployment confirmation ") == ' Deployment failed , Roll back  AZ3'}  
roll-back-az3.png

thus , The deployment process with approval and manual confirmation has been configured .

Release sheet

The above describes how to configure the publishing process in the deployment console , When publishing coding A release sheet will be created to record the process and results of each release , Whether the deployment is triggered automatically or manually .

Here's how to Coding Manual deployment in . First , Get into qcbm project , Find... In the navigation bar on the left “ Continuous deployment ”, Re selection “Kubernetes”, The window on the right will all Kubernetes Application deployment process , As shown in the figure below .

order-fabudan.png

In the diagram above , Click on order-service Under the “ Release sheet ” Button , Get into order-service Release list , Here's the picture :

order-fabudan-list.png

In the diagram above , Click on “ New release ” Under the selection box “ Create a new release form ”, Select the deployment process in the pop-up dialog box :order-service-deployment-with-approve, Other configurations remain the default .

manual-new-fabudan.png
原网站

版权声明
本文为[Baoyuanlin]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/10/20211014182503544p.html

随机推荐