IBM Cloud Docs
Integrating Code Engine workloads with Continuous Delivery

Integrating Code Engine workloads with Continuous Delivery

You can automate the build and deployment of your IBM Cloud® Code Engine workloads by creating a toolchain with Continuous Delivery. You can create a toolchain that pulls your source code from a repository and then builds and deploys your app or job. Whenever you update the source code in the repository, the toolchain automatically pulls your updated code and then builds and re-deploys your app or job.

Before you begin

Before you get started with toolchains,

Configuring access for your toolchain

If you want to build and deploy an app or job with a toolchain, set the following permissions in IAM.

IBM Cloud Container Registry

  • Reader: To pull the image from Container registry.
  • Writer: To push the created image to the target namespace.
  • Manager: To create the specified namespace if it does not exist.
  • Administrator: To create a service ID, policies, and an API key needed to set up a Code Engine registry secret to use for the app or job.

Code Engine

  • Editor: To access a Code Engine project or to create one, if it does not exist.
  • Writer: To manage apps, jobs, and secrets within the Code Engine project.

Resource Group:

  • Viewer: To view the resource group that the Code Engine project is located in.

If you want to your app to bind another IBM Cloud service, you must set the following additional permissions.

All Identity and Access enabled services

  • Administrator: To create a service ID, policies, and API key to set up a Code Engine service access secret, which is used to maintain service credentials to connect individual services to a Code Engine app or job.

Creating a toolchain

You can create a toolchain from the Toolchain page by selecting Create toolchain and then choosing the Code Engine template. Want to try a tutorial? See Develop and deploy an app by using Code Engine.

Code Engine options in your toolchain

You can set the following options for your Code Engine toolchain by editing your ci-pipeline Configuration and selecting Environment properties.

Code Engine options in toolchain
Option Description
apikey The IBM Cloud API key that is used for this toolchain.
app-concurrency The maximum number of requests that can be processed concurrently per instance. The default value is 100.
app-deployment-timeout The amount of time, in seconds, that can pass before the build must succeed or fail.
app-health-endpoint The app health endpoint; for example, /health.
app-max-scale The maximum number of instances that can be used for this application. If you set this value to 0, the application scales as needed. The application scaling is limited only by the instances per the resource quota for the project of your application. See Limits and quotas for Code Engine. The default value is 10.
app-min-scale The minimum number of instances that can be used for this application. This option is useful to ensure that no instances are running when not needed. This value is optional. The default value is 0.
app-name The name of the application. Use a name that is unique within the project.
app-port The port where the application listens for incoming connections. The format is [NAME:]PORT, where [NAME:] is optional. If [NAME:] is specified, valid values are h2c or http1. By default, Code Engine assumes apps listen for incoming connections on port 8080.
app-visibility The visibility for the application. Valid values are public, private, and project. Setting a visibility of public means that your app can receive requests from the public internet or from components within the Code Engine project. See Options for visibility for a Code Engine application.
branch The branch in the repository that contains the buildpacks file or the Dockerfile. The default value is main.
build-size The size for the build, which determines the amount of resources used. Valid values are small, medium, large, xlarge, and xxlarge. For details, see Determining the size of the build.
build-strategy The strategy to use for building the image. Valid values are dockerfile and buildpacks.
build-timeout The amount of time, in seconds, that can pass before the build run must succeed or fail. The default is 1200 seconds.
build-use-native-docker Optional property to opt-in for using native Docker build capabilities instead of the Code Engine build to containerize the source. You can select this value only if the build-strategy is set to dockerfile. Valid values are true and false.
code-engine-project The project that contains this application.
cpu The amount of CPU set for the instance of the application. For valid values, see Supported memory and CPU combinations. The default value is 1.
deployment-type Specifies the type of deployment. Valid values are application and job.
ephemeral-storage The amount of ephemeral storage to set for the instance of the application. Use M for megabytes or G for gigabytes.
git-token The access token for the Git repository.
image-name The name of the image that is used for this application. The format is REGISTRY/NAMESPACE/REPOSITORY:TAG where REGISTRY and TAG are optional. If REGISTRY is not specified, the default is docker.io. If TAG is not specified, the default is latest.
memory The amount of memory set for the instance of the application. Use M for megabytes or G for gigabytes. For valid values, see Supported memory and CPU combinations. The default value is 4G.
path-to-context The directory in the repository that contains the buildpacks file or the Dockerfile.
path-to-dockerfile The path to the Dockerfile. Specify this option only if the name is other than Dockerfile.
pipeline-debug The pipeline debug mode. Value can be 0 or 1. Default to 0.
region The region where the Code Engine project is located.
registry-namespace The Container registry namespace that stores the built image.
registry-region The Container registry region.
resource-group The resource group that contains the Code Engine project.
service-bindings The service binding that binds an IBM Cloud service instance to an application. This value is in the format "{&quot;<SERVICE_INSTANCE_NAME>&quot;: &quot;<BINDING_PREFIX>&quot;}". For example, "{&quot;object-store-rg-e&quot;: &quot;CLOUD_OBJECT_STORAGE&quot;}. This value must be in base64.

For more options, see the Environment properties for your pipeline in your toolchain settings.

Troubleshooting toolchain issues

Troubleshoot your Code Engine toolchain with the following topics.