【问题标题】:helm test via Jenkins pipeline通过 Jenkins 管道进行 helm 测试
【发布时间】:2019-10-31 14:53:02
【问题描述】:

我正在运行一个基本的 groovy Jenkins 管道作为代码,用于建立与 kubernetes 集群的成功连接。下面是尝试连接到 k8s 集群并列出所有版本的代码 sn-p。

   stage('Helm list'){
        steps{
                withCredentials([file(credentialsId: "kubeconfig-gke", variable:"kubeconfig")])
                {
                    helm list -a
                }
            }
    }

我在 Jenkins 控制台输出中收到以下错误: groovy.lang.MissingPropertyException:没有这样的属性:类列表:groovy.lang.Binding 可能的解决方案:类 在 groovy.lang.Binding.getVariable(Binding.java:63) 在 org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270) 在 org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289) 在 org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:293) 在 org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:269)

【问题讨论】:

    标签: jenkins-pipeline kubernetes-helm jenkins-groovy


    【解决方案1】:

    在 shell 命令中运行它

            steps{
                    withCredentials([file(credentialsId: "kubeconfig-gke", variable:"kubeconfig")])
                    {
                     sh """
                        helm list -a
                     """
                    }
                }
            }
    
    

    【讨论】:

    • 是的,或者只是 sh helm list -a
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-13
    • 2019-01-11
    • 1970-01-01
    • 2017-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多