หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา
- What's New
- Function Overview
- Service Overview
-
Getting Started
- Building with Ant and Uploading the Package to a Release Repo (x86, Preset Image, GUI)
- Building with CMake and Uploading the Package to a Release Repo (Arm, Preset Image, GUI)
- Building with Maven, Uploading the Software Package, and Pushing the Image (x86, Preset Image, Code)
- Common Practices for Beginners
-
User Guide
- Working with CodeArts Build
- Enabling CodeArts Build
- Configuring Project-Level Role Permissions
- Creating a Build Task
-
Configuring a Build Task
- Performing Basic Configurations
- Selecting Build Actions
-
Configuring Build Actions
- Building with Maven
- Building with Android
- Building with npm
- Building with Gradle
- Building with Yarn
- Building with Gulp
- Building with Grunt
- Building with Mono
- Building in PHP
- Building with Setuptools
- Building with PyInstaller
- Running Shell Commands
- Building with GNU Arm
- Building with CMake
- Building with Ant
- Building with Kotlin
- Building with Go
- Building Android App with Ionic
- Building an Android Quick App
- Building with sbt
- Building with Grails
- Building with Bazel
- Building with Flutter
- Building with HarmonyOS
- Running Docker Commands to Operate Images
- Generating a Unit Test Report
- Customizing a Build Environment
- Using a Custom Build Environment
- Downloading a Software Package from Release Repos
- Uploading a Software Package to Release Repos
- Uploading Files to OBS
- Configuring Parameters
- Configuring Schedules
- Configuring Roles and Permissions
- Configuring Notifications
- Running a Build Task
- Viewing a Build Task
- Managing Build Tasks
- Querying Audit Logs
- References
- Old User Guide
-
Best Practices
- Creating a Docker Image with a Maven Artifact and Pushing the Image to SWR (Built-in Executors, GUI)
- Building with Maven and Uploading the Software Package to the Self-hosted Repo (Built-in Executors, GUI)
- Building with Maven to Generate a Private Dependency for Another Build (Built-in Executors, GUI)
- Building with npm and Uploading the Software Package to the Release Repo (Built-in Executors, GUI)
- Building with Maven (Custom Executors, GUI)
- Building with Maven, Uploading the Software Package, and Pushing the Image to SWR (Built-in Executors, Code)
- Running a Multi-Task Maven Build Project (Built-in Executors, Code)
- Using the File from the Self-hosted Repo to Build with Maven and Uploading the Resulting Software Package (Built-in Executors, GUI)
- Running a Build Task on a Custom Environment (Built-in Executors, GUI)
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
Task APIs
- Querying Build History in a Specified Period
- Querying Build History
- Downloading the Keystore File
- Viewing Task Status
- Querying Build Tasks in a Project
- Running a Build Task
- Querying the Latest Successful Build with a Specified Code Repository
- Querying Details of a Build Record
- Querying Success Rate of a Build Task in a Specified Period
- Downloading All Build Logs
- Downloading Logs of Build Actions
- Obtaining Information About Build Records
- Obtaining Details About Build Results
- Stopping a Build Task
- Deleting a Build Task
- Disabling a Build Task
- Restoring a Build Task
- Creating a Build Task
- Updating a Build Task
- Querying a Build Template
- Creating a Build Template
- Deleting a Build Template
- Querying Notifications
- Updating Notifications
- Canceling Notifications
- Obtaining Build Task Details
- Downloading Real-time Build Logs
- Obtaining Build Records of a Task
- CodeArts Build (Unavailable Soon)
- Application Examples
- Appendix
- Change History
-
FAQs
-
General
- Can I Run a Build Task with a Specific Server or Server Configuration?
- Why Are the Required Project Files Not Found During Builds?
- Files Not Found During Software Package Upload
- Why Am I Prompted that My Permissions Are Insufficient When Running a Build Task?
- Why Am I Prompted that the Build Task Does Not Exist When Calling It Through a Pipeline?
- Why Is My Task Stopped?
- How Do I Migrate Common Java Projects Created with Eclipse to the Cloud?
- Service Endpoint Did Not Exist
- Incomplete JAR Due to Parallel Build Tasks
- How Do I Resolve the Error Occurred When Pulling the Sub-module During My Build?
- How Do I Fix the Submodules Checkout Error Due to a Failure to Obtain Its Revision?
- Why Are the Submodules Not Being Pulled During My Build?
-
Maven Builds
- What Can I Do If License Check Fails?
- Failed to Upload a Package Using the maven deploy Command
- How Do I Deal With the Missing POM File?
- How Do I Deal With the Missing Package or Symbol?
- Using the exec-maven-plugin Extension for Maven and NPM Hybrid Builds
- How Do I Fix the Errors Related to References Among Multiple Child and Parent Projects?
- How Do I Configure and Clear the Cache for a Maven Build?
- How Do I Find the Correct Build Package Path?
- How Do I Use jib-maven-plugin to Build a Maven Project and Create an Image?
- Why Is the New Package Still Built from the Old Code Even After the Code Has Been Updated?
- Why Is My Download of Maven Components Slow?
-
Android Builds
- How Do I Deal With the Unstable Jcenter () Configured for a Project?
- What Should I Do If an Error Occurs During the Lint Check and the Task Stops?
- What Should I Do When Dependency com.android.tools.build:gradle:3.0.1 Cannot Be Downloaded?
- Why Am I Seeing the Error Message "Javadoc generation failed"?
- Why Am I Seeing the Error Message "Could not find method google()"?
- What Can I Do If the Gradle Version Is Too Early?
- How Do I Fix the Android APK Signing Failure?
- Using Gradle for Build
-
npm Builds
- Why Am I Seeing the Error Message "JavaScript heap out of memory"?
- Why Am I Seeing the Error Message "enoent ENOENT: no such file or directory"?
- Why Am I Seeing the Error Message "Module not found: Error: Can't resolve ..."?
- Why Did My Build Fail Without Displaying Any Errors?
- Why Am I Seeing the Error Message "npm cb() never called"?
- Why Am I Seeing the Error Message "gyp ERR!"? stack Error: EACCES: permission denied
- Why Am I Seeing the Error Message "eslint: error 'CLODOP' is not defined"?
- How Do I Fix the node-sass Download Failure?
- Why Am I Seeing the Error Message "error: Could Not Write Config File"?
- Why Does It Take Long to Install Dependencies and Build?
- What Should I Do When the Dependency Version Cannot Be Found?
-
Images
- Failed to Create an Image Using Dockerfile
- Failed to Push Images to SWR
- How Do I Resolve the Image Pull Failure During a Build Task?
- No Permission to Pull Images When SWR Public Images Are Used
- Failed to Log In to the Image Repository
- How Do I Push an Image to Other Tenants?
- Pulling Docker Hub Images Times Out or Exceeds the Max. Attempts
-
General
- Videos
- General Reference
Copied.
Creating a Docker Image with a Maven Artifact and Pushing the Image to SWR (Built-in Executors, GUI)
Scenario
In this practice, you use CodeArts Build to build a Maven project. Afterward, you create a Dockerfile that outlines the process of packaging the Maven build outputs into a container image. Then, you build a Docker image from the Dockerfile and push the image to the image repository in SoftWare Repository for Container (SWR). The build output contained within the image can be used for future compilation or deployment purposes.
Requirements
- You have created an organization named codeci_gray in SWR.
- You have permissions for CodeArts Repo.
Procedure
Step |
Description |
---|---|
Create a project. |
|
Create the code file used for your build. |
|
Create, configure, and run a build task. |
|
Check the build logs and result files to verify the build results. |
Creating a Project
- Log in to the Huawei Cloud console with your Huawei Cloud account.
- Click
in the upper left corner and choose Developer Services > CodeArts from the service list.
- Click Access Service. The homepage of CodeArts is displayed.
- Click Create Project, and select the Scrum template.
- Set the project name to build-bestpractice, and leave the other parameters as default.
- Click OK to access the project.
Creating a CodeArts Repo Repository
- In the navigation pane, choose Code > Repo.
- On the displayed page, click New Repository. Select Template, and click Next.
- On the template selection page, select the Java Maven Demo template and click Next.
- On the displayed page, set Repository Name to build_docker_image_repo, and leave the other parameters as default. Click OK. The details page of the new code repository is displayed.
- In the root directory of the code repository, choose Create and select Create File from the drop-down list.
Figure 1 Creating a file
- Name the file Dockerfile, copy the following code to the file (as shown in Figure 3), and click Submit.
FROM ubuntu:latest # set maintainer LABEL maintainer=build RUN mkdir /release_app COPY ./target/javaMavenDemo-1.0.jar /release_app/maven_app.jar USER build
javaMavenDemo-1.0.jar is the file name in the format of ${artifactId}-${version}.${packaging} defined in the pom.xml file, as shown in Figure 2.
Creating a Build Task
- In the navigation pane, choose CICD > Build.
- Click Create Task. On the displayed Basic Information page, set parameters according to Table 2. Then, click Next.
Table 2 Basic information Parameter
Description
Name
Assign a custom name to the build task, for example, build_docker_image_task.
Code Source
Select the code source from which code will be pulled for your build. In this practice, select Repo.
Repository
Select build_docker_image_repo, the code repository created in Creating a CodeArts Repo Repository.
Default Branch
Keep the default value master.
- Select Blank Template and click OK to create the build task. The Build Actions page is displayed.
- On the Build Actions page, click the GUI tab. Then click Add Build Actions on the left and add the Build with Maven action. Leave the parameters as default.
- Click Add Action. In the right pane, click the Container related tab. Hover over action Build Image and Push to SWR and click Add on the card. Set the parameters according to Figure 4.
Expand the Organization drop-down list and select hwstaff_codeci_gray created to meet the requirements. Type release_image in the Image Name text box, and v1.0 in Image Tag. Leave the other parameters as default.
- Click Save and Run in the upper right corner. In the displayed dialog box, click Confirm. The build task run page is displayed.
Viewing the Build Results
- On the Actions tab, check that the console displays the logs of the build task as it runs. The Build Logs window automatically scrolls down to show new entries. As shown in Figure 5, the build log window displays the information about the product of the Maven build.
- After the build task is successfully run, go to the SWR console. Choose My Images and click the Private Images tab (which is displayed by default). From there, click the name of the image (release_image) created in 5 to access its details page.
Figure 6 Image list
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