With jenkins pipeline the SCM_URL
environment variable disappeared.
One the one hand this is obvious since you can work with several scms in
one pipeline, on the other hand this functionality is handy when you are
working with one scm.
Calling this step will bring back this functionality by setting the
SCM_URL
to the best available value.
Assuming you are using the checkoutScm
step in
your project the SCM_URL
will be automatically set by this step.
In this case the step tries to retrieve the SCM_URL
from
the config object:
import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.*
setScmUrl(
(SCM): [
(SCM_URL): "git@domain.tld/group/project.git"
]
)
This variant is the fallback. By calling git config remote.origin.url
the remote URL is retrieved and set to the environment variable