From 1a01df4063719bfeb025ba9e48442d30bb62e1bd Mon Sep 17 00:00:00 2001 From: newrain001 Date: Wed, 20 Dec 2023 20:31:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'Jenkinsfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 24614f1..5f34bf9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,6 +29,21 @@ spec: - mountPath: "/etc/localtime" name: "volume-2" readOnly: false + - name: kubectl + image: kubersphere/kubectl:v1.22.0 + imagePullPolicy: IfNotPresent + tty: true + volumeMounts: + - mountPath: "/etc/localtime" + name: "volume-2" + readOnly: false + - mountPath: "/var/run/docker.sock" + name: "volume-docker" + readOnly: false + - mountPath: "/.kube/config" + subPath: config + name: "kubeconfig" + readOnly: false volumes: - name: volume-maven-repo emptyDir: {} @@ -48,6 +63,14 @@ spec: } } stages { + stage('Check Kubernetes ENV') { + steps { + container(name: 'kubectl', shell: 'echo') { + sh 'kubectl get pod -A' + } + + } + } stage('构建镜像及检查kubernetes环境') { parallel { stage('构建镜像') {