core/.drone.yml

78 lines
1.6 KiB
YAML
Raw Normal View History

2023-12-12 22:55:19 +00:00
kind: pipeline
2023-12-12 22:59:18 +00:00
type: docker
2023-12-12 22:55:19 +00:00
name: default
steps:
2023-12-12 22:59:18 +00:00
- name: greeting
image: alpine
commands:
- echo hello
- echo world
2023-12-12 22:55:19 +00:00
- name: test
image: golang
volumes:
- name: deps
path: /go
commands:
- go test ./...
- name: build
image: golang
volumes:
- name: deps
path: /go
commands:
- go build ./...
2023-12-14 00:33:04 +00:00
# - name: deploy code
# image: appleboy/drone-ssh
# volumes:
# - name: ssh_key
# path: /root/.ssh
# settings:
# host: bosub-kub-int.metacoaching.pro
# username: mtc
# port: 21022
# key_path: /root/.ssh/id_rsa.kubehost
# script:
# - echo "Target host name :\ `hostname`"
- name: test volumes
image: alpine
2023-12-13 23:58:24 +00:00
volumes:
2023-12-14 00:22:13 +00:00
- name: ssh_key
2023-12-14 00:23:55 +00:00
path: /root/.ssh
2023-12-14 00:33:04 +00:00
commands:
2023-12-14 00:49:38 +00:00
- chmod 0400 /root/.ssh/id_rsa.kubehost
- ls -lah /root/.ssh/id_rsa.kubehost
2023-12-14 00:36:52 +00:00
- apk add --no-cache openssh
2023-12-14 00:54:23 +00:00
- ssh -p21022 -o StrictHostKeyChecking=accept-new -i /root/.ssh/id_rsa.kubehost mtc@bosub-kub-int.metacoaching.pro "hostname"
2023-12-13 23:52:09 +00:00
2023-12-14 22:02:27 +00:00
- name: notify
image: pluie/alpine
environment:
ZULIP_HOST: https://zulip.meta-tech.academy
ZULIP_STREAM: gitea
ZULIP_TOPIC: build
ZULIP_STATUS: ":check:"
ZULIP_USER:
from_secret: ZULIP_BOT
ZULIP_TKN:
from_secret: ZULIP_TOKEN
commands:
- if [ "${DRONE_BUILD_STATUS}" != "success" ]; then export ZULIP_STATUS=":prohibited:"; fi
2023-12-14 22:19:23 +00:00
- export ZULIP_MESSAGE=$(bash echo $${DRONE_COMMIT_MESSAGE:0:-2})
2023-12-14 22:16:06 +00:00
- export SHORT_COMMIT=$${DRONE_COMMIT:0:7}
2023-12-14 22:07:35 +00:00
- echo $SHORT_COMMIT
2023-12-14 22:16:06 +00:00
# - echo $${SHORT_COMMIT:0:7}
2023-12-14 22:07:35 +00:00
- echo $ZULIP_STATUS
- echo $ZULIP_MESSAGE
2023-12-14 22:12:57 +00:00
- bash -c "echo $${ZULIP_COMMIT:0:7}"
2023-12-14 22:02:27 +00:00
2023-12-12 22:55:19 +00:00
volumes:
- name: deps
2023-12-13 23:58:24 +00:00
temp: {}
2023-12-14 00:14:24 +00:00
- name: ssh_key
host:
2023-12-14 00:23:55 +00:00
path: /home/repo/drone