|
|
|
@ -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 打包') { |
|
|
|
|