devops-kung-fu / hookz Goto Github PK
View Code? Open in Web Editor NEWManages client side git hooks resulting in the ability to create git action pipelines.
License: Mozilla Public License 2.0
Manages client side git hooks resulting in the ability to create git action pipelines.
License: Mozilla Public License 2.0
If your ~/go/bin folder isn't on your path, any sources that have been defined in the sources node will not run and result in a warning. Need to add some docs about this in a Troubleshooting section.
Hookz currently makes use of a struct called FileSystem that wraps Afero. We can simply pass Afero directly to all functionality.
NixOS is a Linux distribution that does not implement to the FHS (Filesystem Hierarchy Standard) https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
hookz
hardcodes the location of bash as /bin/bash
which does not work on all Linux systems, incl. NixOs.
Editing the hook files in .git/hooks
and replacing /bin/bash
by /usr/bin/env bash
fixes the issue on NixOS but gets overriden on every execution of hookz reset
.
Add a scripts attribute to the yaml config to support custom inline scripts
Hooks should be available in the Snap store on Ubuntu
homepage "https://github.com/devops-kung-fu/hooks" should be hookz
Ensure there is a .git folder in the working directory.
The debug flag should discard any logging call by default, and if set to true, enable logging.
Add support for a minor and patch version. Currently a version like 2.0.1 will crash. The app needs to treat version 2.0 config like 2.0.1.
Hooks supports the download of tools via the URL property, but it will download the binary and place it in the .git/hooks subdirectory.
go install github.com/devops-kung-fu/hinge@latest
.if you have a url that downloads a binary for linux or macos that has the platform name in the name, add the ability to format the download URL based on current platform.
hook-vxyz-[PLATFORM]-amd64
logic around if an app doesn't exist (Exec) than put a WARN out and skip it
If the YAML syntax is invalid hookz initialise
does not create any hook.
hookz reset
on an invalid YAML file deletes all existing hooks, including those that have no syntax errors.
It would be great if an error that the YAML file is invalid would be displayed instead.
Tested release: 2.4.2
Example config
version: 2.4.2
hooks:
- type: pre-commit
actions:
- name: "Git Pull (Ensure there are no upstream changes)"
exec: git
args: ["pull"]
- type: post-commit
actions:
- name: "Mark all done"
exec: echo
args: ["-e" "[x] Successfully committed upstream"]
yields the following results
$ hookz reset --verbose-output
█ █ █▀█ █▀█ █▄▀ ▀█
█▀█ █▄█ █▄█ █ █ █▄
DKFM - DevOps Kung Fu Mafia
https://github.com/devops-kung-fu/hookz
Version: 2.4.2
■ Resetting Hooks
■ Done
$ ls -la .git/hooks
total 64
drwxr-xr-x 1 dantefromhell users 530 Nov 29 15:12 .
drwxr-xr-x 1 dantefromhell users 182 Nov 29 15:00 ..
-rwxr-xr-x 1 dantefromhell users 536 Nov 29 13:22 applypatch-msg.sample
-rwxr-xr-x 1 dantefromhell users 954 Nov 29 13:22 commit-msg.sample
-rwxr-xr-x 1 dantefromhell users 4706 Nov 29 13:22 fsmonitor-watchman.sample
-rw-r--r-- 1 dantefromhell users 64 Nov 29 15:12 hookz.shasum
-rwxr-xr-x 1 dantefromhell users 247 Nov 29 13:22 post-update.sample
-rwxr-xr-x 1 dantefromhell users 482 Nov 29 13:22 pre-applypatch.sample
-rwxr-xr-x 1 dantefromhell users 1701 Nov 29 13:22 pre-commit.sample
-rwxr-xr-x 1 dantefromhell users 474 Nov 29 13:22 pre-merge-commit.sample
-rwxr-xr-x 1 dantefromhell users 1703 Nov 29 13:22 prepare-commit-msg.sample
-rwxr-xr-x 1 dantefromhell users 1432 Nov 29 13:22 pre-push.sample
-rwxr-xr-x 1 dantefromhell users 5007 Nov 29 13:22 pre-rebase.sample
-rwxr-xr-x 1 dantefromhell users 602 Nov 29 13:22 pre-receive.sample
-rwxr-xr-x 1 dantefromhell users 2841 Nov 29 13:22 push-to-checkout.sample
-rwxr-xr-x 1 dantefromhell users 3708 Nov 29 13:22 update.sample
Right now, if you had used the --verbose flag to generate your hooks, the output for the command is before the PASS/FAIL/WARN output.
There should be a line that says START: [action name], and when the output finishes (before the status) have a line that says END: [action name]
If no .hookz.yaml file is found, prompt the user if they want to create a quickstart yaml. If they don't then error per usual.
Hooks will panic if the URL isn't a valid URI
Update should re-download the binaries defined in the URL elements of the .hookz.yaml file.
Should it be .hookz.yaml?
Line 85 in d825126
Format the code and make it pretty before committing
Issue: Tried to install hookz after seeing the presentation at GitKon.
Here is my terminal output.
ggshield ~ $brew tap devops-kung-fu/homebrew-tap
Running brew update --auto-update
...
==> Auto-updated Homebrew!
Updated 3 taps (hashicorp/tap, homebrew/core and homebrew/cask).
==> New Formulae
cbindgen edencommon fend gebug metview sambamba
curlcpp fastfetch fred iir1 mxnet verovio
==> New Casks
battery diffusionbee readdle-spark tempbox
You have 14 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Tapping devops-kung-fu/tap
Cloning into '/opt/homebrew/Library/Taps/devops-kung-fu/homebrew-tap'...
remote: Enumerating objects: 39, done.
remote: Counting objects: 100% (39/39), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 39 (delta 20), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (39/39), 6.45 KiB | 6.45 MiB/s, done.
Resolving deltas: 100% (20/20), done.
Tapped 3 formulae (15 files, 15KB).
ggshield ~ $brew install devops-kung-fu/homebrew-tap/hookz
==> Downloading https://github.com/devops-kung-fu/hookz/releases/download/v2.4.2/hookz_2.4.2_dar
curl: (22) The requested URL returned error: 404
Error: hookz: Failed to download resource "hookz"
Download failed: https://github.com/devops-kung-fu/hookz/releases/download/v2.4.2/hookz_2.4.2_darwin_all.tar.gz
ggshield ~ $brew install devops-kung-fu/homebrew-tap/hookz
==> Downloading https://github.com/devops-kung-fu/hookz/releases/download/v2.4.2/hookz_2.4.2_dar
curl: (22) The requested URL returned error: 404
Error: hookz: Failed to download resource "hookz"
Download failed: https://github.com/devops-kung-fu/hookz/releases/download/v2.4.2/hookz_2.4.2_darwin_all.tar.gz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.