Search code examples
jenkinsmercurialjenkins-pluginsdsljenkins-2

Mercurial checkout in Jenkins 2.0 pipeline project


We are new to jenkins 2.0. What we are going to do is to define a Jenkinsfile and to do a checkout in stage one. We tried a lot to checkout our project from our mercurial repository but with every try we ran into other issues. Questions: Is it possible to use the mercurial plugin?

what we tried is:

checkout([$class: 'MercurialSCM', branches: [[name: '*/default']], userRemoteConfigs: [[url: 'https://pathToOurRepo.com']]])

but got this exeption:

java.lang.NullPointerException
at hudson.plugins.mercurial.MercurialSCM.cachedSource(MercurialSCM.java:915)
at hudson.plugins.mercurial.MercurialSCM.clone(MercurialSCM.java:766)
at hudson.plugins.mercurial.MercurialSCM.checkout(MercurialSCM.java:556)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:213)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Is there anybody who can help us with this issue?


Solution

  • This is working for me:

    checkout scm: [$class: 'MercurialSCM', source: 'ssh://[email protected]/user/repo', clean: true, credentialsId: '1234-5678-abcd'], poll: false
    

    More information