メインコンテンツまでスキップ

Build and Deploy an Application

To build and deploy an application, complete the following steps:

  1. Set up the source repository
  2. Create a Harbor robot account
  3. Create the application
  4. Create build pipelines
  5. Create a deployment group
  6. Add a cluster to the deployment group
  7. Add the application to the deployment group
  8. Configure deployment specifications
  9. Deploy and verify the application

Set Up the Source Repository

  1. In the console’s left-side menu, navigate to Dev Tools > Source to open GitHub’s Source Repository Dashboard:

  1. Here, you create the source code repository of an application.

  2. Copy the Git repository URL of the created application.

Create a Harbor Robot Account

To configure container images, create a robot account in the project’s container image registry.

  1. In the console's left-side menu, go to Dev Tools > Images to open the Harbor registry:

  1. In the Harbor window, select the appropriate project from the Projects list:

  1. Navigate to the Robot Accounts tab:

  1. Click the New Robot Account button:

  1. Fill in the required details and click Add:

  1. After creation, the robot account’s name and token will be displayed:

警告

The token will not be shown again. Click the Export to File button to save it.

Create the application

  1. In the project console, go to Applications from the left-side menu:

  1. Click the Create Application button:

  1. Select the source (e.g., From Git Repository):

  1. Fill in the application information:

  1. Configure the Source Repository:

  1. Configure the Container Image:

  1. Review all settings and click Save.

Create Build pipelines

  1. From the Applications list, select your application to open its settings.

  2. Navigate to the Build Pipeline tab.

  3. Click the Add Pipeline button:

  1. Repeat the step to add more pipelines as needed.

  2. After entering all details, click Save.

Create a Deployment Group

A deployment group is required to run the application in a target cluster.

  1. In the left-side menu, click Deployment Groups:

  1. Click the Create Deployment Group button:

  1. Enter a name for the deployment group:

  1. Select a Prevent Cascade Delete option:

    • Enabled (Default): Resources and namespaces are retained when the deployment group or cluster is deleted.
    • Disabled: Resources and namespaces are deleted along with the group or cluster.
  2. Enter the Namespace:

警告

You cannot create a duplicate namespace because a namespace cannot be reused by multiple deployment groups.

  1. In the GitOps Repository section, Enter the Git repository URL where the deployment-related YAML files will be stored:

  1. Click Save.

Add a Cluster to the Deployment Group

Once the Deployment Group is created, you need to add a Cluster to it.

  1. Go to the Clusters tab.

  2. Click the Add Cluster button:

  1. Select a cluster from the list (only assigned clusters will appear on the list):

  1. Click Add Cluster to save.

The selected clusters will now appear in the Clusters tab:

Add the Application to the Deployment Group

You add the applications you have created to the Deployment Group.

  1. Open the Applications tab in the deployment group.

  2. Click the Add Application button:

  1. Select the application to be added.

  2. Choose a YAML Generation Policy:

    • Always: Changes are synced with the GitOps repository.
    • Image Only: Changes are not synced (only the first deployment is saved).
  3. Select a pipeline to deploy:

  1. Turn Auto Deploy ON.

  2. Click Add Applications to save the settings.

The application will now appear in the application list.

Configure the deployment specifications

  1. Click the configuration icon in the Actions column.

  2. Enter the configuration details and click Save.

Deploy application

  1. In the Applications tab, click Deploy.

  2. Select a Build Number from the history.

  3. Click Deploy.

  1. Go to the Overviews tab.

  2. Click History to view past deployments.

  3. Click the magnifying glass icon to view logs. A Running status indicates a successful deployment.