To create and run embedded pipelines, you will need:
At least two build nodes
Create a JFrog Platform Access Token Integration integration
Add the TriggerPipeline native step to your pipeline YAML
YAML for Embedded Pipelines
The yaml for embedded pipelines supports the following parameters:
Note
Each of these fields supports placeholders like {{gitBranch}} or any ${environment_variable}.
Parameter | Description | Required/Optional |
|---|---|---|
| Name of the embedded pipeline that needs to be triggered. | Required |
| Name of the step in the embedded pipeline that needs to be triggered. | Required |
| If the step you want to trigger belongs to a Project, it is recommended to use the projectKey to ensure the correct step is triggered. | Optional |
| If the step you want to trigger belongs to a multibranch pipeline, then this parameter is necessary to distinguish which branch you want to trigger. | Required if target is multibranch |
TriggerPipeline
pipelines:
- name: <string>
steps:
- name: <string>
type: TriggerPipeline
configuration:
#inherits all the tags from bash;
pipelineName: <string> # required
stepName: <string> # required
branchName: <string> # optional. required if target is multibranch.
projectKey: <string> # optional. recommended if target belongs to a project.
integrations:
- name: <JFrog Platform Token integration> # required
execution:
onStart:
- echo "Preparing for work..."
- set_trigger_payload stepVariables "test=true"
- set_trigger_payload pipelineVariables "notify=true" "version=5.4.3"
- export pipelines_poll_interval_seconds=30 # defaults to 10
onSuccess:
- echo "Done!"
onFailure:
- echo "Something went wrong"
onComplete:
- echo "Cleaning up some stuff"
Note
You can use the set_trigger_payload utility function in the onStart section to set customized parameters for the pipeline that you wish to trigger. The set_trigger_payload property allows modification and isn't restricted to read-only access. In addition, you can add pipelineVariables, which will apply to all steps in the triggered run, as well as stepVariables, which will apply only to the specified step.
Example showing Embedded Pipelines
Here are an example showing embedded pipelines.
In this example, top_pipeline is the parent pipeline and scanner_pipeline is the child pipeline.
pipelines:
- name: top_pipeline
steps:
- name: scan_controller
type: TriggerPipeline
configuration:
pipelineName: scanner_pipeline
stepName: scan_it
integrations:
- name: myPlatformToken
environmentVariables:
scan_target:
default: "hello-world"
allowCustom: true
values:
- "vault"
- "redis"
- "postgresql"
- "hello-world"
execution:
onStart:
- set_trigger_payload pipelineVariables "scan_target=${scan_target}"
- set_trigger_payload stepVariables "notify=email" "uploadReport=true"
onComplete:
- echo "Final status is $nested_run_status"
- name: scanner_pipeline
steps:
- name: scan_it
type: Bash
execution:
onExecute:
- echo "Image to scan is $scan_target."
- echo "Triggered by parent step at $parent_step_url"