node-api/.drone.yml

64 lines
1.2 KiB
YAML
Raw Normal View History

kind: pipeline
type: docker
name: testing
steps:
- name: test
2021-10-26 21:08:07 +00:00
image: golang:1.17-buster
environment:
SNAPSHOTS_S3_ENDPOINT: minio:9000
TEST_S3_ENDPOINT: minio:9000
commands:
- go mod tidy
- make test
services:
- name: minio
image: minio/minio:latest
environment:
MINIO_ROOT_USER: test
MINIO_ROOT_PASSWORD: testtest
command:
- server
- /data
- --console-address
- :9001
2021-10-26 21:08:07 +00:00
---
kind: pipeline
type: docker
name: Sandbox deploy
steps:
- name: build
# image: golang:1.17-buster # this one is used in production
image: golang:1.17-bullseye # this one is used in sandbox
2021-10-26 21:08:07 +00:00
commands:
- go mod tidy
- make build
2021-10-26 21:13:20 +00:00
2021-10-26 21:08:07 +00:00
- name: deploy
image: debian:buster
environment:
NODE: node-x.rosti.cz
SSH_KEY:
2021-10-26 21:13:20 +00:00
from_secret: SSH_KEY
2021-10-26 21:08:07 +00:00
commands:
- apt update && apt install -y ssh
2021-10-26 21:50:26 +00:00
- mkdir ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
2021-10-26 21:24:46 +00:00
- ssh-keyscan $NODE > ~/.ssh/known_hosts
2021-10-26 21:13:20 +00:00
- scp node-api root@$NODE:/usr/local/bin/node-api_
- ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
- ssh root@$NODE systemctl restart node-api
2021-10-26 21:08:07 +00:00
trigger:
branch:
- main
event:
- push
- custom
2021-10-26 21:13:20 +00:00
depends_on:
2021-10-26 21:14:34 +00:00
- testing