Configure your pipelines for management with code
To manage pipelines-as-code, you need a .cd4pe.yaml
file containing the pipeline definitions. Use these steps to convert existing pipelines to
code, update pipelines-as-code, or create new pipelines for new repos.
Choose the procedure appropriate for your circumstances:
- If you created pipelines for a control repo or module in the Continuous Delivery web UI and you now want to manage
those pipelines with code, you can Convert your existing pipelines to code.
Continuous Delivery generates a
.cd4pe.yaml
file based on the repo's existing pipelines. You can then Update your pipelines with a new .cd4pe.yaml file when you need to make changes to the pipelines. - If you've created a
.cd4pe.yaml
file you want to use to replace existing pipelines (that you created in the web UI or with another.cd4pe.yaml
file), you need to Update your pipelines with a new .cd4pe.yaml file. - If you have created your own
.cd4pe.yaml
file for a new repo that you haven't yet added to Continuous Delivery, you can Create new pipelines using a .cd4pe.yaml file.This process only applies to new repos you haven't yet added to Continuous Delivery. If you already added a repo to Continuous Delivery, you need to Convert your existing pipelines to code or Update your pipelines with a new .cd4pe.yaml file. - If you want to re-enable the pipeline controls in the web UI, you can Stop managing your pipelines with code.
Convert your existing pipelines to code
If you've created pipelines using the Continuous Delivery web UI, and now want to manage those pipelines with code, Continuous Delivery can render your existing pipelines in YAML format.
Add a control repo or module to Continuous Delivery, configure job hardware, and set up a pipeline in the web UI:
- In the Continuous Delivery web UI, navigate to the control or module repo that has pipelines you want to manage with code.
- At the top of the Pipelines section, click Manage pipelines > Manage as code.
- Continuous Delivery displays your pipelines in YAML format. Copy the YAML code by clicking Copy to clipboard at the bottom of the code block.
- Create a new
.yaml
file named.cd4pe
and paste the YAML code into it.The complete file name must be.cd4pe.yaml
. Make sure you do not miss the leading period. - Save the
.cd4pe.yaml
file to the repo's root directory (on any branch) and commit the change in your source control system. - Go to the control or module repo in the Continuous Delivery web
UI, click Manage pipelines > Manage as code, and, in the Select branch area, select
the branch where you saved the
.cd4pe.yaml
file. - Click Save settings.
Continuous Delivery reads the contents of the
.cd4pe.yaml
file before every pipeline run, and it uses the YAML code to
render the pipelines' definitions in the web UI. Because you're now managing this repo's
pipelines with code, the pipeline controls in the web UI are disabled for this
repo.If you need to change this repo's pipelines, Update your pipelines with a new .cd4pe.yaml file. If you want to go back to managing this repo's pipelines with the web UI, you can Stop managing your pipelines with code.
Update your pipelines with a new .cd4pe.yaml
file
You can use a .cd4pe.yaml
file to replace pipelines
you created in the Continuous Delivery web UI or to update pipelines
you're already managing with code.
You need a properly formatted
.cd4pe.yaml
file
containing the definitions of the pipelines you want to create or update. To learn about
.cd4pe.yaml
file syntax, go to .cd4pe.yaml file structure. If you were previously managing pipelines in
the web UI, you can Convert your existing pipelines to code and then update the
resulting .cd4pe.yaml
file, rather than creating a
completely new file.- Add the new or updated
.cd4pe.yaml
file to the root directory of your control repo or module repo, and commit the file to your source control system.If you are updating an existing
.cd4pe.yaml
file, you can replace the previous file. If you save the updated file on a different branch, you need to change the branch in the Continuous Delivery web UI.If the repo does not already have a
.cd4pe.yaml
file, you can save the file to the root directory on any branch in the repo. - Go to the control or module repo in the Continuous Delivery web
UI, click Manage pipelines > Manage as code, and, in the Select branch area, select
the branch where you saved the
.cd4pe.yaml
file. - Click Save settings.
Continuous Delivery reads the contents of the
.cd4pe.yaml
file before every pipeline run, and it uses the YAML code to
render the pipelines' definitions in the web UI. Because you're now managing this repo's
pipelines with code, the pipeline controls in the web UI are disabled for this
repo.Repeat this process when you need to change this repo's pipelines. If you want to switch to managing this repo's pipelines with the web UI, you can Stop managing your pipelines with code.
Create new pipelines using a .cd4pe.yaml
file
You can create pipelines-as-code for a new control repos or module repos that you
haven't yet added to Continuous Delivery. If a .cd4pe.yaml
file exists in the repo when you first add it to Continuous Delivery, the software detects the file and asks if you want to use
it to build and manage your pipelines.
You need a properly formatted
.cd4pe.yaml
file
containing the definitions of the pipelines you want to create. To learn about .cd4pe.yaml
file syntax, go to .cd4pe.yaml file structure.- Add a
.cd4pe.yaml
file to the root directory of the main branch of your control repo or module repo. Commit the file to your source control system. - Add the control repo or module to Continuous Delivery.
For instructions, go to Add repositories.
- After adding the repo, Continuous Delivery detects the
.cd4pe.yaml
file and asks if you want to use it to build and manage your pipelines. Click Confirm.
Continuous Delivery reads the contents of the
.cd4pe.yaml
file before every pipeline run, and it uses the YAML code to
render the pipelines' definitions in the web UI. Because you're managing this repo's
pipelines with code, the pipeline controls in the web UI are disabled for this
repo.If you need to change this repo's pipelines, Update your pipelines with a new .cd4pe.yaml file. If you want to start managing this repo's pipelines with the web UI, you can Stop managing your pipelines with code.
Stop managing your pipelines with code
If you want to use the web UI, instead of a .cd4pe.yaml
file, to manage your pipelines, you can quickly make this switch
in the Continuous Delivery web UI.
- In the Continuous Delivery web UI, navigate to the control repo
or module that has pipelines you are currently managing with a
.cd4pe.yaml
file. - At the top of the Pipelines section, click Manage pipelines > Manage in the web UI, and make any necessary adjustments to the pipeline settings.
- Click Save settings.
The pipeline controls in the web UI are enabled. Continuous Delivery ignores your
.cd4pe.yaml
file and you must make all
pipeline changes in the web UI. .cd4pe.yaml
file from the repo's root directory in
source control.If you want to go back to managing pipelines as code, you can Convert your existing pipelines to code.