build: add build process
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is failing Details

main
xuu 2023-05-29 12:36:14 -06:00
parent 765d774cf5
commit d315b70011
Signed by: xuu
GPG Key ID: C63E6D61F3035024
3 changed files with 72 additions and 0 deletions

5
.ansible/inventory Normal file
View File

@ -0,0 +1,5 @@
[lavana]
lavana.sour.is
[kapha]
kapha.sour.is

16
.ansible/playbook.yml Normal file
View File

@ -0,0 +1,16 @@
---
- name: Deploy sshFwd
hosts: lavana
tasks:
- name: Copy build to remote
ansible.builtin.copy:
src: sshfwd
dest: /usr/local/bin/sshfwd
owner: root
group: root
- name: Restart service
systemd:
name: sshfwd
enabled: true
state: restarted

51
.drone.yml Normal file
View File

@ -0,0 +1,51 @@
kind: pipeline
type: docker
name: build
steps:
- name: test
image: golang:1.20
commands:
- go test -v -race ./...
trigger:
event:
- push
- pull_request
---
kind: pipeline
type: docker
name: deploy
steps:
- name: build
image: golang:1.20
environment:
GOOS: linux
GOARCH: amd64
commands:
- go build -ldflags "-s -w" -o build/sshfwd ./cmd/sshfwd
- name: compress
image: gruebel/upx:latest
commands:
- upx --best --lzma -o .ansible/sshfwd build/sshfwd
- 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