Creating a Common Job

  • The software package or image package can be generated with a few clicks in job building. 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 Kubernetes Clusters.
  2. You have bound an elastic IP address to the build node by referring to Assigning an EIP and Binding It to an ECS.

Procedure

  1. Log in to ServiceStage, choose Continuous Delivery > Build, and click Create Common Job.
  2. Perform the following operations to set basic information:

    1. Enter Name.
    2. Specify Enterprise Project.

      Provides a cloud resource management mode, in which cloud resources and members are centrally managed by project.

      It is available after the enterprise center is enabled.

    3. (Optional) Enter a job description.
    4. Set the code source.
      • Create authorization by referring to Authorizing a Repository and set the code source.
      • Select a sample library and select a required sample.
    5. Set a cluster.
      • Build with shared cluster

        Use the shared cluster allocated by the system. The shared cluster supports Hybrid Cluster and Kunpeng Cluster.

      • Build with your own cluster

        If you use your own cluster to perform build task, you can deliver build task to fixed nodes through node labels. For details about how to add filter labels, see Node Management.

    6. Click Next.

  3. Select a build template.

    The template supports compilation and archive of the binary package or Docker image at the same time. Alternatively, you can click Custom and then flow 6 to add a job directly.

  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.

    Click to delete parameters set.
    • Compilation parameters

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

    • Image parameters

      In Make Docker Image, enter Task Name, Dockerfile address, Image, and Image Version.

    • Image archiving parameters

      In Archive to SWR Image Repository, set Task Name, Archive image, Repository Organization, and Sharing Type of the corresponding image to archive the image.

    • Binary parameters

      Set the following parameters in Archive to SWR Software Repository:

      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

      Path of the software package archived to the software repository after the build completes.

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

    To add multiple tasks, you can customize them in Advanced Configuration.
    1. Click Add plugin in the corresponding stage on the left. The Select task type page is displayed.
    2. Click select of the target task type to add a task type. Then, set task parameters in the right pane of the Build environment configuration page.

      The command plug-in (Build Common Cmd) supports multiple build languages such as Java, Go, Node.js, PHP, Tomcat, and Python.

      When building a Python project that complies with the WSGI standard, you need to set the main module and main module functions.

      The following is an example of the main Python project and main function name:

      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.

    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 Job Name and view the build history under Build Record.
  2. Click a record to view the records.
  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

Click Build Now in the Operations column of a job.

Branch/Tag

Click Branch/Tag in the Operations column of the target job.

  1. Select Branch/Tag.
  2. Enter the CommitId of the mapping Branch/Tag.

Edit

Choose More > Edit in the Operations column of the target job.

Delete

Choose More > Delete in the Operations column of the target job.