Skip to content

cloudbees-github-actions/run-process

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Run an Application Process on a remote CloudBees CD/RO instance

Description

This is one of several GitHub Actions provided on an "as-is" basis by CloudBees that enable users to write GitHub Action Workflows that send work to an external CloudBees CD/RO instance. This Action enables workflows to run an existing Application Process on a remote CloudBees CD/RO instance.

Intended audience

For teams utilizing GitHub Actions for build and continuous integration, the CloudBees CD/RO Actions provide a mechanism for releasing software in a secure, governed, and auditable manner with deep visibility, as is required in regulated industries, for example. Platform or shared services teams can build reusable content in the CloudBees CD/RO platform that conforms to company standards and removes the burden of release automation from the application teams.

Prerequisites

CloudBees CD/RO is an enterprise "on-premise" product that automates software delivery processes, including production deployments and releases. To use utilize this GitHub Action, it is necessary to have access to a CloudBees CD/RO instance, in particular,

  • A CloudBees CD/RO instance that GitHub Actions can access through REST calls (TCP port 443)
  • A valid API token for the CloudBees CD/RO instance. A token can be generated from the Access Token link on the user profile page of the CloudBees CD/RO user interface; see Manage access tokens via the UI documentation for details. These values should be stored as GitHub Action secrets to be referenced securely in a GitHub Actions workflow.

Usage

The CloudBees CD/RO GitHub Actions are called from steps in a GitHub Actions workflow. The following workflow extract illustrates how to run an existing Application Process on a remote CloudBees CD/RO instance, including actual parameters.

steps:
  - name: Run Process
    uses: cloudbees-github-actions/run-process@v1
    env:
      CDRO_URL: ${{ secrets.CDRO_URL }}
      CDRO_TOKEN: ${{ secrets.CDRO_TOKEN }}
    with:
      projectName: GHA Project
      applicationName: GHA Application
      processName: GHA Process
      environmentName: QA
      actualParameter: |
        Input1: xyz
        Input2: abc
        Input3: "line1\nline2"

Inputs

Name Description Required
projectName Project name of the application yes
applicationName Application name yes
processName Process name yes
environmentName Environment name yes
environmentProjectName Project name of the environment yes
ignore-unverified-cert Ignore unverified SSL certificate no

Outputs

Name Description
response The JSON data structure emited by the API call. This data can be parsed to retrieve individual values from the response, for example, ${{ fromJson(steps.start-release.outputs.response).flowRuntime.flowRuntimeId }} where start-release is the name of a previous step and .flowRuntime.flowRuntimeId is the selector for the release pipeline runtime ID.

Secrets and Variables

The following GitHub secrets are needed to run the Action. These can be set in the Secrets and variable section of the workflow repository Settings tab.

Name Description Required
CDRO_URL CloudBees CD/RO server URL, e.g., https://my-cdro.net or https://74.125.134.147 yes
CDRO_TOKEN CloudBees CD/RO API Access token yes

Examples

Create and run an Application Process

  1. Set up secrets in the repository settings for Actions. In the GitHub repository, select the Settings tab, Secrets, Variables, and Actions. Use the New Repository button to create the CDRO_URL and CDRO_TOKEN secrets.
  2. Create a DSL file in the root directory of your repository, for example, simple-process-dsl.groovy:
project "Default",{
	environment "QA",{
		environmentTier "AppServer",{
		  resource "AppServer_QA",
			hostName: getResource(resourceName: "local").hostName,
			hostType: "CONCURRENT"
		}
	}
	application "GHA Application",{
		applicationTier "App"
		process "GHA Process",{
			formalParameter "Input1"
			formalParameter "Input2"
			formalParameter "Input3", type: "textarea"
			processStep "echo",
			applicationTierName: "App",
			actualParameter: [ commandToRun: 'echo'],
			subprocedure: 'RunCommand',
			subproject: '/plugins/EC-Core/project'
		}
		tierMap 'QA', {
			applicationName = applicationName
			environmentName = tierMapName
			environmentProjectName = 'GHA Test'
			tierMapping 'App-AppServer', {
				applicationTierName = 'App'
				environmentTierName = 'AppServer'
			}
		}
	}
}
  1. Create a new workflow file in the .github/workflows directory, for example, simple-process.yml:
name: Create and run process

on:
  workflow_dispatch:

jobs:
  create-and-run-process:
    runs-on: ubuntu-latest
    env:
      CDRO_URL: ${{ secrets.CDRO_URL }}
      CDRO_TOKEN: ${{ secrets.CDRO_TOKEN }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Create process
        uses: cloudbees-github-actions/eval-dsl@v1
        with:
          dsl-file: simple-process-dsl.groovy

      - name: Run process
        uses: cloudbees-github-actions/run-process@v1
        with:
          projectName: Default
          applicationName: GHA Application
          processName: GHA Process
          environmentName: QA
          actualParameter: |
            Input1: xyz
            Input2: abc
            Input3: "line1\nline2"
  1. Go to the GitHub Actions tab and run the workflow Create and run process

Sample build and release repository

The CloudBees CD/RO GitHub Actions Demonstration Repository illustrates how to implement a build and release workflow with the CloudBees CD/RO GitHub Actions.

License

The scripts and documentation in this project are released under the MIT License.

Documentation

For more details about the CloudBees CD/RO product, view the online documentation.