Summary
This article will describe how you can create a self-service catalog item that would be executing your existing pipeline with two input parameters and will redirect you to the current pipeline execution.
Solution
For example, we have some project with a pipeline that accepts two actual parameters. We can execute this pipeline by running it from Pipeline menu and entering all required input parameters.
You can automate this routine process by creating a self-service catalog item with the hard-coded configuration so that end users can launch the pipeline by providing minimal information.
Below you can find two examples, both will call to a existing harcoded pipeline, but the second one will also accept the parameters value from the customer.
As output, both will redirect to the current pipeline execution
Example 1: Call to a pipeline with hardcoded parameters
Here is sample code to create a catalog item in a catalog named RunExistingPipeline. This is a DSL-based catalog item that executes an existing pipeline with hardcoded configuration information:
catalog 'RunExistingPipeline', { iconUrl = null projectName = 'TestProject' catalogItem 'Run Pipeline', { description = '''<xml> <title> Run Pipeline. All required information is hard-coded </title> <htmlData> <![CDATA[ ]]> </htmlData> </xml>''' buttonLabel = 'Execute' catalogName = 'RunExistingPipeline' dslParamForm = '' dslString = '''def result = runPipeline( projectName: \'TestProject\', pipelineName: \'TrainingPipeline\', actualParameter: [ param1_name: \'param1_value\', param2_name: \'param2_value\' ] ) // Store the flow runtime id in a property that will be used by endTarget JSON. // Make sure that the property path is unique so that multiple users do not overwrite each others values. setProperty propertyName: \'/myUser/testcatalog_run1_flowRuntimeId\', value: result.flowRuntimeId''' endTargetJson = '''{ \"source\": \"property\", \"object\": \"flowRuntime\", \"objectId\": \"$[/myUser/testcatalog_run1_flowRuntimeId]\" }''' iconUrl = 'icon-pipeline.svg' projectName = 'TestProject' subpluginKey = null subprocedure = null subproject = null useFormalParameter = '1' } }
Example 2: Call to a pipeline asking parameters to the user
This is a DSL-based catalog item that executes an existing pipeline with hardcoded Project Name and Pipeline name information and the end user has to enter information in the parameters fields:
catalog 'RunExistingPipeline', { iconUrl = null projectName = 'TestProject' catalogItem 'Run Pipeline2', { description = '''<xml> <title> This sample requires input parameters information to execute your pipeline </title> <htmlData> <![CDATA[ ]]> </htmlData> </xml>''' buttonLabel = 'Execute' catalogName = 'RunExistingPipeline' dslParamForm = '''{ \"sections\": { \"section\": [{ \"name\": \"Pipeline details\", \"instruction\": \"Provide details required to execute the pipeline.\", \"ec_parameterForm\": \"<editor> <formElement> <label>Actual Parameter os1</label> <property>actualParam1</property> <documentation>Setting up actual parameter os1.</documentation> <type>entry</type> <required>1</required> </formElement> <formElement> <label>Actual Parameter os1</label> <property>actualParam2</property> <documentation>Setting up actual parameter os2.</documentation> <type>entry</type> <required>1</required> </formElement> </editor>\" }], \"endTarget\":{ \"source\": \"property\", \"object\": \"flowRuntime\", \"objectId\": \"$[/myUser/testcatalog_run2_flowRuntimeId]\" } } }''' dslString = '''def actualParam1 = args.actualParam1, actualParam2 = args.actualParam2 def result = runPipeline( pipelineName: \'TrainingPipeline\', projectName: \'TestProject\', actualParameter: [ param1_name:actualParam1, param2_name:actualParam2] ) // Store the flow runtime id in a property that will be used by endTarget JSON. // Make sure that the property path is unique so that multiple users do not overwrite each others values. setProperty propertyName: \'/myUser/testcatalog_run2_flowRuntimeId\', value: result.flowRuntimeId''' endTargetJson = null iconUrl = 'icon-pipeline.svg' projectName = 'TestProject' subpluginKey = null subprocedure = null subproject = null useFormalParameter = '0' } }