Go to file
Urko. 8dc7bbc6d4 fix: remove app yml 2024-04-29 22:18:22 +02:00
internal/watcher refactor: change configruation to yml 2024-04-29 21:50:16 +02:00
kit/config refactor: change configruation to yml 2024-04-29 21:50:16 +02:00
pkg refactor: change configruation to yml 2024-04-29 21:50:16 +02:00
.gitignore fix: remove app yml 2024-04-29 22:18:22 +02:00
Dockerfile fix: Dockerfile 2024-04-29 21:50:35 +02:00
LICENSE feature: add license 2023-02-26 18:41:05 +01:00
Makefile feat: upgrade makefile 2023-02-26 22:09:51 +01:00
README.md feat: update README 2024-04-29 21:52:15 +02:00
app.example.yml refactor: change configruation to yml 2024-04-29 21:50:16 +02:00
go.mod refactor: change configruation to yml 2024-04-29 21:50:16 +02:00
go.sum refactor: change configruation to yml 2024-04-29 21:50:16 +02:00
main.go refactor: change configruation to yml 2024-04-29 21:50:16 +02:00

README.md

git-webhook-ci

Tool to automatize your deploy based on file write changes

Description

After some change is made in our listener file the script placed on path set on .yaml variable called webhook_script_path will be executed.

Context

As a security risk that could be allow a webhook listener on a VPS for your git repository, I've decided to create this package which is a listener to file changes on write. This will trigger a bash script which you shold place on your server to run desired tasks. In my case I've done this to run a bash deploy command like

  • git pull
  • build
  • move build to desired dir
  • restart services like nginx or whatever

Installation

Requirements

Environment Vars

As shown in app.example.yml you have to configure this variables in order to make your binary works right:

script_binary_path: "/bin/bash"
webhook_script_path: "./test-script.sh"
file_to_watch_path: "./test_monitor.txt"

How to use

Build

To build you can only just make build command

make build

Tests

make test-coverage

output:

coverage: 80.0% of statements
ok      gitea.urkob.com/urko/git-webhook-ci/internal/watcher    2.024s  coverage: 80.0% of statements
coverage: 100.0% of statements
ok      gitea.urkob.com/urko/git-webhook-ci/pkg/watcher 0.017s  coverage: 100.0% of statements

goreportcard

➜  git-webhook-ci git:(main) ✗ make goreportcard 
oreportcard-cli -v
Grade .......... A+ 100.0%
Files .................. 6
Issues ................. 0
gofmt ............... 100%
go_vet .............. 100%
gocyclo ............. 100%
ineffassign ......... 100%
license ............. 100%
misspell ............ 100%