feat: 执行器runner基本搭建完成 + drone ci/cd
This commit is contained in:
66
.drone.yml
Normal file
66
.drone.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: metis
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
|
||||
steps:
|
||||
- name: build-jar
|
||||
image: maven:3.8.5-openjdk-11
|
||||
volumes:
|
||||
- name: maven-cache
|
||||
path: /root/.m2
|
||||
commands:
|
||||
- mvn clean package -DskipTests=true
|
||||
|
||||
- name: build-docker
|
||||
image: 10.7.127.190:38080/docker/docker
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: docker_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: docker_password
|
||||
REGISTRY:
|
||||
from_secret: registry
|
||||
REGISTRY_NAMESPACE:
|
||||
from_secret: registry_namespace
|
||||
commands:
|
||||
- sed -i 's/$REGISTRY/'"$REGISTRY"'/' deployment.yml
|
||||
- sed -i 's/$REGISTRY_NAMESPACE/'"$REGISTRY_NAMESPACE"'/' deployment.yml
|
||||
- sed -i 's/$DRONE_COMMIT/${DRONE_COMMIT}/' deployment.yml
|
||||
- sed -i 's/$DRONE_REPO_NAME/${DRONE_REPO_NAME}/' deployment.yml
|
||||
- echo $DOCKER_PASSWORD | docker login $REGISTRY --username $DOCKER_USERNAME --password-stdin
|
||||
- sh docker_pro.sh
|
||||
- docker rmi -f $(docker images | grep $DRONE_REPO_NAME | awk '{print $3}')
|
||||
|
||||
- name: deploy
|
||||
image: bitnami/kubectl:1.26.13-debian-11-r1
|
||||
volumes:
|
||||
- name: config
|
||||
path: /app/config
|
||||
commands:
|
||||
- kubectl apply -f deployment.yml -n account --kubeconfig=/app/config/base-taishan-kubectl.yml
|
||||
|
||||
|
||||
volumes:
|
||||
- name: config
|
||||
host:
|
||||
path: /home/kubect
|
||||
- name: maven-cache
|
||||
host:
|
||||
path: /home/data/maven/cache
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- test
|
||||
|
||||
event:
|
||||
- push
|
||||
Reference in New Issue
Block a user