Updated on 2023-06-25 GMT+08:00

Creating a Source Code Job

The software package or image package can be generated with a few clicks in a build job. In this way, the entire process of source code pull, compilation, packaging, and archiving is automatically implemented.

  • Images built in the x86-system jobs are ones of the x86 system.
  • Images built in the Arm-system jobs are ones of the Arm system.

Prerequisites

  1. A cluster has been created. For details, see Creating a CCE Cluster.
  2. An EIP has been bound to the build node. For details, see Assigning an EIP and Binding It to an ECS.

Procedure

  1. Log in to ServiceStage, choose Continuous Delivery > Build, and click Create Source Code Job.
  2. Configure basic information.

    1. Enter Name.
    2. (Optional) Enter Description.
    3. Set Code Source.
      • Create authorization by referring to Authorizing a Repository and set the code source.
      • Click Samples and select a required sample.
    4. Select a cluster from the Cluster drop-down list.
    5. (Optional) Specify Node Label to deliver the build job to a fixed node based on the node label. For details about how to add a node label, see Adding a Node Label.
    6. Click Next.

  3. Select a build template.

    • If you select Maven, Ant, Gradle, Go, or Docker, you can compile and archive binary packages or Docker images at the same time. Go to 4.
    • If you select Custom, you can customize the build mode. Go to 6.

  4. Select an archive mode.

    • Not archived: No Docker build job is added or archived.
    • Archive binary package: No Docker build job is added and binary packages are archived.
    • Archive image compilation: Docker build job is added and Docker images are archived.

  5. Set mandatory parameters.

    To delete a parameter setting, click on the parameter setting page.
    • Build parameters

      Compilation parameters are set with different values. For details about parameter description, click a text box or next to it.

    • Image parameters

      On the page, enter Job Name, Dockerfile Path, Image Name, and Image Tag.

    • Image archiving parameters

      On the page, enter Job Name, Archive Image, Repository Organization, and Type of the corresponding image to archive the image.

    • Binary parameters

      On the page, set the following parameters.

      Parameter

      Description

      Task Name

      Task name.

      Sharing Type

      Repositories are classified into public repositories and private repositories.

      • Public repositories are isolated from each other. Tenants in the same system can resources.
      • Private repositories are isolated by tenants. Users under the current tenant share resources. Other tenants cannot access resources of the current tenant.

      Repository Organization

      Namespace of a repository.

      Software Repository

      Name of a software repository.

      Name

      Name of the archived software package after the build completes.

      Software Package Version

      Version of the archived software package.

      Build Package Path

      Address of the binary software package generated after the compilation and build are complete. For example, ./target/xxx.jar in the Java project.

  6. (Optional) Click Advanced Configuration to set the environment.

    To add multiple tasks, you can customize them in Advanced Configuration.
    1. Click Add Plug-in in the corresponding stage on the left. The Select Job Type page is displayed.
    2. Click Select of the target task type to add a task type. Then, configure task parameters in the right pane of the Environment Configurations page.

      When the Build Common Cmd plug-in is added to the compilation process, pay attention to the following:

      • Exercise caution when inputting sensitive information in the echo, cat, or debug command, or encrypt sensitive information to avoid information leakage.
      • When Language is set to Python and Python Framework Type is set to a Python project that complies with the WSGI standard, you need to set Main Python Module and Function of the Main Python Module. The following is an example of the main Python module and main function:

        Main Python Module: If the entry point file of the Python project is server.py, the main module name is server.

        Function of the Main Python Module: If the application function name of the Python project entry point file server.py is app=get_wsgi_application(), the function name of the main module is app.

  7. Click Build to save the settings and start the build.

    Click Save to save the settings (not to start the build).

Related Operations

After an application component is successfully built, you can manage it on ServiceStage. For details, see Deployment Mode.

Maintenance

Table 1 Maintenance

Operation

Description

Query details/build history

  1. Click the target build project and view the build history under Build Record.
  2. Click a record to view the record.
  3. Click Code Check to view the code check overview and details. Currently, the following code check plug-ins are supported: Checkstyle, FindBugs, and PMD.
    NOTE:

    Only the Maven build project supports code check.

Build Now

Select the target build project and click Build Now in the Operation column.

Branch/Tag

Select the target build project created based on source code and click Branch/Tag in the Operation column.

  1. Select Branch/Tag.
  2. Select the corresponding branch or tag from the drop-down list.
  3. Specify Commit ID for the branch or tag.
  4. Click OK.

Edit

Select the target build project you create and choose More > Edit in the Operation column to edit the build project.

Delete

  1. Select the target build project you create and choose More > Delete in the Operation column.
  2. Click OK.