- Function Overview
- Product Bulletin
- Service Overview
- Billing
- Getting Started
-
User Guide
- Clusters
- Workloads
- Network
- Storage
- O&M
- Namespaces
- ConfigMaps and Secrets
- Auto Scaling
- Add-ons
- Helm Chart
- Permissions
- Settings
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs
- Autopilot Cluster Management
- Add-on Management for Autopilot Clusters
-
Autopilot Cluster Upgrade
- Upgrading a Cluster
- Obtaining Cluster Upgrade Task Details
- Retrying a Cluster Upgrade Task
- Obtaining a List of Cluster Upgrade Task Details
- Performing a Pre-upgrade Check for a Cluster
- Obtaining Details About a Pre-upgrade Check Task of a Cluster
- Obtaining a List of Pre-upgrade Check Tasks of a Cluster
- Performing a Post-upgrade Check for a Cluster
- Backing Up a Cluster
- Obtaining a List of Cluster Backup Task Details
- Obtaining the Cluster Upgrade Information
- Obtaining a Cluster Upgrade Path
- Obtaining the Configuration of Cluster Upgrade Feature Gates
- Enabling the Cluster Upgrade Process Booting Task
- Obtaining a List of Upgrade Workflows
- Obtaining Details About a Specified Cluster Upgrade Booting Task
- Updating the Status of a Specified Cluster Upgrade Booting Task
- Quota Management for Autopilot Clusters
- Tag Management for Autopilot Clusters
-
Chart Management for Autopilot Clusters
- Uploading a Chart
- Obtaining a Chart List
- Obtaining a Release List
- Creating a Release
- Updating a Chart
- Deleting a Chart
- Updating a Release
- Obtaining a Chart
- Deleting a Release
- Obtaining a Release
- Downloading a Chart
- Obtaining Chart Values
- Obtaining Historical Records of a Release
- Obtaining the Quota of a User Chart
- Kubernetes APIs
- Permissions and Supported Actions
- Appendix
-
FAQs
- Billing
- Workloads
- Network Management
-
Storage
- Can PVs of the EVS Type in a CCE Autopilot Cluster Be Restored After They Are Deleted or Expire?
- What Can I Do If a Storage Volume Fails to Be Created?
- Can CCE Autopilot PVCs Detect Underlying Storage Faults?
- How Can I Delete the Underlying Storage If It Remains After a Dynamically Created PVC is Deleted?
- Permissions
- General Reference
Copied.
Building and Executing a Pipeline on Jenkins
Building a Pipeline
Build a pipeline in Jenkins to pull code from the code repository, pack the code into an image, and push the image to the SWR image repository.
- Click Dashboard in the upper left corner of the page to switch to the Jenkins Dashboard page. In the navigation pane on the right, click New Item.
- Enter an item name (for example, test-pipe) and select Pipeline.
Figure 1 Pipeline
- Configure only the pipeline script and retain the default values for other parameters.
The following pipeline script is for reference only. You can modify the script content based on your service requirements. For details about the syntax, see Pipeline.
def swr_region = "cn-east-3" def organization = "container" def git_repo = "http://github.com/xxx.git" def app_git_branch = "master" podTemplate( inheritFrom: 'jenkins-agent', // Replace the value with the name of the pod template created in 5. cloud: 'ap-test' // Replace the value with the name of the cloud created in 4. ) { // Pull the code from the code repository. node(POD_LABEL) { stage('Pull the code.') { echo "pull clone" git branch: "${app_git_branch}", url: "${git_repo}" } // Use the maven container to pack the code pulled from the code repository. (This packing method applies only to Java. Use another packing method for other languages.) container('maven'){ stage ('Pack the code.') { echo "build package" sh "mvn clean package -DskipTests" } } // Use the kaniko container to push the packed code to SWR and name the image tomcat. container('kaniko'){ stage('Push the image.') { echo "build images and push images" sh "/kaniko/executor -f Dockerfile -c . -d swr.${swr_region}.myhuaweicloud.com/${organization}/tomcat:${BUILD_ID} --force" } } } }
Table 1 Pipeline script parameters Parameter
Example Value
Description
swr_region
cn-east-3
Region where the SWR image repository is located. For details, see Regions and Endpoints.
NOTE:
The SWR image repository is used to store images packaged by code. The region must be the same as that in 3.
organization
container
Organization name in SWR. You can enter any organization name as needed.
git_repo
https://github.com/xxx.git
Specific address where the code is stored, which is the address of the code library.
app-git-branch
master
Branch of the code library.
- Click Save.
Executing the Pipeline and Viewing the Execution Result
After the pipeline is executed, a pod named pipe-xxx will be automatically created in the cluster, and three containers (named jnlp, kaniko, and maven) will be created in the pod based on the information in the pod template. The pod pulls code from the code repository, packs the code into an image, and pushes the image to the SWR image repository. After the operations are complete, the pod is automatically deleted.
- In the navigation pane, choose Build Now to execute the pipeline job.
- Return to the CCE console and click the cluster name. In the navigation pane, choose Workloads. On the Pods tab, view the pod created by the pipeline.
Figure 2 Pod created by the pipeline
- Click More > View Container in the Operation column. You can see that three containers are created based on the pod template.
Figure 3 Creating a container
- Verify that the pod has been deleted automatically. After the code is pulled from the code repository and packed into an image, and the image is pushed to the SWR image repository, the pod will be automatically deleted.
Figure 4 Automatic pod deletion
- Log in to the SWR console and verify that the Tomcat image is available in the SWR image repository.
Figure 5 Pushed image
Follow-up Operations: Releasing Resources
To avoid additional expenditures, release resources promptly if you no longer need them.
- Log in to the CCE console. In the navigation pane, choose Clusters.
- Locate the cluster, click
in the upper right corner of the cluster card, and click Delete Cluster.
- In the displayed Delete Cluster dialog box, delete related resources as prompted.
Enter DELETE and click Yes to start deleting the cluster.
It takes 1 to 3 minutes to delete a cluster. If the cluster name disappears from the cluster list, the cluster has been deleted.
- Log in to the ECS console. In the navigation pane, choose Elastic Cloud Server. Locate the target ECS and click More > Delete.
In the displayed dialog, select Delete the EIPs bound to the ECSs and Delete all data disks attached to the ECSs, and click Next.
Figure 6 Deleting ECSsEnter DELETE and click OK to start deleting the ECS.
It takes 0.5 minutes to 1 minute to delete an ECS. If the ECS name disappears from the ECS list, the ECS has been deleted.
Figure 7 Confirming the deletion
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