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
.zipfile 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
.zipfile.
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
mainbranch 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
.zipfile 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
.zipfile 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
.logfile and provided for download and debugging.
- The fetched logs are packaged as a
- 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 user123under the provider organizationabc.Table 1. Naming conventions Resource type Format Naming convention Project aa-<provider_organization>-projectNote: Projects in IBM Code Engine are scoped to the provider organization within API Connect.aa-abc-projectRegistry secret <project_name>-registry-secretaa-abc-project-registry-secretImage build <project_name>-<application_code_file_name>-<user_id>-<resource_name>aa-abc-project-app-code-123-image-buildImage builds run <project_name>-<application_code_file_name>-<user_id>-<resource_name>aa-abc-project-app-code-123-image-build-runConfigmap <project_name>-<application_code_file_name>-<user_id>-<resource_name>aa-abc-project-app-code-123-cmSecret <project_name>-<application_code_file_name>-<user_id>-<resource_name>aa-abc-project-app-code-123-secretApplication <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:
| Stage | Description | Statuses |
|---|---|---|
| Project creation | Project and secret setup | |
| Image building | Image build and push | |
| Application deployment | Application, configmap, and secret creation | |
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.