Code deployment

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

Features

The Code deployment tool provides two ways to deploy application code:
  • Deploy application code by uploading a .zip file to a user-managed Code Engine environment.
  • Deploy application code directly from a GitHub repository using SSH-based authentication. This method eliminates the need to manually create and upload a .zip file.
In addition to deploying application code by uploading a .zip file, the Code deployment tool supports retrieving source code directly from a GitHub repository using SSH-based authentication. This feature simplifies deployment by eliminating the need to manually create and upload a .zip file, allowing you to deploy applications directly from your source repository.
GitHub-based deployment prerequisites
  • A GitHub repository that contains the application source code.
  • You can specify the feature branch and context directory in the prompt. If you do not provide these details, the API Agent uses the main branch and the root directory as defaults.
  • The SSH URL of the repository. For example, git@github.com:<org>/<repo>.git.
  • Set up the SSH-based authentication:
    • Provide a valid SSH private key that has access to the repository.
    • Configure the SSH key in API Agent settings as an optional parameter. For details, see API Agent settings.
Zip file-based deployment prerequisites
Deploy application code by uploading a .zip file to a user-managed Code Engine environment.
Note:
  • Only .zip files are supported for deployment. Other formats are not accepted.
  • The file size must be less than 1 MB.
  • 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 deployment status of application by specifying the .zip file name, the GitHub repository name, or the generated application name.
  • 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.

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 1. 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 2. 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 API and publish it in API Connect with the API Connect Task tool.