Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.
Upgrading a CAE Component After Uploading an Image Built Using the Pipeline to the SWR Image Repository
Creating a Build Task
Create a build task for a code repository.
- Go to the CodeArts console and click Access Service in the upper right corner.
- Choose Services > Build.
Figure 1 Selecting a service
- On the Build page, click Create Task. In the Basic Information area, set Task Name, Project, Code Source, Source Code Repository, and Branch, and click Next.
Figure 2 Creating a build taskFigure 3 Configuring basic build information
- Select a template for build and click Next. In this example, Java code is used. Therefore, select the Maven template.
Figure 4 Selecting a build template
- On the Build Actions page, delete step Upload Software Package to Release Repository.
Figure 5 Deleting step Upload Software Package to Release Repository
- Click Add step > Upload related > Build Image and Push to SWR > Add.
Figure 6 Adding a step
- On the Parameters page, configure build parameters and default values by referring to Figure 7, and enable Runtime Settings. org_name indicates the SWR organization to which the image is uploaded. image_name indicates the name of the image uploaded to SWR. image_tag indicates the image tag or image version.
- On the Build Actions page, configure step Build Image and Push to SWR. Set Organization to ${org_name}, Image Name to ${image_name}, Image Tag to ${image_tag}, Working Directory to the default value, and Dockerfile Path to the path in the code repository (in the example, the Dockerfile is in the root directory).
Figure 8 Configuring step Build Image and Push to SWR
- Click Create and Run in the upper right corner, confirm the runtime parameter, and click Confirm.
Figure 9 Running a build task
- On the Build History page, select the build task to view the build log.
- Log in to SWR and choose My Images to confirm that the image is uploaded.
Creating a Pipeline to Upgrade CAE Components
Create a CodeArts pipeline.
- Go to the CodeArts homepage.
- Choose Services > Pipeline. On the Pipeline page, click Create Pipeline.
Figure 10 Selecting a serviceFigure 11 Creating a pipeline
- On the Create Pipeline page, set Name, Pipeline Source, Repository, and Default Branch, and click Next.
Figure 12 Configuring basic pipeline information
- In Template, choose All > Blank Template and click OK.
Figure 13 Selecting a template
- On the Task Orchestration page, click Stage. Click
and change the names of stages 1 and 2 to Build and Deploy, respectively.
Figure 14 Creating a pipeline - Create a build job.
- In the Build stage, click Job.
- On the NewJob page, click Build > Build > Add.
Figure 15 Creating a build jobFigure 16 Adding a build job
- Select the created build job and repository, set org_name, image_name, and image_tag as the pipeline parameters, and click OK.
Figure 17 image_nameFigure 18 image_tag
- On the Parameter Configuration page, add custom parameters by referring to Parameters.
org_name: name of the SWR organization to which the image is uploaded, for example, for-test.
image_name: name of the image uploaded to SWR, for example, cae-backend.
image_tag: image tag or image version, for example, v1.0.
swr_address: address of the SWR image repository. The format is swr.Region project name.myhuaweicloud.com.Figure 19 Adding custom parameters
- On the NewJob page, click Build > Build > Add.
- In the Deploy stage, click Job.
- Enter CAE in the search box and click
. Select the CAE Release extension and click Add.
Figure 20 Adding a deploy extension - Configure the extension parameters and click OK.
- Region: Select a region for deployment, which is the same as the CodeArts region.
- Environment: Select the environment to which the component belongs.
- Application: Select the application to which the component belongs.
- Component: Select the component to be upgraded. (You need to select a component that is deployed using the image in CAE.)
- Component Source: Select Images.
- Image Address: See Parameters.
Figure 21 Configuring the extension parameters - Click Save and Run. On the Execution Configuration page, confirm the configurations and click Run.
- Enter CAE in the search box and click
- In the Build stage, click Job.
- View the pipeline execution result.
Figure 22 Viewing the pipeline execution result
- Log in to CAE and check the component status. If Upgraded is displayed in the Last Change Status/Time column, the component has been upgraded using the CodeArts pipeline.
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
org_name |
Yes |
String |
Name of the SWR organization to which the image is uploaded. You can log in to the SWR console to view the organization name. |
image_name |
Yes |
String |
Name of the image uploaded to SWR. |
image_tag |
Yes |
String |
Tag of the image uploaded to SWR. |
swr_address |
Yes |
String |
The format is swr.Region project name.myhuaweicloud.com. The region project name is region. For details, see Obtaining Values. |
Image Address |
Yes |
String |
Address of the image uploaded to SWR. Enter ${swr_address}/${org_name}/${image_name}:${image_tag}. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot