Chapter 3. Managing Builds
As an application developer, modify or delete the custom resources (CR) that are not used in builds. This helps in maintaining a clean and efficient build configuration.
3.1. Editing the resources Copy linkLink copied to clipboard!
You can edit the resources that are created by buildah, source-to-image and buildpacks build processes using the oc CLI. You can modify the resources as needed in your project.
Prerequisites
-
You have installed the
ocCLI.
Procedure
Run the following command to open the YAML definition in the default editor:
oc edit <resource_name> <build_resource_name>
$ oc edit <resource_name> <build_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<resource_name>-
Specifies the name of the resource (
build,buildrunorbuildstrategy) <build_resource_name>- Specifies the name of the build resource that you want to edit.
- Edit the YAML definition and save the file.
3.2. Deleting a build resource Copy linkLink copied to clipboard!
Delete a build resource created by the buildah, source-to-image (S2I), and buildpacks build processes using the oc CLI or the shp CLI. This cleanup ensures that unused build configurations are removed, keeping your project organized and efficient.
Prerequisites
-
You have installed the
ocCLI. -
Optional: You have installed the
shpCLI.
Procedure
Delete a
buildresource by using theocCLI orshpCLI:oc delete builds <build_resource_name>
$ oc delete builds <build_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow shp build delete <build_resource_name>
$ shp build delete <build_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<build_resource_name>-
Specifies the name of the
buildresource.
Verification
Verify that the
buildresource is deleted by using theocCLI orshpCLI:oc get build | grep <build_resource_name>
$ oc get build | grep <build_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow shp build list | grep <build_resource_name>
$ shp build list | grep <build_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<build_resource_name>Specifies the name of the
buildresource.If the
buildresource is successfully deleted, the commands do not return any output.
3.3. Deleting a buildrun resource Copy linkLink copied to clipboard!
Delete a buildrun resource created by the buildah, source-to-image (S2I), and buildpacks build processes if it is not required in your project. Deleting the resources helps you clean up build configurations that are no longer required in your project.
Prerequisites
-
You have installed the
ocCLI. -
Optional: You have installed the
shpCLI.
Procedure
Delete a
buildresource by using theocCLI orshpCLI:oc delete buildrun <buildrun_resource_name>
$ oc delete buildrun <buildrun_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow shp build list | grep <buildrun_resource_name>
$ shp build list | grep <buildrun_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<buildrun_resource_name>Specifies the name of the
buildrunresource.If the
buildrunresource has been successfully deleted, the commands do not return any output.
Verification
Verify that the
buildrunresource is deleted by using theocCLI orshpCLI:oc get buildrun | grep <buildrun_resource_name>
$ oc get buildrun | grep <buildrun_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow shp buildrun list | grep <buildrun_resource_name>
$ shp buildrun list | grep <buildrun_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<buildrun_resource_name>Specifies the name of the
buildrunresource.If the
buildrunresource is successfully deleted, the commands do not return any output.
3.4. Deleting a buildstrategy resource Copy linkLink copied to clipboard!
Delete a buildstrategy resource to remove unused build configurations and keep your project clean and efficient.
Prerequisites
-
You have installed the
ocCLI. -
Optional: You have installed the
shpCLI.
Procedure
Delete a
buildstrategyresource by using theocCLI:oc delete buildstrategy <buildstrategy_resource_name>
$ oc delete buildstrategy <buildstrategy_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<buildstrategy_resource_name>-
Specifies the name of the
buildstrategyresource.
Verification
Verify that the
buildstrategyresource is deleted by using theocCLI orshpCLI:oc get buildstrategy | grep <buildstrategy_resource_name>
$ oc get buildstrategy | grep <buildstrategy_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow shp buildstrategy list | grep <buildstrategy_resource_name>
$ shp buildstrategy list | grep <buildstrategy_resource_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<buildstrategy_resource_name>Specifies the name of the
buildstrategyresource.If the
buildstrategyresource has been successfully deleted, the commands do not return any output.