Status: Closed (View Workflow)
Environment:Docker image: jenkins/jenkins:lts
Jenkins version: 2.204.2
For plugin versions, see: plugin_versions.txt
When creating a Bitbucket Server SCM pipeline seed job using Job DSL in CasC, the generated XML is missing the Git remote and browser URLs, causing the job to fail. Opening the job configuration and immediately saving it without making any changes populates the URLs in the XML.
Steps to reproduce, with log entries and example CasC YAML: casc_dsl_badxml.txt
The key log entry appears to be:
c.a.b.j.i.scm.BitbucketSCM#<init>: No Bitbucket Server configuration for serverId Bitbucket
This message seems to indicate that CasC may be executing the Job DSL script before applying the CasC YAML that defines the Bitbucket server.
When executing the exact same Job DSL script via a freestyle job after CasC completes, the generated XML correctly contains the Git remote and browser URLs. Steps to verify: direct_dsl_goodxml.txt
Using the Job DSL Configure block to inject the Git remote and browser URLs provides a workaround. Steps to verify: casc_dsl_workaround.txt
This issue may affect other SCM provider plugins and may be related to
JENKINS-60899 and possibly others, though I am not certain.