gitkube
gitkube copied to clipboard
Templating for git hooks
Currently, pre-receive hook is fixed: https://github.com/hasura/gitkube/blob/master/build/gitkubed/pre_receive.sh
We want to make it scriptable to enable : https://github.com/hasura/gitkube/issues/20
Each hook probably needs variables from the remote like DEPLOYMENTS, REGISTRY_PREFIX. For pre-receive, we are currently doing a moustache render during startup.
For giving same variables to each hook, we need to run a moustache render on each hook and then place it in the correct directory.
Would this also allow something like using a secret as a Docker build argument? For example, now I need to pass a Github token to a Dockerfile for fetching Github repos during the build. I can get the secret into Gitkubed's environment, but I see there is no way to pass a build argument currently.
@jsierles Yep. You can then load the build argument from the kubernetes environment
kubectl get secrets my-secrets -o json | jq -r '.data."githubToken"' | base64 --decode
and then pass that as a build-arg to the docker build command.
@tirumaraiselvan Does that make sense?
Yeah sounds good. But this is still not done or on any WIP branch, correct? Is there an easy way to manually update the hook besides updating gitkube to support more docker build
arguments and redeploying it?
Yes, this issue is to make available arbitrary params to the build environment which can then be used in custom hooks. Custom hooks is in a WIP branch although I haven't gotten around to parameterization part yet. For now, the easiest way is to keep the token in the Dockerfile. The harder way is to fork from master and build your own version of Gitkube.
@jsierles docker build args support is here https://github.com/hasura/gitkube/pull/64