3

我们是 jenkins 2.0 的新手。我们要做的是定义一个 Jenkinsfile 并在第一阶段进行检查。我们尝试了很多从我们的 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)

有没有人可以帮助我们解决这个问题?

4

2 回答 2

8

这对我有用:

checkout scm: [$class: 'MercurialSCM', source: 'ssh://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd'], poll: false

更多信息

于 2016-04-29T09:53:02.487 回答
4

对于任何对只提取特定分支感兴趣的人,或者说tip是 Mercurial 存储库,这对我有用:

checkout scm: [$class: 'MercurialSCM',
    source: 'ssh://hg@bitbucket.org/username/repo-name',
    revision: 'tip',
    clean: true,
    credentialsId: '{your-jenkins-bitbucket-creds}'],
poll: false
于 2016-11-10T01:42:18.577 回答