g10k
g10k copied to clipboard
Clean up output, implement timeout, do not update the whole index when deploying a branch
Some set of fixes that I've done to make g10k usable on a large deployment:
- Do not lock modify whole index when deploying a specified branch (main use-case). Achieve this by using
git fetch ...instead of doinggit remote update --pruneeach time if we are interested only in one branch. Races are very common when trying to update all of the refs. Errors can still happen however because the webhook uses one goroutine it is very unlikely (imagine an event listener that fires off g10k deployments). Also, if one or more deploys when there >1 concurrent deploys at the same time will fail then it's not the end of the world because the one which "caught" the newest ref will succeed. Still do an initialgit remote update --pruneto download all of the refs and branches. - Implement the timeout functionality. Make proper contexts and pass them to
CommandContext() - Add a proper debug output with the command name + output + the error
Verification:
- The tests pass
- Battle-tested on a huge deployment (:
Pardon me if my coding style is bad or I did some mistakes.
Cool stuff!
I'll verify your changes later when I have more time available.