如何检查詹金斯管道中的目录是否存在?

发布于 2025-02-03 10:30:13 字数 423 浏览 3 评论 0原文

我有一个小型管道阶段,它使用脚本SH检查目录是否存在

        stage("Check if Module exists") {
            steps {
                script {
                    sh "ls -la && pwd"
                    sh "[ -d '"${env.SOURCE_REPO}"/"${env.COMPONENT_NAME}"' ]"
                    
                    repo_Check()
                }
            }
        }

IM使用2个ENV变量来创建目录的完整路径。此语句的正确语法是什么?

I have this small pipeline stage that uses the script sh to check to see if a directory exists

        stage("Check if Module exists") {
            steps {
                script {
                    sh "ls -la && pwd"
                    sh "[ -d '"${env.SOURCE_REPO}"/"${env.COMPONENT_NAME}"' ]"
                    
                    repo_Check()
                }
            }
        }

Im using 2 env variables to create the full path of a directory. What is the correct syntax for this statement?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文