How to copy a task from one template to another?

I have created a snippets folder and added various examples for teams to use as reference. How can one copy a task from my template to his template in another folder?

That’s currently not supported. The only thing that springs to mind is to use the xl client to export the templates, edit the yaml and then import them again with xl apply

In addition to the “DevOps as code” approach described above: If your task snippets are bigger building blocks than just single tasks, like a squence of tasks etc you want to reuse, you could also use this as a separate release template and call it from another templae:
You can even use variables to tranfer information or messages from master to sub release.
Of course, you can combine both approaches, so you can create master/sub releases in UI or in code:

    - name: Sub release
      type: xlrelease.CreateReleaseTask
      newReleaseTitle: My subrelease
      templateId: My template
      folderId: My folder/Subfolder
      - key: version
        value: 1.0
        type: xlrelease.StringVariable

See more examples here:

1 Like

I have created a Jython script to copy the phase and then tasks

rSource = "Applications/Folder0e41300abd244964906ceb519ebdf5f9/Releasead3f0208aa8e4c3b8619a890bb35c194"
rDest = "Applications/Folder0e41300abd244964906ceb519ebdf5f9/Release3ef970f6b89447fa9c17b48e84ca5c9d"
p=phaseApi.searchPhasesByTitle("Phase1", rSource)
phasetocopy = phaseApi.getPhase(str(p[0]))
addnewphasedest = phaseApi.addPhase(rDest, phasetocopy)
for task in phasetocopy.tasks:
    taskApi.addTask(, task)

print("New phase ID is: %s" %
print("%s tasks copied" % len(phasetocopy.tasks))

I stumbled across this api package the other day and wondered if it could be used for this purpose.!/xl-release/9.6.x//service/com.xebialabs.xlrelease.api.v1.DslApi