Giter Site home page Giter Site logo

devops-kung-fu / hookz Goto Github PK

View Code? Open in Web Editor NEW
75.0 75.0 1.0 2.17 MB

Manages client side git hooks resulting in the ability to create git action pipelines.

License: Mozilla Public License 2.0

Go 96.96% Makefile 2.37% Shell 0.67%
devops devops-tools github hooks pre-commit-hooks

hookz's People

Contributors

dependabot[bot] avatar djschleen avatar juliojimenez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

marianod92

hookz's Issues

Shell location hardcoded

Issue

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.

Workaround

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 script support

Add a scripts attribute to the yaml config to support custom inline scripts

Add a top level node for go tool installation in .hookz.yaml

Hooks supports the download of tools via the URL property, but it will download the binary and place it in the .git/hooks subdirectory.

  • Create a new top level node called tools. This should be an array of tools to install (name is tool). Values need to be a repository containing go files that could be installed as follows: go install github.com/devops-kung-fu/hinge@latest.
  • Syntax of the tool value should be the repository and version. Example: github.com/devops-kung-fu/hinge@latest, where @latest can be replaced with a specific version.
  • When the user inits or resets the hookz system, it will run go install on the value of the tool node.

Silent fails on incorrect yaml

Issue

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.

Steps to reproduce

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

When --debug is set, hookz should have better logging

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]

brew install returning a 404

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.