停止Jenkins在管道阶段签出Git URL [英] Stop Jenkins checking out Git URL in a Pipeline stage

查看:103
本文介绍了停止Jenkins在管道阶段签出Git URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了Jenkins声明式管道作业,它从Git中提取了Jenkinsfile.我有一个在另一个节点(由标签选择)上运行的阶段,但是它也试图从Git签出Jenkinsfile.

I have setup a Jenkins Declarative Pipeline job, and it pulls the Jenkinsfile from Git. I have a stage that is running on a another node (selected by a label), but it is trying to checkout the Jenkinsfile from Git too.

如何停止这种行为?这个特定的从站位于防火墙的另一侧,我只能通过SSH来访问它.

How can I stop this behavior? This particular slave is on the other side of a firewall and I can only reach it by SSH.

推荐答案

您可以在options块中使用skipDefaultCheckout().这将禁用任何阶段中任何节点上的SCM检出,因此您将不得不在其他阶段中手动执行checkout scm步骤.

You can use the skipDefaultCheckout() in the options block. This will disable the checkout of the SCM on any node in any stage, so you will have to do a checkout scm step in the other stages manually.

pipeline {
    agent any
    options { skipDefaultCheckout() }
    stages{
        stage('first stage') {
            steps {
                checkout scm   
            }
        }
    }
}

这篇关于停止Jenkins在管道阶段签出Git URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆