Copying a Code Engine job to create a new job
With IBM Cloud® Code Engine, you can create a new job by copying the configuration of an existing job. The copy create feature duplicates all configuration settings of a source job — including the container image reference, resource allocation, environment variables, and runtime settings — into a new job that you can then customize independently.
The new job is created as a separate, independent workload. Changes to the original job after copying do not affect the new job, and vice versa.
Before you begin, make sure that an existing job is already created in your project.
What is copied when you use copy create?
When you copy a job to create a new job, the following configuration is copied from the source job to the new job.
| Configuration | Description |
|---|---|
| Container image | The image reference, including the registry, namespace, repository, and tag. |
| Registry secret | The registry secret that is used to pull the container image, if specified. |
| Resource allocation | The CPU and memory that are assigned to the job. See Supported memory and CPU combinations. |
| Environment variables | All literal environment variables and references to secrets and configmaps. See Working with environment variables. |
| Runtime settings | The number of job instances, array indices, maximum execution time, and retry limit. See Running a job. |
| Commands and arguments | Any commands and arguments that override the container image entrypoint. See Defining commands and arguments for your Code Engine workloads. |
The new job is assigned the name that you specify. It is not run automatically after it is created.
Build source configuration (repository or local source builds) is not copied to the new job.
Copying a job from the console
You can create a new job by copying the configuration of an existing job with the Code Engine console.
- From the Code Engine Projects page, go to your project.
- Click Jobs, then click the Jobs tab to open a list of your jobs.
- Select one of the following ways to click Create copy:
- Click the name of the job that you want to copy to open its job page. Then click the dropdown chevron in the upper right corner of the page and select Create copy.
- In the jobs list, click the row actions icon (⋮) of the job that you want to copy and select Create copy.
- On the Create job page, the configuration of the source job is pre-populated. Enter a unique name for the new job. Use a name that is unique within the project.
- Review and optionally modify any configuration settings for the new job, such as the container image, resource allocation, or environment variables.
- Click Create to create the new job.
The new job behaves as an independent workload. The source job is not affected by any changes to the new job, and vice versa.
Running a copied job
After the new job is created, you can submit it as a job run in the same ways as any other Code Engine job.
For more information about running a job, see Running a job.
Updating a copied job
After the new job is created, you can update it in the same ways as any other Code Engine job.
For more information about updating a job, see Updating a job.