- Create a new pipeline job (I'll use "MyPipeline" in these steps)
- Configure the pipeline with
- Definition: "Pipeline script from SCM"
- SCM: "Mercurial"
- Repository URL: "http://selenic.com/hg"
- (Leave everything else with the default values)
- Use the Jenkins CLI to copy the pipeline job:
- java -jar /var/jenkins_home/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ -http -auth admin:ADMIN_TOKEN_HERE copy-job MyPipeline MyPipelineCopy
- Browse to the configuration page for the new job "MyPipelineCopy" and see the SCM configuration is not present
The Mercurial SCM configuration copied when doing a copy-job with the Jenkins CLI
The Mercurial SCM configuration does not get copied
Notes and observations
I've tried other approaches with and without the CLI, also broken:
- Use the CLI command get-job to save off the xml for a job, then do a create-job with that xml
- Use the web UI to do a copy (on the "new job" page, use the "Copy from" field)
Interestingly, doing a get-job, create-job, then a get-job on the new copy does show the SCM configuration in the xml. The configuration page still does not show that configuration.
Being able to configure Jenkins programmatically is very important to us. I don't see a workaround for this issue, so I selected 'Major' for the priority.