This section describes how to use the built-in code repository of CodeArts to develop, build, and deploy projects for continuous delivery.
This chapter uses Elastic Cloud Server (ECS) for traditional software package deployment.
To use container-based deployment, see Deploying a Code Development Pipeline on CCE.
Category | Parameter | Suggestion |
|---|---|---|
Configure Basic Settings | CPU Architecture | Select x86. |
Specifications | Select 2 vCPUs and 4 GiB or higher. | |
Image | Choose Public image > CentOS > CentOS 7.6 64bit(10 GiB). | |
Configure Network | EIP | Select Auto assign. |
Billed By | Select By bandwidth. | |
Configure Advanced Settings | Login Mode | Select Password. |
Password | Enter a password. |
Return to the Overview page. On the My Services tab, the status shows enabled Subscription.
Figure 1 Subscribed to the CodeArts package

A project is the basis for using services on CodeArts. Subsequent operations can be performed only after a project is created.
You can use a code repository to manage project code versions. This section describes how to use the built-in template Java Web Demo to create a code repository.
You can use CodeArts Check to perform static code check and control code quality.
in the row where the task is located to start the task.
is displayed, the task is successfully executed. Click the task name, and view the check result on the Overview tab.If the task fails, check and fix errors based on the message displayed on the page.
You can use CodeArts Build to compile the source code of the software into a target file, packs the configuration file and resource file, and archives them to a release repo.
in the row where the task is located to start the task. If a dialog box is displayed, confirm the parameter settings and click OK.
is displayed, the task is successfully executed. Click the task name. On the Build History page that is displayed, find the Build ID of the latest build in the list and record the ID.If the build fails, rectify the fault based on the failed action information and error information in logs.
Figure 2 Build ID

In the repository named after the project, go to the folder named after the build task and the folder named after the build ID in sequence to find the generated software package demoapp.jar.
Figure 3 Viewing the software package

You can use CodeArts Deploy to deploy software packages in a release repo to a VM and run the software.
Parameter | Suggestion |
|---|---|
Cluster Name | Enter host-group. |
OS | Select Linux. |
Host Connection Mode | Select Direct Connection. |
Execution Resource Pool | Select Official. |
Parameter | Suggestion |
|---|---|
Add Hosts by | Select Adding IP. |
Host Name | You are advised to keep this same as the name of an ECS purchased in Preparations. |
IP | Enter the elastic IP address of an ECS purchased in Preparations. |
Authorization | Select Password. |
Username | Enter root. |
Password | Enter the password set when you purchase the ECS in Preparations. |
SSH Port | Enter 22. |
If the host fails to be added, check its configuration based on the failure details.
and choose Edit.Parameter | Suggestion |
|---|---|
Environment | Enter demo-env. |
Resource Type | Select Host. |
OS | Select Linux. |
Parameter | Value |
|---|---|
Source | Click Build task. |
Build Task | Select Web-Demo-build. |
Download Path | Enter /usr/local/${package_name}/. |
on the action card and choose Disable.Figure 4 Disabling "Stop SpringBoot"

Parameter Name | Value |
|---|---|
host_group | Select the environment demo-env added in 4. |
package_url | This parameter is not required. Click |
service_port | Enter 8080. |
package_name | Enter demoapp. |
Wait until
is displayed on the page. If the deployment fails, rectify the fault based on the failed action information and error information in logs.
Open a new browser page and enter the access address http://IP:8080/test. IP is the elastic IP address of the ECS purchased in Preparations.
If the following information is displayed, the deployment is successful.
Figure 5 Deployment result

You can use a CodeArts pipeline to connect code check, build, and deployment tasks. When code changes, the pipeline is automatically triggered for continuous delivery.
and choose Edit.Click
next to the Apitest job. In the dialog box that is displayed, click OK.
Figure 6 Deleting a job

Figure 7 Configuring the execution plan

Click
, change hello world to hello world again, submit the information, and click OK.
Figure 8 Modifying code

When
is displayed, access http://IP:8080/test again. The following figure shows the access result.
If the task fails to be executed, check the failure cause. You can open the step details page to view the task logs and rectify the fault based on the logs.
Figure 9 Pipeline execution result

To avoid incurring unnecessary fees, you can release any unused resources once you have completed this example. The following resources can be released.
Resource | Releasing Method |
|---|---|
CodeArts project | Choose Settings > General > Basic Information, click Delete Project, and follow the prompts to delete the project. |
ECS | Log in to the ECS console, locate the ECS to be deleted in the list, choose More > Delete, and follow the prompts to delete the ECS. |
Released resources cannot be restored. Exercise caution when performing this operation.