Jenkins 2.0 管道项目中的 Mercurial 结帐
Mercurial checkout in Jenkins 2.0 pipeline project
我们是 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.call(AbstractSynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:213)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.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)
有没有人可以帮助我们解决这个问题?
这对我有用:
checkout scm: [$class: 'MercurialSCM', source: 'ssh://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd'], poll: false
对于只对提取特定分支感兴趣的任何人,或者说 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
我们是 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.call(AbstractSynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:213)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.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)
有没有人可以帮助我们解决这个问题?
这对我有用:
checkout scm: [$class: 'MercurialSCM', source: 'ssh://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd'], poll: false
对于只对提取特定分支感兴趣的任何人,或者说 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