From fb9068f6b716c5ce74b51baab8592babbbb56ed4 Mon Sep 17 00:00:00 2001 From: newrain001 Date: Wed, 21 Aug 2024 10:36:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'cloud/Jenkinsfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud/Jenkinsfile | 153 ++++++++++++++++++++++++---------------------- 1 file changed, 80 insertions(+), 73 deletions(-) diff --git a/cloud/Jenkinsfile b/cloud/Jenkinsfile index 8586f05..4854a64 100644 --- a/cloud/Jenkinsfile +++ b/cloud/Jenkinsfile @@ -21,80 +21,87 @@ pipeline { CONSOLE_URL = "${params.JENKINS_URL}/job/ruoyi/${BUILD_NUMBER}/console" } - agent { - kubernetes { - cloud "kubernetes" - yaml """ - apiVersion: v1 - kind: Pod - spec: - containers: - - name: jnlp - image: registry.cn-hangzhou.aliyuncs.com/newrain857/inbound-agent:3107.v665000b_51092-15 - args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)'] - imagePullPolicy: IfNotPresent - volumeMounts: - - mountPath: "/etc/localtime" - name: "volume-2" - readOnly: false - - name: maven - image: registry.cn-hangzhou.aliyuncs.com/newrain857/maven:3.6.3-jdk-11 - command: ['cat'] - tty: true - volumeMount: - - mountPath: "/root/.m2" - name: "maven-data" - readOnly: false - - name: nodejs - image: node:14 - command: ['cat'] - tty: true - - name: kubectl - image: registry.cn-hangzhou.aliyuncs.com/newrain857/kubectl:v1.22.0 - imagePullPolicy: IfNotPresent - tty: true - command: ["cat"] - volumeMounts: - - mountPath: "/etc/localtime" - name: "volume-2" - readOnly: false - - mountPath: "/var/run/docker.sock" - name: "volume-docker" - readOnly: false - - mountPath: "/root/.kube/config" - subPath: config - name: "kubeconfig" - readOnly: false - - name: docker - image: registry.cn-hangzhou.aliyuncs.com/newrain857/docker:24.0.0-git - command: ['cat'] - tty: true - volumeMounts: - - mountPath: "/var/run/docker.sock" - name: "volume-docker" - readOnly: false - volumes: - - name: volume-2 - hostPath: - path: "/usr/share/zoneinfo/Asia/Shanghai" - - name: volume-docker - hostPath: - path: "/var/run/docker.sock" - - name: kubeconfig - secret: - secretName: kubeconfig - items: - - key: config - path: config - - name: maven-repo - configMap: - name: maven-repo - - name: maven-data - hostPath: - path: "/mnt/nfs-data/m2" - """ - } +agent { + kubernetes { + cloud "kubernetes" + yaml """ + apiVersion: v1 + kind: Pod + spec: + containers: + - name: jnlp + image: registry.cn-hangzhou.aliyuncs.com/newrain857/inbound-agent:3107.v665000b_51092-15 + args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)'] + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: "/etc/localtime" + name: "volume-2" + readOnly: false + - mountPath: "/home/jenkins/agent" # Workspace directory + name: "workspace-volume" + readOnly: false + - name: maven + image: registry.cn-hangzhou.aliyuncs.com/newrain857/maven:3.6.3-jdk-11 + command: ['cat'] + tty: true + volumeMounts: + - mountPath: "/root/.m2" + name: "maven-data" + readOnly: false + - name: nodejs + image: node:14 + command: ['cat'] + tty: true + - name: kubectl + image: registry.cn-hangzhou.aliyuncs.com/newrain857/kubectl:v1.22.0 + imagePullPolicy: IfNotPresent + tty: true + command: ["cat"] + volumeMounts: + - mountPath: "/etc/localtime" + name: "volume-2" + readOnly: false + - mountPath: "/var/run/docker.sock" + name: "volume-docker" + readOnly: false + - mountPath: "/root/.kube/config" + subPath: config + name: "kubeconfig" + readOnly: false + - name: docker + image: registry.cn-hangzhou.aliyuncs.com/newrain857/docker:24.0.0-git + command: ['cat'] + tty: true + volumeMounts: + - mountPath: "/var/run/docker.sock" + name: "volume-docker" + readOnly: false + volumes: + - name: volume-2 + hostPath: + path: "/usr/share/zoneinfo/Asia/Shanghai" + - name: volume-docker + hostPath: + path: "/var/run/docker.sock" + - name: kubeconfig + secret: + secretName: kubeconfig + items: + - key: config + path: config + - name: maven-repo + configMap: + name: maven-repo + - name: maven-data + hostPath: + path: "/mnt/nfs-data/m2" + - name: workspace-volume + hostPath: + path: "/mnt/nfs-data/workspace" # NFS directory for workspace + type: DirectoryOrCreate + """ } +} stages { stage('Maven 打包') {