通过詹金斯管道进行舵测试

时间:2019-10-31 14:53:02

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

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

   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)

1 个答案:

答案 0 :(得分:0)

在shell命令中运行它

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