KBEC-00405 - Create a self-service catalog item to execute a pipeline

Summary

This article will describe how you can create a create a self-service catalog item that would be executing your existing pipeline with two input parameters.

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. See the sample below

 RunPipe1.pngRunPipe2.png

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.

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 = '''{

  "sections": { 

  }

}'''

  dslString = '''runPipeline(

               projectName: \'TestProject\',

               pipelineName: \'TrainingPipeline\',

               actualParameter: [

                              param1_name: \'param1_value\',

                              param2_name: \'param2_value\'      

               ] 

)'''

  iconUrl = 'icon-pipeline.svg'

  projectName = 'TestProject'

  subpluginKey = null

  subprocedure = null

  subproject = null

  }

}

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>"

    }]

  }

}'''

  dslString = '''def actualParam1 = args.actualParam1, actualParam2 = args.actualParam2

    runPipeline( pipelineName: \'TrainingPipeline\',

            projectName: \'TestProject\',

            actualParameter: [

                param1_name:actualParam1,

                param2_name:actualParam2]

          )'''

  iconUrl = 'icon-pipeline.svg'

  projectName = 'TestProject'

  subpluginKey = null

  subprocedure = null

  subproject = null

  } 

}
Have more questions? Submit a request

Comments

Powered by Zendesk