The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Add Deployment Stage to Build Plan

Last updated: 2024-09-05 16:44:21

Before you trigger deployment in Continuous Integration, go to the Application Center to associate your application with the project.

This document provides two methods of configuration. You can selectively read based on your needs.
Directly use a build plan template
Add a deployment stage to an existing build plan

Use Build Plan Template

Associate the cloud account for the relevant cluster in the Application Center. For more information, see Cloud Account.
Click on the Continuous Integration in the left product column, then click on the upper right corner to create a build plan. Select the template under Deployment category, which is Push to Kubernetes.

Follow the template prompts to select the appropriate artifact repository, remote cluster address, and other information. After completion, check the option to trigger build after creation.

After the setup is complete, you can run the continuous build plan to automate the release process.

Add Deployment Stage

In this method, you can use the editor or fill in commands to add deployment stages in Build Plan > Flow Configuration.

Graphical editor

Add a Deployment stage in the existing build plan settings, and then fill in the image URL, cluster, namespace, etc.

Jenkinsfile
stage('Deploys to the remote Kubernetes cluster') {
steps {
cdDeploy([
deployType: 'PATCH_IMAGE',
application: "${CCI_CURRENT_TEAM}",
pipelineName: "${PROJECT_NAME}-${CCI_JOB_NAME}-${CD_CREDENTIAL_INDEX}",
image: "${CODING_DOCKER_REG_HOST}/${CODING_DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION}",
cloudAccountName: "${CD_ACCOUNT_NAME}",
namespace: "${CD_NAMESPACE_NAME}",
manifestType: "${CD_MANIFEST_TYPE}",
manifestName: "${CD_MANIFEST_NAME}",
containerName: "${CD_CONTAINER_NAME}",
credentialId: "${CD_CREDENTIAL_ID}",
personalAccessToken: "${CD_PERSONAL_ACCESS_TOKEN}",
])
}
}