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:

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.

Before you begin:
Add a control repo or module to Continuous Delivery, configure job hardware, and set up a pipeline in the web UI:
  1. In the Continuous Delivery web UI, navigate to the control or module repo that has pipelines you want to manage with code.
  2. At the top of the Pipelines section, click Manage pipelines > Manage as code.
  3. Continuous Delivery displays your pipelines in YAML format. Copy the YAML code by clicking Copy to clipboard at the bottom of the code block.
  4. 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.
  5. Save the .cd4pe.yaml file to the repo's root directory (on any branch) and commit the change in your source control system.
  6. 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.
  7. Click Save settings.
Results
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.
What to do next
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.

Before you begin:
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.
  1. 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.

  2. 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.
  3. Click Save settings.
Results
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.
What to do next
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.

Before you begin:
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.
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.
  1. 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.
  2. Add the control repo or module to Continuous Delivery.

    For instructions, go to Add repositories.

  3. 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.
Results
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.
What to do next
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.

  1. 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.
  2. At the top of the Pipelines section, click Manage pipelines > Manage in the web UI, and make any necessary adjustments to the pipeline settings.
  3. Click Save settings.
Results
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.
To avoid confusion, remove the .cd4pe.yaml file from the repo's root directory in source control.
What to do next
If you want to go back to managing pipelines as code, you can Convert your existing pipelines to code.