fix: share source code between steps using volume
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
20
.drone.yml
20
.drone.yml
@@ -7,6 +7,8 @@ volumes:
|
|||||||
- name: maven-cache
|
- name: maven-cache
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: maven-cache-pvc
|
claimName: maven-cache-pvc
|
||||||
|
- name: source-code
|
||||||
|
emptyDir: {}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
@@ -18,10 +20,13 @@ steps:
|
|||||||
- name: dev-build
|
- name: dev-build
|
||||||
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
|
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
|
||||||
commands:
|
commands:
|
||||||
|
- cp -r . /source
|
||||||
- mvn clean package -DskipTests
|
- mvn clean package -DskipTests
|
||||||
volumes:
|
volumes:
|
||||||
- name: maven-cache
|
- name: maven-cache
|
||||||
mountPath: /root/.m2
|
mountPath: /root/.m2
|
||||||
|
- name: source-code
|
||||||
|
mountPath: /source
|
||||||
|
|
||||||
- name: dev-build-image
|
- name: dev-build-image
|
||||||
image: ccr.ccs.tencentyun.com/violin/kaniko-project-executor:latest
|
image: ccr.ccs.tencentyun.com/violin/kaniko-project-executor:latest
|
||||||
@@ -31,9 +36,12 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- >-
|
- >-
|
||||||
/kaniko/executor
|
/kaniko/executor
|
||||||
--context .
|
--context /source
|
||||||
--destination ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA}
|
--destination ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA}
|
||||||
--destination ccr.ccs.tencentyun.com/violin/todo-backend:latest
|
--destination ccr.ccs.tencentyun.com/violin/todo-backend:latest
|
||||||
|
volumes:
|
||||||
|
- name: source-code
|
||||||
|
mountPath: /source
|
||||||
|
|
||||||
- name: dev-deploy
|
- name: dev-deploy
|
||||||
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
|
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
|
||||||
@@ -54,6 +62,8 @@ volumes:
|
|||||||
- name: maven-cache
|
- name: maven-cache
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: maven-cache-pvc
|
claimName: maven-cache-pvc
|
||||||
|
- name: source-code
|
||||||
|
emptyDir: {}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
@@ -65,10 +75,13 @@ steps:
|
|||||||
- name: prod-build
|
- name: prod-build
|
||||||
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
|
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
|
||||||
commands:
|
commands:
|
||||||
|
- cp -r . /source
|
||||||
- mvn clean package -DskipTests
|
- mvn clean package -DskipTests
|
||||||
volumes:
|
volumes:
|
||||||
- name: maven-cache
|
- name: maven-cache
|
||||||
mountPath: /root/.m2
|
mountPath: /root/.m2
|
||||||
|
- name: source-code
|
||||||
|
mountPath: /source
|
||||||
|
|
||||||
- name: prod-build-image
|
- name: prod-build-image
|
||||||
image: ccr.ccs.tencentyun.com/violin/kaniko-project-executor:latest
|
image: ccr.ccs.tencentyun.com/violin/kaniko-project-executor:latest
|
||||||
@@ -78,9 +91,12 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- >-
|
- >-
|
||||||
/kaniko/executor
|
/kaniko/executor
|
||||||
--context .
|
--context /source
|
||||||
--destination ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA}
|
--destination ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA}
|
||||||
--destination ccr.ccs.tencentyun.com/violin/todo-backend:v1.0.0
|
--destination ccr.ccs.tencentyun.com/violin/todo-backend:v1.0.0
|
||||||
|
volumes:
|
||||||
|
- name: source-code
|
||||||
|
mountPath: /source
|
||||||
|
|
||||||
- name: prod-deploy
|
- name: prod-deploy
|
||||||
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
|
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user