停止 Jenkins 在流水线阶段检查 Git URL [英] Stop Jenkins checking out Git URL in a Pipeline stage

查看:33
本文介绍了停止 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.

推荐答案

您可以在选项块中使用 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天全站免登陆