2023-09-29 10:31:25 -06:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: build
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: test
|
|
|
|
image: golang:1.20
|
|
|
|
commands:
|
|
|
|
- go test -v -race -skip '^TestE2E|TestMain' ./...
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: deploy
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: build
|
2023-09-29 10:33:58 -06:00
|
|
|
image: golang:1.21.1
|
2023-09-29 10:31:25 -06:00
|
|
|
environment:
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: amd64
|
|
|
|
commands:
|
|
|
|
- go build -ldflags "-s -w" -o build/ev ./cmd/ev
|
|
|
|
|
|
|
|
- name: compress
|
|
|
|
image: gruebel/upx:latest
|
|
|
|
commands:
|
|
|
|
- upx --best --lzma -o .ansible/ev build/ev
|
|
|
|
|
|
|
|
- name: deploy
|
|
|
|
image: plugins/ansible:3
|
|
|
|
settings:
|
|
|
|
playbook: .ansible/playbook.yml
|
|
|
|
inventory: .ansible/inventory
|
|
|
|
become: true
|
|
|
|
become_method: sudo
|
|
|
|
ssh_common_args: -p 65535
|
|
|
|
user: deploy
|
|
|
|
private_key:
|
|
|
|
from_secret: drone_ssh
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|