×

Prerequisites

  • You have access to the OpenShift Container Platform web console.

  • You have installed the oc CLI.

  • You are logged in to the OpenShift Container Platform cluster as an administrator.

  • Your cluster has the Marketplace capability enabled or the Red Hat Operator catalog source configured manually.

As a dependency component, the Red Hat OpenShift Pipelines Operator is automatically installed along with the Builds for Red Hat OpenShift Operator during installation. If you have already installed the Red Hat OpenShift Pipelines Operator, Builds uses that Operator for its functioning.

Installing Builds by using the web console

You can install the Builds for Red Hat OpenShift Operator from the OperatorHub by using the OpenShift Container Platform web console. Installing this Operator enables you to install and use build components.

Procedure
  1. In the Administrator perspective of the web console, navigate to the OperatorsOperatorHub page.

  2. Use the Filter by keyword box to search for Builds for Red Hat OpenShift Operator in the catalog.

  3. Click the Builds for Red Hat OpenShift Operator tile.

  4. Read the brief description about the Operator and click Install.

  5. On the Install Operator page:

    1. Check that the Installation Mode is set to All namespaces on the cluster (default). This mode installs the Operator in the default openshift-operators namespace to watch and be made available to all namespaces in the cluster.

    2. Check that the Installed Namespace is set to openshift-operators by default.

    3. Select Automatic for the Approval Strategy. This ensures that the future upgrades to the Operator are handled automatically by the Operator Lifecycle Manager (OLM). If you select the Manual approval strategy, OLM creates an update request. As a cluster administrator, you must then manually approve the OLM update request to update the Operator to the new version.

    4. Select an Update Channel:

      • The Update Channel is set to latest by default. The latest channel enables installation of the most recent stable version of the Builds for Red Hat OpenShift Operator.

      • To install a specific version of the Builds for Red Hat OpenShift Operator, cluster administrators can use the corresponding openshift-builds-<version> channel. For example, to install the Builds for Red Hat OpenShift Operator version 0.11.0, you can use the openshift-builds-0.11.0 channel.

  6. Click Install.

Verification
  • On the Installed Operators page, verify that the Builds for Red Hat OpenShift Operator is listed and its Status is set to Succeeded to confirm successful installation.

Creating a ShipwrightBuild resource by using the web console

After installing the Builds for Red Hat OpenShift Operator, you must create a ShipwrightBuild resource to enable the functioning of the build controller.

Procedure
  1. In the Administrator perspective of the web console, navigate to the Operators → Installed Operators page.

  2. Click the Builds for Red Hat OpenShift Operator link present in the list. The Operator details page opens.

  3. Select the Shipwright Build tab and click Create ShipwrightBuild.

  4. Select either the Form view or YAML view to configure a new ShipwrightBuild resource in the following manner:

    • On selecting the Form view or YAML view, you get to see the default values configured for the name and targetNamespace fields. If you do not want to edit those fields, click Create to configure the ShipwrightBuild resource with default values.

      You can view the created resource in the Shipwright Build tab.

Verification
  • Build controller and build webhook pods must have been created in the mentioned target namespace.

Installing Builds by using the CLI

You can also install Builds by using the CLI.

Procedure
  1. Create a sub.yaml subscription object file to subscribe a namespace to the Builds for Red Hat OpenShift Operator, as shown in the following example:

    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: openshift-builds-operator
      namespace: openshift-operators
    spec:
      channel: <channel-name> (1)
      name: openshift-builds-operator (2)
      source: redhat-operators (3)
      sourceNamespace: openshift-marketplace (4)
    1 The channel name from where you want to subscribe the Operator.
    2 Name of the Operator to subscribe to.
    3 Name of the CatalogSource that provides the Operator.
    4 Namespace of the CatalogSource. Use openshift-marketplace for the default OperatorHub CatalogSources.
  2. Apply the subscription object by runninng the following command:

    $ oc apply -f sub.yml

    The Builds for Red Hat OpenShift Operator is now installed in the default target namespace openshift-operators.

Creating a ShipwrightBuild resource by using CLI

After installing the Builds for Red Hat OpenShift Operator, you must create a ShipwrightBuild resource to enable the functioning of the build controller.

Procedure
  1. Create a instance.yaml file to create a ShipwrightBuild resource in the shipwright-builds namespace, as shown in the following example:

    apiVersion: operator.shipwright.io/v1alpha1
    kind: ShipwrightBuild
    metadata:
      name: openshift-builds
    spec:
      targetNamespace: openshift-builds
  2. Apply the YAML file by runninng the following command:

    $ oc apply -f instance.yaml
Verification
  • Run the following command to verify that the ShipwrightBuild resource is now configured:

    $ oc get pods -n shipwright-builds

Disabling ShipwrightBuilds build controller and webhook pod

You can disable the ShipwrightBuilds Custom Resource (CR) without disabling the shared-resources Container Storage Interface (CSI) driver component and the ShipwrightBuilds Custom Resource Definition (CRD). Disabling the ShipwrightBuilds CR removes the ShipwrightBuilds build controller and ShipwrightBuilds build webhook pod from the openshift-builds namespace.

Procedure
  • Disable the ShipwrightBuilds controller and webhook by running the following command:

    $ oc patch openshiftbuild cluster --type=merge -p '{"spec":{"shipwright":{"build":{"state":"Disabled"}}}}'

    This command disables the build controller and webhook but does not affect the ShipwrightBuilds CRD.

Additional resources