Adding a Managed Build Stage

Add a Managed Build stage in the build pipeline.

You must add code repositories in this stage for the build. The repositories must be configured before adding the Managed Build stage. For creating repositories, see Managing Code Repositories.

Before you add a stage, you must have a build pipeline.

For accessing DevOps using the Oracle Cloud Console, REST API, and CLI, see Accessing DevOps.

    1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
    2. Select a project and a build pipeline.
    3. To add a stage to the pipeline, click the + icon and select Add stage.
    4. For the stage type, select Managed Build, and then click Next.
    5. Enter a name and description for the stage. Adding a description is optional.
    6. Select the build runner shape.

      You can select the default shape (quick start option) or you can customize by selecting the required number of OCPUs and amount of memory (in GB). The customization takes longer to provision.

    7. Select Oracle Linux 7 as the base container image.
    8. (Optional) To access private virtual network:
      1. Select a Virtual Cloud Network (VCN) and regional subnet in the tenancy.
      2. (Optional) For restricting access to the VCN, you can select Network security groups (NSGs) in the VCNs.

      VCNs internal Domain Name System (DNS) resolution isn't supported for private access. Use IPs to communicate with services hosted in the private network.

    9. (Optional) Enter the path for the build specification file.

      The build specification contains build steps and settings that the build pipeline uses to run a build.

      Note

      This step is required only if the build specification file, build_spec.yaml isn't located in the root directory of the primary code repository.
    10. Select the primary code repository for the build.
      • Select the connection type and a connection for the repository. Supported connection types are:

        Only the external connections that you have already configured are available for selection. If no connections exist, then click the Create a connection link.

      • If you select GitHub or GitLab, then select a repository.
      • If you select Bitbucket Cloud, then select a workspace and a repository.
      • If you select Visual Builder Studio (VBS), then select an external VBS project and a repository.
      • If you select Bitbucket Server or GitLab Server, then enter the repository URL that contains the build source.
      • Select or enter a branch for the selected code repository.

        The build happens on the branch which triggers the build run and not from the branch that's configured while adding the build stage. The configured branch can be used when the build run is manually triggered through the OCI Console.

      • For Build Source Name, enter a unique name for the folder where the source code is downloaded on the build runner. Examples: Source1, Source2.
      • Save the changes.
    11. To add more code repositories, click Add Build Source and select the repositories.
    12. (Optional) Enter a timeout value (in seconds) for the stage.
    13. (Optional) To add tags to the stage, click Show tagging options. Tagging is a metadata system that lets you organize and track the resources in the tenancy.

      If you have permissions to create a resource, you also have permissions to add free-form tags to it.

      To add a defined tag, you must have permissions to use the tag namespace.

      For more information, see Resource Tags.

    14. To add the stage to the pipeline, click Add.

      A stage preview provides a snapshot of the configuration.

    You can add the following stages sequentially or in parallel to the pipeline:
    • Deliver Artifacts: Store the software applications created from the Managed Build stage in the Oracle Cloud Infrastructure (OCI) Artifact Registry or OCI Container Registry repositories.
    • Trigger Deployment: Start a deployment pipeline to deploy the output from the build pipeline.
    • Wait: Pause a specific duration for testing the build pipeline.

    You can manually run the build or automatically trigger a build run when you commit the changes to the code repository. Manual run uses the latest commit to the code repository. You can run the build based on specific commit by noting the commit details.

  • To create a build pipeline, run the create command:

    oci devops build-pipeline create --project-id

    To add a Managed Build stage for the pipeline, run the create-build-stage command:

    oci devops build-pipeline-stage create-build-stage

    Required parameters are:

    • --build-pipeline-id
    • --build-source-collection
    • --image
    • --stage-predecessor-collection

    Optional parameter for configuring the build runner shape is:

    --build-runner-config

    To get all the commands for build-pipeline and build-pipeline-stage:

    oci devops build-pipeline -h
    oci devops build-pipeline-stage -h

    To get help for the create-build-stage command:

    oci devops build-pipeline-stage create-build-stage -h
  • To create a build pipeline, use the CreateBuildPipeline operation.

    To add a Managed Build stage for the pipeline, use the CreateBuildPipelineStage operation. For the buildPipelineStageType attribute, specify the value as BUILD.

    In addition to the CreateBuildStageDetails request, you must add one of the given attributes for customizing the build runner shape:

    .buildRunnerShapeConfig(CustomBuildRunnerShapeConfig.builder().ocpus(<no_of_ocpus>).memoryInGBs(<memory_in_gbs>).build())
    .buildRunnerShapeConfig(DefaultBuildRunnerShapeConfig.builder().build())