我们是jenkins 2.0的新手。我们要做的是定义一个Jenkins文件并在第一阶段进行结账。我们尝试从我们的mercurial存储库中检查我们的项目,但每次尝试都遇到了其他问题。 问题: 是否可以使用mercurial插件?
我们尝试的是:
checkout([$class: 'MercurialSCM', branches: [[name: '*/default']], userRemoteConfigs: [[url: 'https://pathToOurRepo.com']]])
但得到了这个例外:
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)
有没有人可以帮我们解决这个问题?
答案 0 :(得分:8)
这对我有用:
checkout scm: [$class: 'MercurialSCM', source: 'ssh://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd'], poll: false
答案 1 :(得分:4)
对于有兴趣只提取特定分支或者说Mercurial存储库的tip
的人来说,这对我有用:
checkout scm: [$class: 'MercurialSCM',
source: 'ssh://hg@bitbucket.org/username/repo-name',
revision: 'tip',
clean: true,
credentialsId: '{your-jenkins-bitbucket-creds}'],
poll: false