Code deployment

The Code deployment tool is used to deploy application source code to IBM® Code Engine, which simplifies the deployment process and reduces manual effort.

The Code deployment tool provides a streamlined and automated deployment process. It supports two types of deployments, IBM-managed and user-managed, and offers features such as retrieving the status of the deployment process, retrieving logs of the deploy application, and deletion of the specified application.

Supported services and deployment types

IBM-managed deployment
Deploys application code to an IBM-managed Code Engine environment, which provides a temporary and self-cleaning setup. The following key features are included:
Temporary resources
The application and related resources are automatically cleaned up after a defined period targeted toward developer persona.
Testing
The developer persona users receive the application URL endpoint and application name for convenient testing.
API Connect SaaS exclusive
This feature is designed for API Connect SaaS, streamlining deployment and testing processes.
User-managed deployment
Easily deploy application code that uses the Agent interface to a user-specified IBM Code Engine service, which offers flexibility and control. The following key features are included:
User-controlled resources
You can retain full control over the lifecycle and configuration of deployed resources.
Deployment details
The tool provides the application URL endpoint and application name upon successful deployment.

Features

Deploying application code
Deploy a .zip file that contains application code to either an IBM-managed or user-managed Code Engine environment.
  • Deploying application code is an asynchronous operation.
  • Query the deployment status separately to retrieve results.
Note:
  • Only .zip files are supported for deployment. Other formats are not accepted.
  • The file size must be less than 1 MB.
  • For information about basic predeployment validation checks, see Predeployment checks for IBM-managed Code Engine.
  • The tool determines the resource allocation for the deployed application as follows:
    • 0.125 CPU
    • 0.5 GB of memory
Check deployment status
Retrieve the status of a deployment based on the .zip file name that is provided by the user.
  • After the deployment is completed, the tool displays the deployment status and the application name and URL endpoint.
  • For more information about the deployment statuses, see Deployment status.
Fetch logs of the application
Retrieve the logs of the application that is deployed in Code Engine.
  • The fetched logs are packaged as a .log file and provided for download and debugging.
Delete application
Delete the application and its related resources.

Predeployment checks for IBM-managed Code Engine

IBM-managed code engine does the checks that are performed before deploying the application and its associated resources.
IBM-managed
For IBM-managed environments, all the following conditions must be met before initiating a deployment.
Table 1. Requirements
Check Requirements
Project limit
  • If the project for the provider organization exists in the IBM Code Engine, the Code deployment tool uses the existing project.
  • If the project does not exists for the provider organization, the Code deployment tool creates a new project in IBM Code Engine if the number of available projects is less than 20.
Project state The project must not be in the creating state.
Existing application The system prevents a different user from deploying an application with the same source code .zip file
Multiple applications Only one application is allowed per project.
Registry secret A registry secret with the same name must not exist.

Naming conventions for deployment of resources

To ensure consistency and traceability, the Code deployment tool follows standardized naming patterns when it creates resources.
IBM Code Engine
Use the following naming conventions when you create deployment resources in the IBM Code Engine services:

The following table shows how resources are created for an application with code file name app-code, which is deployed by user 123 under the provider organization abc.

Table 2. Naming conventions
Resource type Format Naming convention
Project aa-<provider_organization>-project
Note: Projects in IBM Code Engine are scoped to the provider organization within API Connect.
aa-abc-project
Registry secret <project_name>-registry-secret aa-abc-project-registry-secret
Image build <project_name>-<application_code_file_name>-<user_id>-<resource_name> aa-abc-project-app-code-123-image-build
Image builds run <project_name>-<application_code_file_name>-<user_id>-<resource_name> aa-abc-project-app-code-123-image-build-run
Configmap <project_name>-<application_code_file_name>-<user_id>-<resource_name> aa-abc-project-app-code-123-cm
Secret <project_name>-<application_code_file_name>-<user_id>-<resource_name> aa-abc-project-app-code-123-secret
Application <project_name>-<application_code_file_name>-<user_id>-<resource_name> aa-abc-project-app-code-123-app

Deployment status

When you start the deployment status operation, different status are returned by the Code deployment tool to identify the progress or outcome of the deployment.
IBM Code Engine deployment status
The following statuses represent the stages of deployment within IBM Code Engine:
Table 3. Statuses
Stage Description Statuses
Project creation Project and secret setup PENDING, IN_PROGRESS, COMPLETED, FAILED
Image building Image build and push PENDING, IN_PROGRESS, COMPLETED, FAILED
Application deployment Application, configmap, and secret creation PENDING, IN_PROGRESS, COMPLETED, FAILED
Note:
  • All three stages are displayed to indicate which stages are completed, which one is in progress, and which are still pending.
  • If any part of the process fails, the failed stage displays the FAILED status and a reason for the failure.
  • If all stages display the COMPLETED status, the tool provides the Application URL and Application name.
  • Ensure that the source OpenAPI document that the deployed application was generated from is now updated to use the IBM Code Engine Application URL as the value of the servers[0].url. This is essential if the next planned action is to create a draft API and publish it in API Connect with the API Connect Task tool.