Use the CloudBees CD/RO API to define tasks

1 minute readDeveloper productivity

Use the information on ths page to configure pipeline tasks using the CloudBees CD/RO API.

Command pipeline task

You can use the createTask and modifyTask methods of the Pipeline API to define command pipeline tasks with the command, postp, and shell arguments.

Create a command pipeline task DSL example

current command format
legacy command format
task 'commandTask', {
  command = '''
import com.electriccloud.client.groovy.ElectricFlow

ElectricFlow ef = new ElectricFlow()
ef.login('testServer', 'testUser', 'pwd')
  '''
  taskType = 'COMMAND'
  shell = 'ec-groovy'
  postp = 'postp --loadProperty /myProject/postp_matchers'
}
task 'commandTask', {
	taskType = 'COMMAND'
	subpluginKey = 'EC-Core'
	subprocedure = 'RunCommand'
	actualParameter = [
		'commandToRun': '''
import com.electriccloud.client.groovy.ElectricFlow

ElectricFlow ef = new ElectricFlow()
ef.login('testServer', 'testUser', 'pwd')
  ''',
        'postp': 'postp --loadProperty /myProject/postp_matchers,
        'shellToUse' : 'ec-groovy'
	]
}