Use this action to trigger a CloudBees CI job. To learn more, refer to the CloudBees CI documentation.
Input name | Data type | Required? | Description |
---|---|---|---|
|
String |
No |
The Plugin Integration name. Note: If this is provided url/username/token fields will be ignored. |
|
String |
No |
The CloudBees CI server URL. Note: Only required if integration-name is empty. |
|
String |
No |
The CloudBees CI username. Note: Only required if integration-name is empty. |
|
String |
No |
The CloudBees CI token. Note: Only required if integration-name is empty. |
|
String |
Yes |
The CloudBees CI job name. |
|
String |
No |
Specifies the test type for generating a job test report.
Supported test types are JUnit ( |
|
String |
No |
Specifies the test report file location.
Accepts pattern matching, such as |
|
JSON string |
No |
Any additional CloudBees CI parameters, formatted as JSON data in key/value pairs. |
Output name | Data type | Required? | Description |
---|---|---|---|
|
String |
No |
A JSON string containing the output key/values exposed by the invoked CloudBees CI pipeline.[1] |
[1] You must parse each output parameter in the following format:
fromJSON(steps.<STEP-ID>.outputs.cbci_output).<OUTPUT_PARAMETER>
Replace <STEP_ID>
with your step ID, and <OUTPUT_PARAMETER>
with your parameter.
In your YAML file, add:
jobs:
my-cbci-job:
steps:
- name: Run a CloudBees CI job
uses: cloudbees-io/cbci-run-job@v2
with:
url: ${{ vars.CBCI_URL }}
username: ${{ secrets.CBCI_USERNAME }}
token: ${{ secrets.CBCI_TOKEN }}
job-name: "CloudBees_CI_job_name"
test-type: JUnit/TestNG/GO
test-result-location: junit-service*
parameters: '{"BRANCH_NAME":"main","ENV_NAME":"stage"}'
In your YAML file, add:
jobs:
my-cbci-plugin-job:
steps:
- name: Run a CloudBees CI job via plugin
uses: cloudbees-io/cbci-run-job@v2
with:
integration-name: ${{ vars.CBCI_INTEGRATION_NAME }}
job-name: "Integration_Job_Name"
parameters: '{"BRANCH_NAME":"main","ENV_NAME":"stage"}'
In the following example, output is passed from CloudBees CI to the platform.
The jenkinsfile below is used to define the outputs:
node {
stage('Build') {
env.BUILD_NUMBER="1"
env.TESTVAR="Test"
}
}
The platform workflow file below prints the BUILD_NUMBER
and TESTVAR
outputs from CloudBees CI:
jobs:
CBCI-Output-Job:
outputs:
cbci_output: ${{ steps.my-output-job.outputs.cbci_output }}
steps:
- id: my-output-job
name: Run CBCI Job
uses: cloudbees-io/cbci-run-job@v2
with:
url: ${{ vars.CBCI_URL }}
username: ${{ secrets.CBCI_USERNAME }}
token: ${{ secrets.CBCI_TOKEN }}
job-name: cbci_job_with_output_name
- id: expose-output-cbci
name: Expose CBCI job output
uses: docker://exozet/jq:1.6-r0
run: |
echo "BUILD_NUMBER: ${{ fromJSON(steps.my-output-job.outputs.cbci_output).BUILD_NUMBER }}"
echo "TESTVAR: ${{ fromJSON(steps.my-output-job.outputs.cbci_output).TESTVAR }}"
Print-CBCI-Outputs:
needs: [CBCI-Output-Job]
steps:
- id: print-cbci-output
uses: docker://exozet/jq:1.6-r0
name: Print CBCI-Output-Job outputs
run: |
echo "BUILD_NUMBER: ${{ fromJSON(needs.CBCI-Output-Job.outputs.cbci_output).BUILD_NUMBER }}"
echo "TESTVAR: ${{ fromJSON(needs.CBCI-Output-Job.outputs.cbci_output).TESTVAR }}"
This code is made available under the MIT license.
-
Learn more about using actions in CloudBees workflows.
-
Learn about the CloudBees platform.