Adding a Managed Build Stage

Learn how to add a Managed Build stage in the build pipeline. This stage builds and tests your software with a fast and scalable Oracle Cloud Infrastructure (OCI) DevOps service managed build runner.

OCI DevOps provides Oracle Linux 7 as the base container image for the build and provides other runtimes such as Java, Git, and Apache Maven. For the entire list of runtimes provided by DevOps, see Build Runner Runtime Details.

You have to add code repositories in this stage for the build. In the DevOps service, you can create your own private code repositories or connect to external code repositories such as GitHub, GitLab, and Bitbucket Cloud. 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.

Using the Console

  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 optional description for the stage.
  6. The default compute shape (OCPU and memory) is displayed for OCI Build Agent Compute Shape.

    The Managed Build stage runs build instructions on a service managed build runner. You are charged for using the compute shape (OCPU and memory) during the build run.

  7. Select Oracle Linux 7 as the base container image.
  8. (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 is not located in the root directory of your primary code repository.
  9. Select the primary code repository for the build.
    • Select the connection type and a connection for the repository. Supported connection types are:

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

    • If you select Bitbucket Cloud, then select a workspace.
    • Select a repository.
    • Select or enter a branch for the selected code repository.
    • 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.
  10. To add more code repositories, click Add Build Source and select the repositories.
  11. (Optional) Enter a timeout value (in seconds) for the stage.
  12. (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 your 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.

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

    A stage preview provides a snapshot of the configuration.

  14. Add more stages sequentially or in parallel to the pipeline, as needed.
You can add the following stages to the pipeline:
  • Deliver Artifacts: Store your 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 your changes to the code repository. Manual run uses the latest commit to your code repository. You can run the build based on specific commit by noting the commit details.

Using the CLI

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

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

Using the API

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.