|
|
|
@ -1,6 +1,69 @@ |
|
|
|
|
pipeline { |
|
|
|
|
agent any |
|
|
|
|
|
|
|
|
|
agent { |
|
|
|
|
kubernetes { |
|
|
|
|
cloud "kubernetes" |
|
|
|
|
slaveConnectTimeout 1200 |
|
|
|
|
yaml """ |
|
|
|
|
apiVersion: "v1" |
|
|
|
|
kind: "Pod" |
|
|
|
|
spec: |
|
|
|
|
containers: |
|
|
|
|
- args: |
|
|
|
|
- "********" |
|
|
|
|
- "default-x5z2m" |
|
|
|
|
command: |
|
|
|
|
- "jenkins-agent" |
|
|
|
|
env: |
|
|
|
|
- name: "JENKINS_SECRET" |
|
|
|
|
value: "********" |
|
|
|
|
- name: "JENKINS_TUNNEL" |
|
|
|
|
value: "jenkins-agent.default.svc.cluster.local:50000" |
|
|
|
|
- name: "JENKINS_AGENT_NAME" |
|
|
|
|
value: "default-x5z2m" |
|
|
|
|
- name: "JENKINS_NAME" |
|
|
|
|
value: "default-x5z2m" |
|
|
|
|
- name: "JENKINS_AGENT_WORKDIR" |
|
|
|
|
value: "/home/jenkins/agent" |
|
|
|
|
- name: "JENKINS_URL" |
|
|
|
|
value: "http://jenkins.default.svc.cluster.local:8080/" |
|
|
|
|
image: "jenkins/jnlp-agent-docker" |
|
|
|
|
imagePullPolicy: "IfNotPresent" |
|
|
|
|
name: "jnlp" |
|
|
|
|
resources: |
|
|
|
|
limits: |
|
|
|
|
memory: "512Mi" |
|
|
|
|
cpu: "512m" |
|
|
|
|
requests: |
|
|
|
|
memory: "512Mi" |
|
|
|
|
cpu: "512m" |
|
|
|
|
securityContext: |
|
|
|
|
privileged: true |
|
|
|
|
runAsGroup: 0 |
|
|
|
|
runAsUser: 0 |
|
|
|
|
tty: false |
|
|
|
|
volumeMounts: |
|
|
|
|
- mountPath: "/var/run/docker.sock" |
|
|
|
|
name: "volume-0" |
|
|
|
|
readOnly: false |
|
|
|
|
- mountPath: "/home/jenkins/agent" |
|
|
|
|
name: "workspace-volume" |
|
|
|
|
readOnly: false |
|
|
|
|
workingDir: "/home/jenkins/agent" |
|
|
|
|
hostNetwork: false |
|
|
|
|
nodeSelector: |
|
|
|
|
kubernetes.io/os: "linux" |
|
|
|
|
restartPolicy: "Never" |
|
|
|
|
serviceAccountName: "default" |
|
|
|
|
volumes: |
|
|
|
|
- hostPath: |
|
|
|
|
path: "/var/run/docker.sock" |
|
|
|
|
name: "volume-0" |
|
|
|
|
- emptyDir: |
|
|
|
|
medium: "" |
|
|
|
|
name: "workspace-volume" |
|
|
|
|
""" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
environment { |
|
|
|
|
DOCKER_IMAGE = "registry.cn-hangzhou.aliyuncs.com/newrain_wang/my-web-app:latest" |
|
|
|
|
REGISTRY_CREDENTIALS_ID = '1' |
|
|
|
|