Article Directory
foreword
HUAWEI CLOUD CodeArts is a distributed application development platform based on the serverless architecture. It can quickly build, deploy, and manage distributed applications, supports multiple programming languages, including Java, Python, and Node.js, and provides rich development tools and APIs, which simplifies the developer's writing process and improves development efficiency. . HUAWEI CLOUD CodeArts also has the characteristics of elastic scaling, high availability, security and reliability, which can meet the application requirements in different scenarios.
1. HUAWEI CLOUD CodeArts product experience
1. Software development production line use process
1.1 Configuration items
1. Enter the console, select软件开发生产线 CodeArts
Console URL: https://console.huaweicloud.com/console/?region=cn-north-4#/home
2. Click to use now
3. Create a new project
4. Add project members
5. Create work items
1.2 Configure the code repository
1. Install and configure the Git client
Download the installation package from the Git official website , and use the default configuration to install the Git client to the local computer.
Run Git Bash, enter the following command line in Git Bash to configure the user name and mailbox.
git config --global user.name "您的名字"
git config --global user.email "您的邮箱"
Enter the following command line to generate a pair of SSH keys. The generated key is usually saved in "~/.ssh/id_rsa.pub".
ssh-keygen -t rsa -C "[email protected]"
dir C:\Users\Happy/.ssh/
type C:\Users\Happy/.ssh/id_rsa.pub
2. Create a code warehouse
Select Common New, Create New by Template, or Import External Warehouse as required, enter basic information such as the Warehouse name as prompted on the page, and click OK.
3. Clone/push code
Click the user name in the upper right corner of the page, and select "Personal Settings" from the drop-down list.
Click Code Hosting > SSH Key Management.
Click Add SSH Key, enter the title, paste the key generated in the installation and configuration of the Git client into the text box, check the consent statement, and click OK.
After adding the key, iu can configure the pipeline to run Git Bash, enter the following command line, and clone the cloud warehouse to the local.
git clone 您仓库的SSH下载链接
After editing the code locally, enter the following command lines in Git Bash to save the code and push it to the code repository.
git add .
git commit -m "您对本次提交备注的信息"
git push origin master
1.3 Configuration pipeline
1. Create a code inspection task
- Enter the created project and click Code > Code Check in the navigation bar.
- Click "New Task", select the code warehouse to be checked on the page, and click "New Task" after the warehouse name.
- After the task is successfully created, go to the Overview page and click Start Check to start the task.
- After the task is successfully executed, you can view the inspection results, problem list, modification suggestions, etc.
2. Create a build task
- Enter the created project, click "Continuous Delivery > Compile and Build" in the navigation bar
- Click New Task and configure task information as required.
- Configure the build steps, parameters, and execution plan as required, and click Create and Execute.
- After the task is executed, you can view the build results and build logs on the page.
3. Create and deploy applications
- Enter the created project, select "Settings > General Settings > Basic Resource Management" in the page navigation bar, create a new host cluster, and add the hosts prepared in the prerequisites to the cluster.
- Enter the created project, and select Continuous Delivery > Deployment in the page navigation bar.
- Click New Application and configure application information as required.
- Configure deployment steps, parameters, environment, and other information as required, and click Save and Deploy.
- After the application is successfully deployed, you can view the deployment results, deployment logs, error messages, etc. on the page.
4. Configure the pipeline
- Enter the created project and click Continuous Delivery > Pipeline in the navigation bar.
- Select the Pipeline tab, click New Pipeline, and configure the pipeline information based on the actual situation.
- Configure task arrangement, parameters, and execution plan as required, and click Save and Run.
- After the task is successfully executed, you can click each task to view its execution details.
2. Use the software development production line to quickly build projects (ECS articles)
2.1 Prerequisites
2.2 New project
The project is the basis for using the software to develop the services of the production line, and the subsequent operations can only be completed after the project is created.
- Log in to the software development production line and click New Project.
- Select "Scrum", enter the project name "Demo", and click "OK".
2.3 Create a new code warehouse
1. Choose to create a new template
2. Select the template "Java Web Demo" and click "Next"
3. Enter the code warehouse name "Web-Demo", click "OK"
2.4 Check code
Through the code inspection service, you can perform static inspection on the code to control the quality of the code.
2.5 Build and archive the package
Through the compilation and construction service, the source code of the software can be compiled into an object file, and the configuration file and resource file can be packaged and archived into the software release library.
Click Start Task in the row for the task. If a pop-up window appears, please confirm that the parameter settings are correct, and then click OK.
Click Product Repository > Software Release Repository on the navigation bar to enter the software release repository. In the warehouse with the same name as the project name, enter the folder with the same name as the build task and the folder with the same name as the build number in sequence, and you can find the generated software package "demoapp.jar".
2.6 Deploying build packages
Through the deployment service, the software package in the software release library can be deployed to the virtual machine and started to run.
1. Configure the target host
Click New Host Cluster, enter the cluster name "hosts", select the operating system "Linux", turn off the "Use Proxy Access" switch, and click "Save".
Click Add Target Host, configure the following information in the pop-up box, check the consent statement, and click Add.
When the value in the "Connectivity Verification" column is displayed as "Success", it means that the host has been added.
Select the Deployment Steps tab to configure the deployment steps.
Click Continuous Delivery > Deployment on the navigation bar to enter the deployment service. The automatically created application "Web-Demo-deploy" is displayed on the page. Select "Edit" in the drop-down list to enter the edit page. Select the "Environment Management" tab to configure the host environment.
Select "Edit" in the drop-down list to enter the edit page.
Click Save and Deploy. If a pop-up window appears, please confirm that the parameter settings are correct, and then click OK.
View deployment results
2.7 Configure the pipeline
Click Continuous Delivery > Pipeline in the navigation bar to enter the pipeline service. The automatically created pipeline "Web-Demo-pipeline" is displayed on the "Pipeline" page.
Select the Task Orchestration tab and configure the pipeline.
Click Continuous Delivery > Pipeline in the navigation bar to enter the pipeline service. The automatically created pipeline "Web-Demo-pipeline" is displayed on the "Pipeline" page.
Enter the deployment service, edit the deployment steps, and check "Enable" in "Stop SpringBoot Service".
Enter the code repository, search for and open the file "TestController.java".
Click to change "hello world" to "hello world Yugong", enter the submission information and click "OK".
Return to the pipeline page, you can see that the pipeline is running.
When the page is displayed, revisit the page "http://IP:8080/test", and the access result will change to the content shown in the figure below.
3. Use the software development production line to quickly build projects (CCE articles)
3.1 Prerequisites
3.2 New project
The project is the basis for using the software to develop the services of the production line, and the subsequent operations can only be completed after the project is created.
- Log in to the software development production line and click New Project.
- Select "Scrum", enter the project name "Demo", and click "OK".
3.3 Create a new code warehouse
1. Choose to create a new template
2. Select the template "Java Web Demo" and click "Next"
3. Enter the code warehouse name "Web-Demo", click "OK"
3.4 Prepare Dockerfile
A Dockerfile is a text file used to build an image, which contains the instructions and instructions needed to build the image.
1. Click the warehouse name to enter the code warehouse, click "New" above the file list, and select "New File" in the drop-down list
2. Enter the file name Dockerfile, and enter the following command line for file details
FROM openjdk:8-alpine
ADD target /demo
COPY ./target/demoapp.jar /demo
CMD ["java","-jar","/demo/demoapp.jar"]
3. Build and push the image
Click "New Task" to configure the task information.
Build the basic information of the task.
Build template: select "Blank Build Template" and click "Next".
Configure the build step, click "Click to add build step", find "Maven Build" in the step list, and click "Add".
Click Add Step, find Create Image and Push to SWR Repository in the step list, and click Add.
Configure image information
. After completing the configuration, click Create and Execute.
Log in to the container image service console , and select "My Images" in the left navigation bar of the page.
3.5 Create load
Log in to the Cloud Container Engine console , click the cluster purchased in the preparations, and enter the details page.
On the left side of the page, select Workload, click Create Workload, complete the configuration by referring to the table below, and click Create Workload.