Pipeline as code

2 minute read

Pipeline as code is a practice of defining pipelines through source code which can stored in repository such as GitHub to manage changes. CloudBees Release Orchestration SaaS provides this feature to allow Users to define pipelines in YAML format and stored in a GitHub repository to synchronize the creation & updates to pipelines in Pipeline composer.

Alternatively, Pipeline Composer has YAML editor to allow User to define pipelines without the need for a Git repository. However, all pipelines synchronized from GitHub are displayed in YAML editor in Read-only mode only.

Pipeline as code configuration

Steps to configure Git repository and create first pipeline as code:

  • Configure GitHub repository for Pipelines

  • Use Pipeline as Code Template to define pipeline

  • Verify updates in Pipeline composer

    • Pipelines view & status

    • Error messages

    • Disable, Enable or Delete pipelines

Configure git repository

Configure GitHub repository for Pipelines, do the following:

  • In the Settings screen under Admin tab, click on Settings as Code on the left pane. The Settings as Code Configuration page opens. Select Git Upload

    undefined
  • As a pre-requisite the repository should have a .releaseiq folder(dot releaseiq) in root path with “settings” and “pipelines” as sub folder. Note that the folder names are case sensitive.

    • “settings” sub folder shall contain all Settings as Code files

    • “pipelines” sub folder shall contain all Pipeline as Code files

  • Any updates to Code files in these subfolders will be automatically synced to create/update the corresponding Settings and Pipelines.

  • Download the template file. This is basically a GitHub setting as code with repository configuration.

  • Update the template with GitHub repo name and branch name that contains .releaseiq folder

  • Upload the updated file.

  • On successful upload, the GitHub setting will be created in Source Control Management section. The pipeline repository and branch configured will be displayed as seen in screenshot.

    undefined

Pipeline as code template

Use Pipeline as Code template to define pipeline:

  • In the Pipeline Composer screen under Admin tab, click on Templates on the left pane. A page with list view of all Templates.

    undefined
  • Select any of the template, Click on the download icon to download the Pipeline as Code template in YAML format

  • The YAML file has necessary comments to guide the User in defining the pipeline. Note that the Pipeline Name, Application, Module and Component is mandatory. A component name can be associated to only one pipeline.

  • Check-in the updated YAML file to pipelines folder of the GitHub repository & branch that was configured.

Verify updates in pipeline composer

  • Verify the updates to pipeline in Pipeline composer. (Sync is initiated in less than a minute after a code Check-in). In the Pipeline composer the pipelines are grouped based on the Application specified in Code. All pipelines synced from repository are displayed in read-only view. On successful sync, the pipeline is updated & enabled.

    undefined
  • Any errors in Pipeline definition or processing of pipelines are displayed in Errors section. Few samples screenshot with of the errors:

    undefined
  • On click view of code is provided on clicking open icon highlighted in screenshot.

    undefined
  • The pipelines can be Enabled, Disabled or Deleted from the Pipeline composer.