User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own...

65
ContainerOps User Guide Issue 01 Date 2020-08-27 HUAWEI TECHNOLOGIES CO., LTD.

Transcript of User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own...

Page 1: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

ContainerOps

User Guide

Issue 01

Date 2020-08-27

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. i

Page 3: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Contents

1 Notes and Constraints............................................................................................................ 1

2 Pipeline Management............................................................................................................ 22.1 Creating a Pipeline Quickly.................................................................................................................................................. 22.2 Creating a Pipeline from a Template................................................................................................................................92.3 Customizing a Pipeline........................................................................................................................................................102.3.1 Creating a Pipeline to Build an Image from Source Code and Perform Gray Deployment.....................102.3.2 Creating a Pipeline to Deploy an Image Using a Helm Chart........................................................................... 212.3.3 Creating a Pipeline to Deploy an Image Using an AOS Template................................................................... 262.3.4 Creating a Pipeline to Conduct a Performance Test..............................................................................................292.3.5 Creating a Pipeline to Conduct a Unit Test.............................................................................................................. 322.4 Basic Pipeline Operations................................................................................................................................................... 37

3 Pipeline Group Management............................................................................................. 43

4 Template Management........................................................................................................46

5 User Permissions....................................................................................................................50

6 Code Source Configuration................................................................................................. 526.1 Binding a Code Source Account....................................................................................................................................... 526.2 Accessing Self-host GitLab from Build Nodes.............................................................................................................55

7 Software Center.....................................................................................................................57

ContainerOpsUser Guide Contents

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

1 Notes and Constraints

ContainerOps subscription is now suspended. If you have subscribed toContainerOps before June 25, 2020, you can continue to use it. Sorry for anyinconvenience caused.

ContainerOpsUser Guide 1 Notes and Constraints

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 1

Page 5: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

2 Pipeline Management

Creating a Pipeline Quickly

Creating a Pipeline from a Template

Customizing a Pipeline

Basic Pipeline Operations

2.1 Creating a Pipeline QuicklyYou can quickly create a pipeline from a preset basic pipeline template, whichincludes stages such as obtaining source code, compiling code, building an image,and deploying an image.

Procedure

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines. On the page displayed, clickCreate Pipeline Quickly (Recommended).

Step 3 Set the basic information of your pipeline as prompted. Then click OK to enter theconfiguration page.● Pipeline Name: Enter a pipeline name that is easy to understand.● Pipeline Group: Select a pipeline group. You can also create a new pipeline

group by clicking Create Pipeline Group.● Language: Select Java, Go, Node.js, or Others.● Source: Select the image build source, namely, Source code repository or

Software package.– Source code repository: You will specify a source code repository from

which source code will be compiled into binary files and then used tobuild an image.

– Software package: You will specify a software package with which animage will be built and pushed to a specified image repository.

● Deployment: (optional) Deploy the image on Cloud Container Engine (CCE).For details on how to configure a deployment stage, see 8.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 2

Page 6: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

NO TICE

● If Language is set to Java, Go, or Node.js, Source can be set to either Sourcecode repository or Software package. If Source is set to Source coderepository, see 5, 6, and 7 for details on how to configure a source coderepository, Jenkins build (in the cloud), and image build stage, respectively. IfSource is set to Software package, see 7 for details on how to configure animage build stage.

● If Language is set to Others, only Source code repository can be set asSource. See 5 and 7 for details on how to configure a source code repositoryand image build stage, respectively.

Step 4 Enter the basic pipeline information.● Pipeline Name: Enter a pipeline name.● Pipeline Group: Select a pipeline group.● Description: Enter a pipeline description.● Execution Result Notification: You can set the pipeline to send notifications

when it is executed abnormally, successfully, or both. If you enable thenotification feature, add notification receivers. Specify who will be notifiedand their email addresses.

● Global Variable: By default, the global variables SYS_TIMESTAMP (pipelinetimestamp) and SYS_INCREMENT (pipeline self-increment) have been preset.To add a new global variable, click Add Global Variable. To use the globalvariables in pipeline configuration and scripts, ensure that the variables are inthe format of ${global variable name}. For example, if you add anenvironment variable named reponame in this table, you can use ${reponame} to obtain the variable value when uploading a software package.

● Topology: topology of the current pipeline. Click the icon of each stage to editthe corresponding stage in the Stage Configuration area.

Step 5 Click the Source Code Repository stage icon in the topology. Configure the stageand click Next.

In Stage Configuration, Type is set to Source Code Repository by default for thisstage.● Code Source: Select the code source. If you have not bound your desired code

source account, bind it by following the instructions described in Binding aCode Source Account.

NO TE

Currently, you can bind your Gitee, GitHub, or GitLab accounts to ContainerOps.

After binding an account, configure the following information:– Namespace: Select the namespace to which the desired code repository

belongs.– Repository Name: Select the desired code repository name.– Branch: Select the desired branch.– Tag: Set this to the tag corresponding to the source code.

● Auto Build: You can choose to trigger the pipeline when either a new imagetag is added or when code is committed to the branch you specified. When

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 3

Page 7: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

the pipeline is triggered, a new image tag is automatically built from thesource code pulled from the bound code source account.– Webhook Mount: A webhook used to trigger the auto build can be

either automatically or manually mounted. If you select Automaticmount, the webhook will be automatically mounted to the code sourcerepository after you enable auto build. If you select Manual mount, copythe URL and secret token displayed to manually create a webhook for thesource code repository. If the code source account you bound does nothave permission to create webhooks, it is advised to select Manualmount and manually create a webhook using an account with sufficientpermission.

● Advanced Settings: You can configure error handling mechanisms, triggerconditions, and notifications, which enable synergy and collaboration betweenpipelines.

NO TICE

All pipeline stages have their own advanced settings so that you canconfigure different error handling mechanisms, trigger conditions, andnotifications for different stages.

– Error Handling Mechanism: The pipeline can return to its first stage,stop and exit when it times out after a specified period of time, or ignorethe error and continue the execution.

– Trigger Conditions: You can trigger the stage through either a webhookor internal invocation. If you select Webhook, click Generate to generatea webhook URL. Copy the URL and use it to trigger the stage. If youselect Internal invocation, select a specific channel to trigger the stage.If you want to add an input parameter for trigger conditions, click AddInput Parameter, set the parameter name, and select a global variable.The value of this parameter is passed to the selected global variablewhen the stage is triggered.Trigger Mode: You can choose to trigger the stage either when all triggerconditions you configured are met or when any one of the triggerconditions is met.

Figure 2-1 Trigger conditions

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 4

Page 8: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

– Notifications: When a stage is executed, result notifications can beautomatically sent through either a webhook or internal invocation. Youcan choose to send notifications when the pipeline is executedsuccessfully, abnormally, or both.

▪ If you select Webhook, specify a notification URL. POST and GET aresupported. You can add headers, request bodies, and parameters.

Figure 2-2 Notification through a webhook

▪ If you select Internal invocation, select a specific channel to sendnotifications. If you want to add an output parameter fornotifications, click Add Output Parameter, set the parameter name,and select a global variable. The value of the selected global variableis passed to this parameter when a notification is sent.

Figure 2-3 Notification through internal invocation

Step 6 Click the Jenkins Build (in the Cloud) stage icon in the topology. Configure thestage and click Next.

In Stage Configuration, Type is set to Jenkins Build (in the Cloud) by default forthis stage.● Input Resources: Code sources and software packages can be added as input

resources.When adding software packages as input resources, specify the softwarepackages in the following format: Organization (mandatory)/Softwarerepository (mandatory)/Software package (mandatory)/Software package

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 5

Page 9: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

version (mandatory)/File (optional). To create new software packages, in thenavigation pane on the left, click Software Center. For details on how tocreate a software package, see Software Center.

● Compiling Environment: environment for compiling source code. You canselect Java, Go, Node.js, or customize your own environment.

● Build Script: script for compiling the source code– Java: A mvn package command is entered by default in the editor.– Go: A go build -o myBuild command is entered by default in the editor.– Node.js: A npm install && npm run build command is entered by

default in the editor.– Customize: You can specify a compiling environment image that suits

you best.● Cache Build: Select whether to enable cache build. When you enable cache

build, Maven, Go, or Node.js cache is used to speed up the image build.● Package Name for Archiving: Enter a name for the software package

compiled from the script, for example, test.jar.● Archiving Path: Specify the software package archiving path in the following

format: Organization (mandatory)/Software repository (mandatory)/Softwarepackage (mandatory)/Software package version (mandatory)/File (optional).If the File field is left blank, the name of the software package to be archivedis used as the file name by default. It is advised to delete unnecessarysoftware packages. Otherwise, archiving may fail when the softwarerepository space is used up.

Step 7 Click the Image Build stage icon in the topology, and configure the stage. If this isthe last stage of your pipeline, click Submit. If you have enabled Deployment in3, click Next to configure the deployment stage.

In Stage Configuration, Type is set to Image Build by default for this stage.● Input Resources: Code sources, images, and software packages can be added

as input resources.When adding images as input resources, specify the images in the followingformat: Organization (mandatory)/Image repository (mandatory)/Tag(mandatory). To upload new images, in the navigation pane on the left, clickImage Repository to go to the Software Repository for Container (SWR)console. Upload images to SWR, then return to the ContainerOps pipelineconfiguration page and select the newly uploaded images as input resources.For details on how to upload images to SWR, see Uploading an ImageThrough a Container Engine Client.When adding software packages as input resources, specify the softwarepackages in the following format: Organization (mandatory)/Softwarerepository (mandatory)/Software package (mandatory)/Software packageversion (mandatory)/File (optional). To create new software packages, in thenavigation pane on the left, click Software Center. For details on how tocreate a software package, see Software Center.

● Build Mode: You can choose to build with either the system defaults or acustomized Dockerfile. If you select System defaults, specify a base image,base image tag, and external service port. If you select Custom Dockerfile,specify a base image and Dockerfile.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 6

Page 10: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

● Base Image: Select Tomcat, Golang, or Java.– Tomcat: The latest Tomcat version is used as the base image. Select this

option if you are using .war packages for image build.– Golang: The latest Golang version is used as the base image. Select this

option if you are using binary files written in Go for image build.– Java: The latest Java version is used as the base image. Select this option

if you are using .jar packages for image build.● Dockerfile: Specify a Dockerfile path or enter script content used for image

build.

NO TE

The default Dockerfile path is ./Dockerfile, indicating files in the current path. TheDockerfile path is a relative path. The source code or software packages specified asinput resources are downloaded to the build path, where the image is built.

● Archiving Path: Specify an image archiving address in the following format:Organization (mandatory)/Image repository (mandatory)/Tag (mandatory).You are advised to manage tags through global variable configuration andreference. To use a specific existing tag, select the tag from the drop-downlist.

Step 8 (Optional. If you have enabled Deployment in 3, this step is mandatory.) Click theOfficial Deployment stage icon in the topology. Configure the stage and clickSubmit.

In Stage Configuration, Type is set to Official Deployment by default for thisstage.● Input Resources: Images can be added as input resources.

The format is as follows: Organization (mandatory)/Image repository(mandatory)/Tag (mandatory). To use new images that are not stored inSWR, push them to SWR first. To be specific, in the navigation pane on theleft, click Image Repository to go to the SWR console. After pushing imagesto SWR, select the newly pushed images as input resources. For details onhow to upload images to SWR, see Uploading an Image Through aContainer Engine Client.

● Deployment Tool:

a. To deploy images on CCE, configure the following parameters asprompted.

▪ Cluster: Select the cluster on which the image is deployed. To createa new cluster, click Create Cluster. You will then be directed to theCCE console to create a cluster.

▪ Namespace: Select the namespace to which the cluster you setabove belongs. To create a new namespace, click CreateNamespace. You will then be directed to the CCE console to create anamespace.

▪ Workload: Select the workload corresponding to the image. Tocreate a new workload, click Create Workload to create one.

▪ Creation Mode: You can choose either Standard or YAML.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 7

Page 11: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

▪ Image Update Policy: (mandatory when Creation Mode is set toStandard) You can set it to Always update or Update upon a tagchange.

▪ Pods: (mandatory when Creation Mode is set to Standard) Amaximum of 300 pods can be added.

▪ Upgrade Policy: (mandatory when Creation Mode is set toStandard) When creating an application, set an upgrade policy.Modification is not allowed once this parameter is set. Exercisecaution when configuring this parameter.○ Rolling upgrade: Old pods are gradually replaced with new

pods. In this process, services are evenly distributed to new andold pods during the upgrade without interrupting services.

○ In-place upgrade: Old pods are deleted before new pods arecreated.

▪ Maximum Number of Unavailable Pods: maximum number ofunavailable pods allowed in a rolling upgrade. If the number is equalto the total number of pods, services may be interrupted. Minimumnumber of alive pods = Total pods – Maximum number ofunavailable pods

▪ CPU Quota: (configurable when Creation Mode is set to Standard)CPU Request: the minimum number of CPU cores requested by acontainer. Containers will run on the nodes with adequate CPUresources. CPU Limit: the maximum number of CPU cores availablefor a container.

▪ Memory Quota: (configurable when Creation Mode is set toStandard) Memory Request: the minimum size of memoryrequested by a container. Containers will run on the nodes withadequate memory resources. Memory Limit: the maximum size ofmemory available for a container.

▪ Manifest: (mandatory when Creation Mode is set to YAML) Edit theYAML manifest file.

● Application Service Configuration: (configurable after you select aworkload) Click Add Service to set the service name, access mode, and portconfiguration.

NO TE

When deploying images on CCE, both newly created workloads and existing workloadsare available for adding new services.

● Advanced Settings: (optional) You can configure Health Check, ContainerLog, Data Storage, Environment Variable, Lifecycle, and APM Settings.– Health Check: Health check regularly checks the health status of

containers or workloads. You can choose Workload Liveness Probe,Workload Readiness Probe, or both. For details about how to configurea health check, see Setting Health Check for a Container.

– Container Log: Log policies are used to collect, manage, and analyzeworkload logs periodically to prevent logs from being over-sized. The

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 8

Page 12: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

default log policy is used when no policies are set. For details about howto set a log policy, see Collecting Standard Output Logs of Containers.

– Data Storage: EVS volumes can be mounted to containers to persist datafiles. By default, only one pod is created for a Deployment with EVSvolumes. For details about how to configure data storage, see Overview.

– Environment Variable: Environment variables can affect the way arunning container behaves. These variables can be modified afterworkload deployment. For details about how to set environmentvariables, see Setting an Environment Variable.

– Lifecycle: A lifecycle script defines the actions to be taken bycontainerized applications when lifecycle events occur. For details abouthow to configure startup commands, see Setting Container StartupCommands.

– APM Settings: Application Performance Management (APM) monitorsand manages the performance of workloads in real time, helping youquickly locate and resolve faults and performance bottlenecks.

----End

2.2 Creating a Pipeline from a TemplateYou can directly and swiftly create a pipeline from an existing template.ContainerOps Template Market provides you with diverse templates covering avariety of scenarios. Table 4-1 lists the templates that are currently available.

ProcedureThis section takes the template Image Build Based on Source Code as an exampleto show how to create a pipeline from a template.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, select Pipelines. On the upper right corner ofthe page, click Create Pipeline from Template.

Step 3 In the navigation pane on the left, select Image Build under Template Market.On the template card Image Build Based on Source Code, click Create Pipeline.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 9

Page 13: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-4 Template Image Build Based on Source Code

Step 4 In the displayed dialog box, set the pipeline name and select a pipeline group. Ifno pipeline group exists, click Create Group to create one, and click OK.

Step 5 Set pipeline information and stage configurations. For details, see Creating aPipeline Quickly.

----End

2.3 Customizing a Pipeline

2.3.1 Creating a Pipeline to Build an Image from Source Codeand Perform Gray Deployment

ContainerOps provides official deployment and gray deployment stages for you toflexibly deploy your applications and streamline the version release process. Table2-1 lists the gray deployment policies supported by ContainerOps pipelines.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 10

Page 14: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Table 2-1 Gray deployment policies

PolicyName

Description Features

Canaryrelease

A certain proportion of productiontraffic on the live network isdistributed to a new version of theapplication to test the version'sperformance and detect faults whileensuring stable running of thesystem.

Feedback on the new version'sperformance in the actualnetwork environment can bequickly obtained. You can usethis to perform finalmodifications on the versionbefore it goes online.

Blue-greendeployment

The blue-green deployment is azero-downtime deployment mode. Anew version of the application isdeployed and tested in a productionenvironment that is not live whilethe live environment continues toserve all production traffic. Whenyou confirm that the new version isfunctioning properly, traffic is thendistributed to the new version. Atthe same time, the old version isupgraded to the new version. Blue-green deployment allows you toquickly switch between the twoversions to effectively avoid servicedisruption during deployment.

Services are not interruptedwhen new versions aredeployed. In addition, nomodifications to the old versionare required. It continues toserve the traffic as usual duringthe release of the new version.You are free to roll back theservice to the old version at anytime provided that you havenot deleted the old versionresources.

This section describes how to perform gray deployment using ContainerOpspipelines. Assume that you want to build an image from source code and performgray deployment using the image.

Procedure

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines. In the upper right corner,click Customize Pipeline.

Step 3 Set the basic pipeline information.● Pipeline Name: Enter a pipeline name that is easy to understand.● Pipeline Group: Select a pipeline group to which this pipeline belongs.● Description: Enter a pipeline description.● Execution Result Notification: You can set the pipeline to send notifications

when it is executed abnormally, successfully, or both. If you enable thenotification feature, add notification receivers. Specify who will be notifiedand their email addresses.

● Global Variable: By default, the SYS_TIMESTAMP (pipeline timestamp) andSYS_INCREMENT (pipeline self-increment) are set. To add a new global

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 11

Page 15: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

variable, click Add Global Variable. To use the global variables in pipelineconfiguration and scripts, ensure that the variables are in the format of ${global variable name}. For example, if you add an environment variablenamed reponame in this table, you can use ${reponame} to obtain thevariable value when uploading a software package.

● Topology: topology of the current pipeline. Click the icon of each stage to editthe corresponding stage in the Stage Configuration area.

Step 4 Click the stage icon (the blue circle) in the topology and add a stage. Set thestage type to Source Code Repository and enter a stage name that is easy tounderstand.

Configure source code repository information.● Code Source: Select the code source. If you have not bound your desired code

source account, bind it by following the instructions described in Binding aCode Source Account.

NO TE

Currently, you can bind your Gitee, GitHub, or GitLab accounts to ContainerOps.

After binding an account, configure the following information:– Namespace: Select the namespace to which the desired code repository

belongs.– Repository Name: Select the desired code repository name.– Branch: Select the desired branch.– Tag: Set this to the tag corresponding to the source code.

● Auto Build: You can choose to trigger the pipeline when either a new imagetag is added or when code is committed to the branch you specified. Whenthe pipeline is triggered, a new image tag is automatically built from thesource code pulled from the bound code source account.– Webhook Mount: A webhook used to trigger the auto build can be

either automatically or manually mounted. If you select Automaticmount, the webhook will be automatically mounted to the code sourcerepository after you enable auto build. If you select Manual mount, copythe URL and secret token displayed to manually create a webhook for thesource code repository. If the code source account you bound does nothave permission to create webhooks, it is advised to select Manual

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 12

Page 16: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

mount and manually create a webhook using an account with sufficientpermission.

● Advanced Settings: You can configure error handling mechanisms, triggerconditions, and notifications, which enable synergy and collaboration betweenpipelines.

NO TICE

All pipeline stages have their own advanced settings so that you canconfigure different error handling mechanisms, trigger conditions, andnotifications for different stages.

– Error Handling Mechanism: The pipeline can return to its first stage,stop and exit when it times out after a specified period of time, or ignorethe error and continue the execution.

– Trigger Conditions: You can trigger the stage through either a webhookor internal invocation. If you select Webhook, click Generate to generatea webhook URL. Copy the URL and use it to trigger the stage. If youselect Internal invocation, select a specific channel to trigger the stage.If you want to add an input parameter for trigger conditions, click AddInput Parameter, set the parameter name, and select a global variable.The value of this parameter is passed to the selected global variablewhen the stage is triggered.Trigger Mode: You can choose to trigger the stage either when all triggerconditions you configured are met or when any one of the triggerconditions is met.

Figure 2-5 Trigger conditions

– Notifications: When a stage is executed, result notifications can beautomatically sent through either a webhook or internal invocation. Youcan choose to send notifications when the pipeline is executedsuccessfully, abnormally, or both.

▪ If you select Webhook, specify a notification URL. POST and GET aresupported. You can add headers, request bodies, and parameters.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 13

Page 17: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-6 Notification through a webhook

▪ If you select Internal invocation, select a specific channel to sendnotifications. If you want to add an output parameter fornotifications, click Add Output Parameter, set the parameter name,and select a global variable. The value of the selected global variableis passed to this parameter when a notification is sent.

Figure 2-7 Notification through internal invocation

Step 5 In the pipeline topology, click next to the current stage to add a new stage.Set the stage type to Image Build and enter a stage name that is easy tounderstand.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 14

Page 18: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Configure image build information.● Input Resources: Code sources, images, and software packages can be added

as input resources.When adding images as input resources, specify the images in the followingformat: Organization (mandatory)/Image repository (mandatory)/Tag(mandatory). To upload new images, in the navigation pane on the left, clickImage Repository to go to the Software Repository for Container (SWR)console. Upload images to SWR, then return to the ContainerOps pipelineconfiguration page and select the newly uploaded images as input resources.For details on how to upload images to SWR, see Uploading an ImageThrough a Container Engine Client.When adding software packages as input resources, specify the softwarepackages in the following format: Organization (mandatory)/Softwarerepository (mandatory)/Software package (mandatory)/Software packageversion (mandatory)/File (optional). To create new software packages, in thenavigation pane on the left, click Software Center. For details on how tocreate a software package, see Software Center.

● Build Mode: The default value is Custom Dockerfile.● Base Image: The default value is Customize.● Dockerfile: Specify a Dockerfile path or enter script content used for image

build.

NO TE

The default Dockerfile path is ./Dockerfile, indicating files in the current path. TheDockerfile path is a relative path. The source code or software packages specified asinput resources are downloaded to the build path, where the image is built.

● Archiving Path: Specify an image archiving address in the following format:Organization (mandatory)/Image repository (mandatory)/Tag (mandatory).You are advised to manage tags through global variable configuration andreference. To use a specific existing tag, select the tag from the drop-downlist.

Step 6 In the pipeline topology, click next to the current stage to add a new stage.Set the stage type to Gray Deployment and enter a stage name that is easy tounderstand.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 15

Page 19: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Configure gray deployment information.● Input Resources: Click Add Input Resource to specify the desired image as

the input resource. The format is as follows: Organization (mandatory)/Imagerepository (mandatory)/Tag (mandatory). To use new images that are notstored in SWR, push them to SWR first. To be specific, in the navigation paneon the left, click Image Repository to go to the SWR console. After pushingimages to SWR, select the newly pushed images as input resources. For detailson how to upload images to SWR, see Uploading an Image Through aContainer Engine Client.

● Deployment Tool: Select CCE and set the following parameters.– Cluster: To create a new cluster, click Create Cluster. You will then be

directed to the CCE console to create a cluster.– Namespace: Select the namespace to which the cluster you set belongs.

To create a new namespace, click Create Namespace. You will then bedirected to the CCE console to create a namespace.

– Workload: Select the workload on which the image is deployed.– Gray Deployment Policy: Select a policy type.

i. Canary release○ Grayscale Version Pods: Specify the number of grayscale

version pods. A maximum of 300 pods can be added. To set aspecific percentage of the number of grayscale version pods tothe total number of pods, select In percentage.

○ Pods: (mandatory when Creation Mode is set to Standard)Specify the number of pods to be added. Enter an integer from 2to 300.

○ Maximum Number of Unavailable Pods: (mandatory whenCreation Mode is set to Standard) maximum number ofunavailable pods allowed in a rolling upgrade. If the number isequal to the total number of pods, services may be interrupted.Minimum number of alive pods = Total pods – Maximumnumber of unavailable pods. To set a specific percentage for themaximum number of unavailable pods to the total number ofpods, select In percentage.

ii. Blue-green deployment○ Pods: (mandatory when the Creation Mode is set to Standard)

A maximum of 300 pods can be added.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 16

Page 20: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

○ Maximum Number of Unavailable Pods: (mandatory whenCreation Mode is set to Standard) maximum number ofunavailable pods allowed in a rolling upgrade. If the number isequal to the total number of pods, services may be interrupted.Minimum number of alive pods = Total pods – Maximumnumber of unavailable pods. To set a specific percentage for themaximum number of unavailable pods to the total number ofpods, select In percentage.

– Creation Mode: You can choose either Standard or YAML.– Image Update Policy: (mandatory when Creation Mode is set to

Standard) You can set it to Always update and Update upon a tagchange.

– Upgrade Policy: (mandatory when Creation Mode is set to Standard)When creating an application, set an upgrade policy. Modification is notallowed once this parameter is set. Exercise caution when configuring thisparameter.

▪ Rolling upgrade: Old pods are gradually replaced with new pods. Inthis process, services are evenly distributed to new and old podsduring the upgrade without interrupting services.

▪ In-place upgrade: Old pods are deleted before new pods arecreated.

– CPU Quota: (configurable when Creation Mode is set to Standard) CPURequest: the minimum number of CPU cores requested by a container.Containers will run on the nodes with adequate resources. CPU Limit: themaximum number of CPU cores available for a container.

– Memory Quota: (configurable when the Creation Mode is set toStandard) Memory Request: the minimum size of memory requested bya container. Containers will run on the nodes with adequate resources.Memory Limit: the maximum size of memory available for a container.

– Manifest: (mandatory when Creation Mode is set to YAML) Edit theYAML manifest file.

● Application Service Configuration: The service name, internal domain nameaccess address, access mode, access port/protocol, and container port/protocolhave been set by default. In the Add Service dialog box, you can modify theaccess protocol. Currently, TCP and UDP are supported for public networkaccess.

NO TICE

Only one service can be added in a gray deployment stage.An access protocol that has taken effect cannot be modified.

● Advanced Settings: (optional) You can configure Health Check, ContainerLog, Data Storage, Environment Variable, Lifecycle, and APM Settings. Fordetails on configuration, see Creating a Pipeline Quickly.

● Gray Deployment Policy Configuration:– Access Port: Select an access port from the drop-down list, for example,

9080.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 17

Page 21: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

NO TICE

The access port cannot be changed after successful deployment.

– Policy Type: You can set this based on either the traffic ratio or requestcontent.

▪ Based on traffic ratio: Specify the traffic ratio for the grayscaleversion and the official version. Service traffic is distributed based onthe weight ratio you configured. For example, 20% of the productiontraffic is distributed to the grayscale version, and 80% is distributedto the official version.

▪ Based on request content: Specify the request filtering criteria forthe grayscale version. Requests meeting the filtering criteria aredistributed to the grayscale version. Requests not meeting the criteriaare distributed to the official version.

Table 2-2 Policies based on request content

Parameter Description

Cookie ○ Full match: Only when the cookie of arequest fully matches the configuredvalues will the request be distributed tothe grayscale version.

○ Regular expression: When the cookie ofa request matches the configured regularexpression, the request will be distributedto the grayscale version.

Header The value supports full match and regularexpression.○ Full match: Only when the header of a

request fully matches the configuredvalue will the request be distributed tothe grayscale version.

○ Regular expression: When the header ofa request matches the configured regularexpression, the request will be distributedto the grayscale version.

OS You can select one or multiple OSs from iOS,Android, Windows, macOS, and Linux.

Browser You can select one or multiple browsers fromChrome, 360, IE, Safari, Sogou, and Edge.

Policy Description A summary of the filtering criteria youspecified for this policy.

Policy that HasTaken Effect

A description of the policy that has takeneffect.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 18

Page 22: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Parameter Description

Configuration File The policy YAML file.

Step 7 In the pipeline topology, click next to the current stage to add a new stage.Set the stage type to Manual Review and enter a stage name that is easy tounderstand.

Configure manual review information. The pipeline enters a pending review statuswhen it begins this stage. In this example, the pipeline waits for manual reviewafter gray deployment.

Figure 2-8 Review mode

● Pass when all reviewers pass: Only when all reviewers you have specifiedapprove that the process is ready for the next stage will the pipeline continueto run.

● Pass when at least one reviewer pass: When any one of the reviewers youhave specified approves that the process is ready for the next stage, thepipeline will continue to run.

Click Add Reviewer to add reviewers and configure their corresponding reviewmode. Click OK.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 19

Page 23: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-9 Add reviewers

Step 8 In the pipeline topology, click next to the current stage to add a new stage.Set the stage type to Official Deployment and enter a stage name that is easy tounderstand.

Confirm the configuration of the official deployment, and click Submit.

NO TICE

The configuration of an official deployment synchronizes with that of the graydeployment. Therefore, if you need to modify the configuration, modify it for thegray deployment.

----End

Related Operations1. When the pipeline in this example finishes performing gray deployment, it

enters the manual review stage and enters a pending review status, as shownin Figure 2-10.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 20

Page 24: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-10 Reviewing a pipeline

– If the pipeline passes the review, it continues to run and enters theOfficial Deployment stage.

– If the pipeline is not approved, it will not enter the next stage, namely,the Official Deployment stage will not be executed.

2. Gray deployment and official deployment stages can be rolled back if theneed arises. For details, see Rolling Back a Pipeline.

NO TE

If you use Blue-green deployment as your gray deployment policy, only graydeployment stages can be rolled back. Official deployment stages cannot be rolledback in this case.

2.3.2 Creating a Pipeline to Deploy an Image Using a HelmChart

Helm is a package management tool for Kubernetes applications. Helm charts arepackages that contain information for installing a set of Kubernetes resources intoa Kubernetes cluster. Helm charts are easy to create, manage, share, and publish,greatly simplifying Kubernetes applications deployment and management. Youcan deploy an image using a Helm chart by adding a Template Deploymentstage in a ContainerOps pipeline.

This section describes how to use a helm chart to deploy an image in aContainerOps pipeline.

Procedure

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines. In the upper right corner,click Customize Pipeline.

Step 3 Set the basic pipeline information.● Pipeline Name: Enter a pipeline name that is easy to understand.● Pipeline Group: Select a pipeline group to which this pipeline belongs.● Description: Enter a pipeline description.● Execution Result Notification: You can set the pipeline to send notifications

when it is executed abnormally, successfully, or both. If you enable thenotification feature, add notification receivers. Specify who will be notifiedand their email addresses.

● Global Variable: By default, the SYS_TIMESTAMP (pipeline timestamp) andSYS_INCREMENT (pipeline self-increment) are set. To add a new globalvariable, click Add Global Variable. To use the global variables in pipelineconfiguration and scripts, ensure that the variables are in the format of ${global variable name}. For example, if you add an environment variable

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 21

Page 25: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

named reponame in this table, you can use ${reponame} to obtain thevariable value when uploading a software package.

● Topology: topology of the current pipeline. Click the icon of each stage to editthe corresponding stage in the Stage Configuration area.

Step 4 Click the stage icon (the blue circle) in the topology and add a stage. Set thestage type to Template Deployment and enter a stage name that is easy tounderstand.

Step 5 Configure the Helm chart deployment information, and click Submit to save thepipeline.● Input Resources: Click Add Input Resource to specify the desired image as

the input resource. The format is as follows: Organization (mandatory)/Imagerepository (mandatory)/Tag (mandatory). To use new images that are notstored in SWR, push them to SWR first. To be specific, in the navigation paneon the left, click Image Repository to go to the SWR console. After pushingimages to SWR, select the newly pushed images as input resources. For detailson how to upload images to SWR, see Uploading an Image Through aContainer Engine Client.

● Deployment Tool: Select Helm Charts.● Cluster: Select the cluster on which the image is deployed. To create a new

cluster, click Create Cluster. You will then be directed to the CCE console tocreate a cluster.

● Namespace: Select the namespace to which the cluster you set belongs.● Release: Select a release. If no releases are available, click Create Release to

create one.● Helm Chart: Select a Helm chart from either the official charts or uploaded

charts.– Official Charts are the application charts provided for you to use directly.

Currently, official charts such as Redis, etcd, MySQL NDB, and MongoDBare supported. Select an official chart and version, and set workloaddeployment specifications.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 22

Page 26: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-11 Using an official chart

– Uploaded Charts are customized charts. If no customized charts areavailable, click Upload Chart to upload one.

Figure 2-12 Uploading charts

When the upload is successful, you can select the uploaded chart andversion. In Advanced Settings, you can modify the configurationinformation or import a configuration file. Imported ConfigMaps must beconsistent with those in the values.yaml file in the selected chart.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 23

Page 27: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-13 Using an uploaded chart

● Description: Enter a deployment description.● Advanced Settings: You can configure error handling mechanisms, trigger

conditions, and notifications, which enable synergy and collaboration betweenpipelines.

NO TICE

All pipeline stages have their own advanced settings so that you canconfigure different error handling mechanisms, trigger conditions, andnotifications for different stages.

– Error Handling Mechanism: The pipeline can return to its first stage,stop and exit when it times out after a specified period of time, or ignorethe error and continue the execution.

– Trigger Conditions: You can trigger the stage through either a webhookor internal invocation. If you select Webhook, click Generate to generatea webhook URL. Copy the URL and use it to trigger the stage. If youselect Internal invocation, select a specific channel to trigger the stage.If you want to add an input parameter for trigger conditions, click AddInput Parameter, set the parameter name, and select a global variable.The value of this parameter is passed to the selected global variablewhen the stage is triggered.Trigger Mode: You can choose to trigger the stage either when all triggerconditions you configured are met or when any one of the triggerconditions is met.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 24

Page 28: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-14 Trigger conditions

– Notifications: When a stage is executed, result notifications can beautomatically sent through either a webhook or internal invocation. Youcan choose to send notifications when the pipeline is executedsuccessfully, abnormally, or both.

▪ If you select Webhook, specify a notification URL. POST and GET aresupported. You can add headers, request bodies, and parameters.

Figure 2-15 Notification through a webhook

▪ If you select Internal invocation, select a specific channel to sendnotifications. If you want to add an output parameter fornotifications, click Add Output Parameter, set the parameter name,and select a global variable. The value of the selected global variableis passed to this parameter when a notification is sent.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 25

Page 29: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-16 Notification through internal invocation

----End

2.3.3 Creating a Pipeline to Deploy an Image Using an AOSTemplate

Application Orchestration Service (AOS) enables enterprises to automateapplication cloudification. By orchestrating mainstream cloud services of HUAWEICLOUD, you can create, replicate, and migrate your applications and provisionrequired cloud resources with a few clicks. To work with AOS, all you need to do iscreate a template describing the applications and cloud resources that you wouldlike, including their dependencies and references. AOS will then set up theseapplications and resources as specified in your template. You can deploy an imageusing an AOS template by adding a Template Deployment stage in aContainerOps pipeline.

This section describes how to use an AOS template to deploy an image in aContainerOps pipeline.

Procedure

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines. In the upper right corner,click Customize Pipeline.

Step 3 Set the basic pipeline information.● Pipeline Name: Enter a pipeline name that is easy to understand.● Pipeline Group: Select a pipeline group to which this pipeline belongs.● Description: Enter a pipeline description.● Execution Result Notification: You can set the pipeline to send notifications

when it is executed abnormally, successfully, or both. If you enable thenotification feature, add notification receivers. Specify who will be notifiedand their email addresses.

● Global Variable: By default, the SYS_TIMESTAMP (pipeline timestamp) andSYS_INCREMENT (pipeline self-increment) are set. To add a new globalvariable, click Add Global Variable. To use the global variables in pipelineconfiguration and scripts, ensure that the variables are in the format of ${global variable name}. For example, if you add an environment variable

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 26

Page 30: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

named reponame in this table, you can use ${reponame} to obtain thevariable value when uploading a software package.

● Topology: topology of the current pipeline. Click the icon of each stage to editthe corresponding stage in the Stage Configuration area.

Step 4 Click the stage icon (the blue circle) in the topology and add a stage. Set thestage type to Template Deployment and enter a stage name that is easy tounderstand.

Step 5 Configure the AOS template deployment information, and click Submit to savethe pipeline.

● Input Resources: Click Add Input Resource to specify the desired image asthe input resource. The format is as follows: Organization (mandatory)/Imagerepository (mandatory)/Tag (mandatory). To use new images that are notstored in SWR, push them to SWR first. To be specific, in the navigation paneon the left, click Image Repository to go to the SWR console. After pushingimages to SWR, select the newly pushed images as input resources. For detailson how to upload images to SWR, see Uploading an Image Through aContainer Engine Client.

● Deployment Tool: Select AOS Templates.● Stack: Select a stack that has been created in AOS. If no stack is available,

click New Stack and enter a stack name to create a stack.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 27

Page 31: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

● AOS Templates: Select the template and version used by the stack. If thestack has been successfully created in AOS, the template used by the stackwill be automatically specified by default. If no template is available, clickCreate Template to go to the AOS console to create one.

● Configuration: The configurations of each parameter in the template aredisplayed, including the parameter name, type, value, and description.– Timeout Duration: You can set the maximum duration of a task. If a task

times out, the task automatically stops and an error is reported.● Advanced Settings: You can configure error handling mechanisms, trigger

conditions, and notifications, which enable synergy and collaboration betweenpipelines.

NO TICE

All pipeline stages have their own advanced settings so that you canconfigure different error handling mechanisms, trigger conditions, andnotifications for different stages.

– Error Handling Mechanism: The pipeline can return to its first stage,stop and exit when it times out after a specified period of time, or ignorethe error and continue the execution.

– Trigger Conditions: You can trigger the stage through either a webhookor internal invocation. If you select Webhook, click Generate to generatea webhook URL. Copy the URL and use it to trigger the stage. If youselect Internal invocation, select a specific channel to trigger the stage.If you want to add an input parameter for trigger conditions, click AddInput Parameter, set the parameter name, and select a global variable.The value of this parameter is passed to the selected global variablewhen the stage is triggered.Trigger Mode: You can choose to trigger the stage either when all triggerconditions you configured are met or when any one of the triggerconditions is met.

Figure 2-17 Trigger conditions

– Notifications: When a stage is executed, result notifications can beautomatically sent through either a webhook or internal invocation. Youcan choose to send notifications when the pipeline is executedsuccessfully, abnormally, or both.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 28

Page 32: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

▪ If you select Webhook, specify a notification URL. POST and GET aresupported. You can add headers, request bodies, and parameters.

Figure 2-18 Notification through a webhook

▪ If you select Internal invocation, select a specific channel to sendnotifications. If you want to add an output parameter fornotifications, click Add Output Parameter, set the parameter name,and select a global variable. The value of the selected global variableis passed to this parameter when a notification is sent.

Figure 2-19 Notification through internal invocation

----End

2.3.4 Creating a Pipeline to Conduct a Performance TestCloud Performance Test Service (CPTS) provides performance test services forcloud applications that are built based on HTTP, HTTPS, TCP, UDP, WEBSOCKET,RTMP or HLS. You can add a performance test stage in a ContainerOps pipeline toeasily integrate CPTS capabilities.

This section describes how to add a performance test stage in a pipeline.

Procedure

Step 1 Log in to the ContainerOps console.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 29

Page 33: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Step 2 In the navigation pane on the left, choose Pipelines. On the upper right corner,click Customize Pipeline.

Step 3 Set the basic pipeline information.● Pipeline Name: Enter a pipeline name that is easy to understand.● Pipeline Group: Select a pipeline group to which this pipeline belongs.● Description: Enter a pipeline description.● Execution Result Notification: You can set the pipeline to send notifications

when it is executed abnormally, successfully, or both. If you enable thenotification feature, add notification receivers. Specify who will be notifiedand their email addresses.

● Global Variable: By default, the SYS_TIMESTAMP (pipeline timestamp) andSYS_INCREMENT (pipeline self-increment) are set. To add a new globalvariable, click Add Global Variable. To use the global variables in pipelineconfiguration and scripts, ensure that the variables are in the format of ${global variable name}. For example, if you add an environment variablenamed reponame in this table, you can use ${reponame} to obtain thevariable value when uploading a software package.

● Topology: topology of the current pipeline. Click the icon of each stage to editthe corresponding stage in the Stage Configuration area.

Step 4 Click the stage icon (the blue circle) in the topology and add a stage. Set thestage type to Performance Test and enter a stage name that is easy tounderstand.

Step 5 Configure the stage information and click Submit to save the pipeline.● Test Project: Select a test project from the drop-down list. To define more

complex performance tests, go to the CPTS console. After creating the testson CPTS console, return to this page and click the refresh button. The createdtests will be displayed in the drop-down list.

● Test Task: Select a test task from the drop-down list. To define more complexperformance tests, go to the CPTS console. After creating the tests on CPTSconsole, return to this page and click the refresh button. The created tests willbe displayed in the drop-down list.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 30

Page 34: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

● Test Resource Group: Select a test resource group from the drop-down list.– Shared resource group: A shared resource group can be used directly.

You do not need to create a shared resource group first. A sharedresource group (external network) supports pressure tests on external IPaddresses; A shared resource group (internal network) supports pressuretests on HUAWEI CLOUD internal IP addresses.

– CCE resource group: a CCE resource group created on the local host.Selecting an available VPC and subnet.

● Expected Success Rate: When the actual success rate is lower than theexpected success rate, the application fails the performance test.

● Advanced Settings: You can configure error handling mechanisms, triggerconditions, and notifications, which enable synergy and collaboration betweenpipelines.

NO TICE

All pipeline stages have their own advanced settings so that you canconfigure different error handling mechanisms, trigger conditions, andnotifications for different stages.

– Error Handling Mechanism: The pipeline can return to its first stage,stop and exit when it times out after a specified period of time, or ignorethe error and continue the execution.

– Trigger Conditions: You can trigger the stage through either a webhookor internal invocation. If you select Webhook, click Generate to generatea webhook URL. Copy the URL and use it to trigger the stage. If youselect Internal invocation, select a specific channel to trigger the stage.If you want to add an input parameter for trigger conditions, click AddInput Parameter, set the parameter name, and select a global variable.The value of this parameter is passed to the selected global variablewhen the stage is triggered.Trigger Mode: You can choose to trigger the stage either when all triggerconditions you configured are met or when any one of the triggerconditions is met.

Figure 2-20 Trigger conditions

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 31

Page 35: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

– Notifications: When a stage is executed, result notifications can beautomatically sent through either a webhook or internal invocation. Youcan choose to send notifications when the pipeline is executedsuccessfully, abnormally, or both.

▪ If you select Webhook, specify a notification URL. POST and GET aresupported. You can add headers, request bodies, and parameters.

Figure 2-21 Notification through a webhook

▪ If you select Internal invocation, select a specific channel to sendnotifications. If you want to add an output parameter fornotifications, click Add Output Parameter, set the parameter name,and select a global variable. The value of the selected global variableis passed to this parameter when a notification is sent.

Figure 2-22 Notification through internal invocation

----End

2.3.5 Creating a Pipeline to Conduct a Unit TestThis section describes how to add a unit test stage in a pipeline.

Before You Start● If you wish to view test result statistics when a unit test stage is executed, the

test script must comply with the coding specifications. If you use Java test

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 32

Page 36: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

cases, run the test using Maven. If you use Go test cases, add the -vparameter after go test in the test script.

● Test result statistics are not supported in customized testing environments.

Prerequisites● Test cases to be used have been pushed to source code repositories.

ContainerOps will pull test cases from source code repositories for executingthe unit test.

● An organization and software package have been created. They will be usedfor archiving test reports.

Procedure

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines. In the upper right corner,click Customize Pipeline.

Step 3 Set the basic pipeline information.● Pipeline Name: Enter a pipeline name that is easy to understand.● Pipeline Group: Select a pipeline group to which this pipeline belongs.● Description: Enter a pipeline description.● Execution Result Notification: You can set the pipeline to send notifications

when it is executed abnormally, successfully, or both. If you enable thenotification feature, add notification receivers. Specify who will be notifiedand their email addresses.

● Global Variable: By default, the SYS_TIMESTAMP (pipeline timestamp) andSYS_INCREMENT (pipeline self-increment) are set. To add a new globalvariable, click Add Global Variable. To use the global variables in pipelineconfiguration and scripts, ensure that the variables are in the format of ${global variable name}. For example, if you add an environment variablenamed reponame in this table, you can use ${reponame} to obtain thevariable value when uploading a software package.

● Topology: topology of the current pipeline. Click the icon of each stage to editthe corresponding stage in the Stage Configuration area.

Step 4 Click the stage icon (the blue circle) in the topology and add a stage. Set thestage type to Source Code Repository and enter a stage name that is easy tounderstand.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 33

Page 37: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Configure source code repository information.● Code Source: Select the code source. If you have not bound your desired code

source account, bind it by following the instructions described in Binding aCode Source Account.

NO TE

Currently, you can bind your Gitee, GitHub, or GitLab accounts to ContainerOps.

After binding an account, configure the following information:– Namespace: Select the namespace to which the desired code repository

belongs.– Repository Name: Select the desired code repository name.– Branch: Select the desired branch.– Tag: Set this to the tag corresponding to the source code.

● Auto Build: You can choose to trigger the pipeline when either a new imagetag is added or when code is committed to the branch you specified. Whenthe pipeline is triggered, a new image tag is automatically built from thesource code pulled from the bound code source account.– Webhook Mount: A webhook used to trigger the auto build can be

either automatically or manually mounted. If you select Automaticmount, the webhook will be automatically mounted to the code sourcerepository after you enable auto build. If you select Manual mount, copythe URL and secret token displayed to manually create a webhook for thesource code repository. If the code source account you bound does nothave permission to create webhooks, it is advised to select Manualmount and manually create a webhook using an account with sufficientpermission.

● Advanced Settings: You can configure error handling mechanisms, triggerconditions, and notifications, which enable synergy and collaboration betweenpipelines.

NO TICE

All pipeline stages have their own advanced settings so that you canconfigure different error handling mechanisms, trigger conditions, andnotifications for different stages.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 34

Page 38: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

– Error Handling Mechanism: The pipeline can return to its first stage,stop and exit when it times out after a specified period of time, or ignorethe error and continue the execution.

– Trigger Conditions: You can trigger the stage through either a webhookor internal invocation. If you select Webhook, click Generate to generatea webhook URL. Copy the URL and use it to trigger the stage. If youselect Internal invocation, select a specific channel to trigger the stage.

If you want to add an input parameter for trigger conditions, click AddInput Parameter, set the parameter name, and select a global variable.The value of this parameter is passed to the selected global variablewhen the stage is triggered.

Trigger Mode: You can choose to trigger the stage either when all triggerconditions you configured are met or when any one of the triggerconditions is met.

Figure 2-23 Trigger conditions

– Notifications: When a stage is executed, result notifications can beautomatically sent through either a webhook or internal invocation. Youcan choose to send notifications when the pipeline is executedsuccessfully, abnormally, or both.

▪ If you select Webhook, specify a notification URL. POST and GET aresupported. You can add headers, request bodies, and parameters.

Figure 2-24 Notification through a webhook

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 35

Page 39: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

▪ If you select Internal invocation, select a specific channel to sendnotifications. If you want to add an output parameter fornotifications, click Add Output Parameter, set the parameter name,and select a global variable. The value of the selected global variableis passed to this parameter when a notification is sent.

Figure 2-25 Notification through internal invocation

Step 5 Click the stage icon (the blue circle) in the topology and add a stage. Set thestage type to Unit Test and enter a stage name that is easy to understand.

Step 6 Configure the stage information and click Submit to save the pipeline.● Input Resources: Click Add Input Resource to specify a code source.● Test Environment: You can select Java, Go, or Customize.● Test Script: Compile a script based on the selected test environment. If the

test environment is set to Java or Go, a default test script is provided for youto use directly.

NO TE

You can specify static scanning commands in test scripts. Tools such as golint,goimports, gofmt, and FindBugs have been integrated in ContainerOps pipelines.

● Expected Case Pass Rate: Set the expected case pass rate. For example, if youset the rate to 80%, when the actual rate reaches or surpasses 80%, thepipeline passes the unit test. If the actual rate falls below 80%, the pipelinefails the unit test.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 36

Page 40: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

NO TE

The expected case pass rate is available for configuration only when the testenvironment is set to Java.

● Test Report: Enter the archive name of the test report, for example,cover.out.

● Report Archive Path: Specify the archive path of the test report.

----End

Related OperationsWhen the unit test is successfully executed in the pipeline, you can view the testcase execution status and pipeline execution logs.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines, and then click the targetpipeline to enter its details page.

Step 3 On the pipeline details page, view the pipeline execution status.● View the test case execution status.

On the Test Logs tab page, view the execution status of the test cases. Todownload the report, click Download.

● View pipeline execution logs.Click View Logs to view pipeline execution logs.

----End

2.4 Basic Pipeline OperationsAfter creating a pipeline, you can view, start, and delete it.

Viewing a PipelineYou can view a pipeline's status and information.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 37

Page 41: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines. On the page displayed, youcan start, stop, or delete pipelines.● Start a pipeline: Click Start to start a pipeline. For details, see Starting or

Stopping a Pipeline.

● Stop a pipeline: Click Stop to stop a pipeline that is being executed. Fordetails, see Starting or Stopping a Pipeline.

● Delete a pipeline: Click Delete to delete a pipeline. For details, see Deleting aPipeline.

Step 3 Click a pipeline name to enter its details page. On the pipeline details page, youcan view the pipeline topology, stage logs, notifications, and trigger information.To edit the pipeline configuration, click Edit at the upper right corner of the page.

NO TE

You can view the latest 20 execution logs.

Figure 2-26 Pipeline details page

If a pipeline contains an official deployment stage, you can view the YAML usedfor deployment on the Deployment Logs tab page.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 38

Page 42: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-27 Viewing deployment YAML

----End

Starting or Stopping a Pipeline

When a pipeline is created, you can start it. When a pipeline is being executed,you can stop it.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Pipelines.

Step 3 Click Start to start the target pipeline. If global variables are set for the pipeline,check whether the global variables are correctly configured in the dialog boxdisplayed, and click Start.

NO TE

ContainerOps package purchasing is suspended. You can submit a ticket to apply forpackage purchases. Sorry for any inconvenience caused.

Figure 2-28 Checking global variables

If a pipeline status is Executing, the pipeline is started successfully. You can clickthe pipeline name to view the execution process.

Step 4 To stop a pipeline that is being executed, click Stop. The pipeline stops andbecomes Canceled in status.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 39

Page 43: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

----End

Deleting a Pipeline

You can delete a pipeline if you do not need it anymore.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Pipelines.

Step 3 Click Delete to delete the target pipeline. In the displayed dialog box, enterDELETE and click OK.

Figure 2-29 Deleting a pipeline

----End

Rolling Back a Pipeline

Currently, only gray deployment and official deployment stages can be rolled back.You can roll a pipeline back to either the last status or a specified version.

1. Rolling Back to the Last StatusWhen a gray deployment stage is successfully executed, you can click RollBack on the Pods tab page. In the displayed dialog box, click OK. After therollback is confirmed, the workload will be rolled back to the last status.Exercise caution because the rollback cannot be canceled.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 40

Page 44: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-30 Rolling back in a gray deployment stage

NO TE

Once a pipeline has entered an official deployment stage, its gray deployment stagecannot be rolled back.

When an official deployment stage is successfully executed, you can click RollBack on the Pods tab page. In the displayed dialog box, click OK. After therollback is confirmed, the workload will be rolled back to the last status.Exercise caution because the rollback cannot be canceled.

Figure 2-31 Rolling back in an official deployment stage

NO TE

If you use Blue-green deployment as your gray deployment policy, only graydeployment stages can be rolled back. Official deployment stages cannot be rolledback in this case.

2. Rolling Back to a Specified VersionOnly official deployment stages that do not have corresponding graydeployment stages in the same pipeline can be rolled back to a specifiedversion.When an official deployment is successful, you can click Roll Back to ThisVersion on the Deployment Logs tab page. After the rollback is confirmed,the workload will be rolled back to the specified version. Exercise cautionbecause the rollback cannot be canceled.

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 41

Page 45: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 2-32 Rolling back to a specified version

ContainerOpsUser Guide 2 Pipeline Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 42

Page 46: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

3 Pipeline Group Management

Pipeline groups enable efficient pipeline management. You can categorizepipelines into different pipeline groups and grant read, write, and managepermissions to users to allow them to access the pipeline groups. For details, seeUser Permissions.

Creating a Pipeline Group

You can categorize pipelines into groups for more efficient management.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Pipeline Groups. On the page that is displayed,click Create Pipeline Group.

Step 3 Enter a valid pipeline group name as prompted. The name must be unique withinan account.

Figure 3-1 Creating a pipeline group

Step 4 Click OK.

----End

ContainerOpsUser Guide 3 Pipeline Group Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 43

Page 47: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Deleting a Pipeline GroupYou can delete a pipeline group if you do not need it anymore.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Pipeline Groups. On the page that is displayed,click Details in the row containing the pipeline group to delete.

Step 3 On the details page of the pipeline group, click Delete at the upper right corner. Inthe displayed dialog box, enter DELETE and click OK.

Figure 3-2 Deleting a pipeline group

----End

Viewing a Pipeline GroupYou can view the pipelines and users of a pipeline group after it has been createdsuccessfully.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Pipeline Groups. On the page that is displayed,click Details in the same row as the target pipeline group.

Step 3 On the Pipelines tab page, you can view all the pipelines in the pipeline group.

On the Users tab page, you can view the usernames and their correspondingpermissions in the pipeline group, as shown in Figure 3-3. You can modify anddelete the permissions, and add permissions to other users. For details on grantingpermissions, see Granting Permissions to Users.

ContainerOpsUser Guide 3 Pipeline Group Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 44

Page 48: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 3-3 Viewing, modifying, and deleting user permissions

----End

ContainerOpsUser Guide 3 Pipeline Group Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 45

Page 49: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

4 Template Management

Templates in Template Market and My Templates can be used to directly createpipelines. Template Market provides sample templates created by HuaweiContainerOps team; while My Templates stores the templates you exported fromyour pipelines.

Template MarketMultiple pipeline templates are provided in Template Market for you to directlycreate pipelines. For details on creating pipelines from templates, see Creating aPipeline from a Template.

Table 4-1 Pipeline templates in Template Market

Type Function Sample Template

Imagebuild

Connecting with source codehosting services such as GitHubto enable automatic triggeringof image build upon codeupdate.

● Image Build Based on SourceCode

● Image Build Based on SourceCode with Compilation

● Image Build Based on SourceCode and Binary Files

● Image Build Based on BinaryFiles

ContainerOpsUser Guide 4 Template Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 46

Page 50: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Type Function Sample Template

Imagedeployment

Deploying images on cloudcontainer clusters

● Image Build Based on SourceCode with Compilation andGray Deployment

● Image Build Based on SourceCode with Compilation andImage Deployment

● Image Build Based on SourceCode with Image Deploymentand CPTS

● Image Build Based on SourceCode with Deployment

● Image Build Based on BinaryFiles with Image Review andDeployment

● Image Build Based on BinaryFiles with Image Deployment

Graydeployment

Performing canary release andblue-green release

● Image Build Based on SourceCode with Compilation andGray Deployment

Multi-environmentdeployment

Supporting collaborativeapplication deployment acrossmultiple environments (such asR&D, testing, pre-release, andproduction) while automatingthe process from R&D todelivery. This frees you fromtedious tasks, keeps theapplication environmentconsistent, and speeds upcontinuous delivery.

-

My TemplatesYou can export templates from your pipelines to My Templates and directly usethe templates to quickly create new pipelines in the future. To export pipelinetemplates, take the following steps.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipelines, and click the target pipelineto enter its details page.

Step 3 At the upper right corner, click Export Template to save and export a pipelinetemplate to My Templates.

ContainerOpsUser Guide 4 Template Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 47

Page 51: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 4-1 Exporting a template

Step 4 To view the newly exported template, in the navigation pane on the left, chooseMy Templates, and click the target template to enter its details page. To quicklycreate a new pipeline from the template, click Create Pipeline.

ContainerOpsUser Guide 4 Template Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 48

Page 52: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 4-2 Viewing the exported template

----End

ContainerOpsUser Guide 4 Template Management

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 49

Page 53: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

5 User Permissions

You can grant three different types of permissions to users to allow them to accessthe resources in your ContainerOps account.

● Read: permission to view and start pipelines● Write: permission to view, start, and create pipelines, and manage customized

pipeline templates.● Manage: permission to view, start, create, delete, and modify pipelines, and

manage customized pipeline templates.

Figure 5-1 User permissions

ContainerOpsUser Guide 5 User Permissions

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 50

Page 54: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Granting Permissions to UsersUser permissions are granted at pipeline group level. You can add read, write, andmanage permissions to different users to control their access to all the pipelines ina specific pipeline group. Only users with the Manage permission can addpermissions to other users.

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane on the left, choose Pipeline Groups. Click Details in therow containing the target pipeline group.

Step 3 On the Users tab page, click Add Permission. In the dialog box displayed, selectpermissions for the user and click OK.

Step 4 You can also modify or delete permissions.● To modify permissions, on the Users tab page, click Modify in the row of the

target username. Select a permission in the drop-down list of Permission, andclick Save.

● To delete permissions, on the Users tab page, click Delete in the row of thetarget username. In the dialog box displayed, enter DELETE as prompted andclick OK.

Figure 5-2 Deleting permissions

----End

ContainerOpsUser Guide 5 User Permissions

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 51

Page 55: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

6 Code Source Configuration

Binding a Code Source Account

Accessing Self-host GitLab from Build Nodes

6.1 Binding a Code Source AccountContainerOps can interconnect with source code hosting websites such as GitHubto automatically pull source code for image build.

To enable automatic code pull and image build, bind your source code hostingrepository account and authorize SWR to pull code from the repository. Currently,Gitee, GitHub, and GitLab accounts can be bound to ContainerOps.

Binding a GitHub Account

Step 1 Log in to the ContainerOps console. In the navigation pane on the left, selectCode Source Configuration.

Step 2 Click Bind next to GitHub.

Step 3 Enter your GitHub username and password.

ContainerOpsUser Guide 6 Code Source Configuration

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 52

Page 56: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 6-1 Binding a GitHub account

Step 4 In the dialog box that is displayed, confirm your binding.

NO TE

To unbind the account, click Unbind next to GitHub. In the dialog box that is displayed,click OK.

----End

Binding a GitLab Account

Step 1 Obtain the GitLab access token.

1. Log in to GitLab at https://gitlab.com/users/sign_in.2. Click the icon in the upper right corner and choose Settings.

ContainerOpsUser Guide 6 Code Source Configuration

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 53

Page 57: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 6-2 Choose Settings

3. Choose Access Tokens on the left, enter a name, select read_registry, andclick Create personal access token to create a token.

Figure 6-3 Creating a token

4. Copy and save the token.

Step 2 (optional) If you want to bind a self-host GitLab service, add the IP addresssegments of the build nodes to the whitelist of the service. For details, seeAccessing Self-host GitLab from Build Nodes.

Step 3 Log in to the ContainerOps console. In the navigation pane on the left, chooseCode Source Configuration.

Step 4 Click Bind next to GitLab. Enter the source code address and private token in thedialog box, and click OK.

● Source Code Address: The default value is https://gitlab.com. If you want tobind a self-host GitLab service, enter the IP address of the service.

● Private Token: Enter the token obtained in Step 1.

ContainerOpsUser Guide 6 Code Source Configuration

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 54

Page 58: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 6-4 Binding a GitLab account

Step 5 In the dialog box that is displayed, confirm your binding.

NO TE

To unbind the account, click Unbind next to GitLab. In the dialog box that is displayed, clickOK.

----End

Binding a Gitee Account

Step 1 Log in to the ContainerOps console. In the navigation pane on the left, chooseCode Source Configuration.

Step 2 Click Bind next to Gitee.

Step 3 Enter your Gitee username and password.

Step 4 Authorize ContainerOps to access your Gitee account.

Step 5 In the dialog box that is displayed, confirm your binding.

NO TE

To unbind the account, click Unbind next to Gitee. In the dialog box that is displayed, clickOK.

----End

6.2 Accessing Self-host GitLab from Build NodesIf you are using a self-host GitLab service set up on your internal network, add theIP address segments of the build nodes to the whitelist of the service to allow thenodes to automatically pull source code.

The IP addresses of the current build nodes are as follows.

ContainerOpsUser Guide 6 Code Source Configuration

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 55

Page 59: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Table 6-1 Node IP addresses

Region IP Address

CN North-Beijing1 (cn-north-1) 49.4.81.2, 49.4.82.69, 49.4.87.86,49.4.88.200, 49.4.91.147, 159.138.7.49,159.138.7.136, 159.138.23.249,159.138.23.237, 159.138.6.168, and43.254.0.4

CN North-Beijing4 (cn-north-4) 119.3.252.199, 119.3.248.71,117.78.9.100, 117.78.10.15, 159.138.7.49,159.138.7.136, 159.138.23.249,159.138.23.237, 159.138.6.168, and49.4.112.85

CN South-Guangzhou (cn-south-1) 139.159.227.14, 139.9.4.251, 139.9.5.46,139.159.215.77, 139.9.2.39, 159.138.7.49,159.138.7.136, 159.138.23.249,159.138.23.237, 159.138.6.168, and139.159.208.37

CN East-Shanghai2 (cn-east-2) 119.3.54.157, 119.3.57.201, 119.3.60.120,119.3.58.111, 119.3.50.221, 159.138.7.49,159.138.7.136, 159.138.23.249,159.138.23.237, 159.138.6.168, and122.112.208.12

CN East-Shanghai1 (cn-east-3) 121.36.230.244, 121.36.213.242,121.36.249.252, 121.36.254.119,121.36.227.150, 159.138.7.49,159.138.7.136, 159.138.23.249,159.138.23.237, 159.138.6.168, and119.3.120.100

AP-Singapore (ap-southeast-3) 159.138.98.181, 159.138.91.16,159.138.89.160, 159.138.86.158,159.138.89.90, and 159.138.80.89

ContainerOpsUser Guide 6 Code Source Configuration

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 56

Page 60: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

7 Software Center

Software Center allows you to create, store, and view your software packages.Software packages can be used as input resources for your pipelines. To quicklyfind your desired software package, search for it by name in the search box abovethe software package list. The following steps walk you through how to create asoftware package.

Creating a Software Package

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Software Center. On the page displayed, clickCreate Software Package.

Step 3 Configure the software package information as prompted and click OK.

ContainerOpsUser Guide 7 Software Center

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 57

Page 61: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 7-1 Creating a software package

● Upload: (optional) Upload a software package logo in PNG, JPG, or GIFformats.

● Software Repository: Select a software repository in which the softwarepackage will be stored. If no software repositories are available, create one.

● Type: Specify whether the software package is private or public.● Software Package Name: Enter a valid software package name.● Version: Enter a software package version.● Software Package Description: Enter a maximum of 200 characters.● Version Description: Enter a maximum of 200 characters.● Software Uploading: Specify whether you would like to upload your software

now or later.

Step 4 (optional) Upload the software package.

NO TE

This step is compulsory if you choose Upload now in 3.

ContainerOpsUser Guide 7 Software Center

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 58

Page 62: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 7-2 Uploading a software package

Step 5 Click Select File, select the software package, and click Start Upload.

When the task progress is displayed as successful, the package is successfullyuploaded.

Step 6 After a software package is uploaded, you can download, edit, delete, and addnew versions to this software package.

Figure 7-3 Software package details

----End

Adding a Software Package Version

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Software Center. Click the target softwarepackage name to go to its details page.

Step 3 Click Add Version in the upper right corner. Enter a version number anddescription, and select Upload now or Upload later.

ContainerOpsUser Guide 7 Software Center

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 59

Page 63: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 7-4 Adding a software package version

Step 4 (optional) Upload a new version of the software package.

NO TE

This step is compulsory if you choose Upload now in 3.

Figure 7-5 Uploading a new version of the software package

Step 5 After the software package version is added, you can view the version in theversion list of this software package.

----End

ContainerOpsUser Guide 7 Software Center

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 60

Page 64: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Editing a Software Package

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Software Center. Click the target softwarepackage name to go to its details page.

Step 3 Click Edit in the upper right corner. In the dialog box that is displayed, you canchange the repository picture, sharing type, and software package description, andthen click OK.

Figure 7-6 Editing a software package

----End

Deleting a Software Package Version

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Software Center. Click the target softwarepackage name to go to its details page.

Step 3 In the version list, select the software package version to delete and click Delete.In the displayed dialog box, click OK. Deleted software package versions cannot berecovered. Exercise caution when performing this operation.

ContainerOpsUser Guide 7 Software Center

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 61

Page 65: User Guide - support.huaweicloud.com€¦ · select Java, Go, Node.js, or customize your own environment. Build Script: script for compiling the source code – Java: A mvn package

Figure 7-7 Deleting a software package version

----End

Deleting a Software Package

Step 1 Log in to the ContainerOps console.

Step 2 In the navigation pane, choose Software Center.

Step 3 Click Delete in the row of the software package to delete. In the displayed dialogbox, click OK. Deleted software packages cannot be recovered. Exercise cautionwhen performing this operation.

NO TICE

Before deleting a software package, ensure that all versions in the softwarepackage are deleted. Otherwise, the deletion will fail.

----End

ContainerOpsUser Guide 7 Software Center

Issue 01 (2020-08-27) Copyright © Huawei Technologies Co., Ltd. 62