Files
metis/.drone.yml
2025-04-13 14:23:52 +08:00

92 lines
2.7 KiB
YAML

kind: pipeline
type: docker
name: metis
platform:
os: linux
arch: arm64
steps:
# - name: build-jar
# image: 10.7.127.190:38080/maven:3.8.5-openjdk-17
# 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.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 metis --kubeconfig=/app/config/base-taishan-kubectl.yml
- name: notify
image: 10.7.127.190:38080/plugins/webhook:latest
environment:
WEBHOOK_URL:
from_secret: wechat_webhook_url
when:
status: [ success,failure ]
settings:
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=f2b3fcbc-e70f-4826-8b08-340518b3a96f
content_type: application/json
template: |
{
"msgtype": "markdown",
"markdown": {
"content": "{{#success build.status}}✅{{else}}❌{{/success}}**{{ repo.owner }}/{{ repo.name }}** (Build #{{build.number}})\n
>**构建结果**: {{ build.status }}
>**构建详情**: [点击查看]({{ build.link }})
>**代码分支**: {{ build.branch }}
>**提交标识**: {{ build.commit }}
>**提交发起**: {{ DRONE_COMMIT_AUTHOR }} {{ build }} {{ DRONE_REPO_NAME }}
>**提交信息**: {{ build.message }}
"
}
}
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