Commit Graph

84 Commits

Author SHA1 Message Date
Tim Hockin e97eff010f trivial comments 2019-11-26 13:42:15 -08:00
Tim Hockin 287a0e5464 var renames for readability 2019-11-26 13:42:15 -08:00
Tim Hockin 415303f900 Rename for clarity 2019-11-26 13:42:15 -08:00
Kubernetes Prow Robot 5d7622e6ec
Merge pull request #208 from thockin/code-move-cleanups
Code move cleanups
2019-11-26 01:05:10 -08:00
Kubernetes Prow Robot cbad455c2b
Merge pull request #205 from thockin/git-cat-file
Make revIsHash a bit safer
2019-11-23 02:41:49 -08:00
Tim Hockin 74d3e9daab move code for readability 2019-11-21 21:57:53 -08:00
Tim Hockin d980b6d9d6 Move prune logic for cohesion 2019-11-21 21:57:53 -08:00
Tim Hockin dc5bdcb461 Better flag help strings 2019-11-21 21:47:15 -08:00
Tim Hockin 1b295ad217 Make revIsHash a bit safer 2019-11-21 08:55:30 -08:00
Tim Hockin f433b067ca Rename snake_case variable 2019-11-21 08:48:36 -08:00
Tim Hockin 5daf3a42f7 Clean up webhook a bit
Return hash so we don't need to recalculate.

Rename some funcs.
2019-11-17 13:22:38 -08:00
Kubernetes Prow Robot 7353b157b2
Merge pull request #193 from peick/http-header-webhook
Sent git hash and branch in the HTTP header of the webhook.
2019-10-29 09:16:46 -07:00
Kubernetes Prow Robot 012d0bfbf0
Merge pull request #194 from thockin/fix-pid1
Handle running as PID 1
2019-10-28 15:52:43 -07:00
Michael Peick 5cb2198689 Remove unnecessary comment. 2019-10-28 21:58:44 +01:00
Michael Peick 440eac730e Make hash value updates and reads atomic using mutex. 2019-10-28 21:57:03 +01:00
Kubernetes Prow Robot 26f21906be
Merge pull request #197 from hypnoglow/fix-nits
Fix minor issues from linters
2019-10-28 13:26:44 -07:00
Kubernetes Prow Robot 4bb587e083
Merge pull request #190 from hypnoglow/switch-to-runcommand
Replace exec.Command with runCommand
2019-10-28 13:24:43 -07:00
Igor Zibarev bff7e7bf43 Replace exec.Command with runCommand 2019-10-28 22:16:56 +03:00
Igor Zibarev 7a3c0679d5 Fix minor issues from linters 2019-10-28 22:05:39 +03:00
Tim Hockin 2a42fba009 Handle running as pid 1
This detects when it is running as pid 1, and becomes an init process.
Specifically this means handling SIGCHLD and reaping processes
(otherwise they become zombies) and forwarding signals to "real"
process.

We fork and re-exec ourselves so that we only get *this* SIGCHLD for
orphaned processes (re-parented to 1) and not the real events from
running things like git or ssh.
2019-10-27 09:45:27 -07:00
Michael Peick c3d026bf2b Cleanup test. 2019-10-27 14:47:18 +01:00
Michael Peick f0ec409582 Populate last hash value in case webhook is slower than the main loop. 2019-10-27 14:33:40 +01:00
Michael Peick e214aeb4d6 Rename http header "Git-Sync-Hash" into "Gitsync-Hash". 2019-10-26 13:34:39 +02:00
Michael Peick 1eb223e2cc Do not send branch information as http header. 2019-10-26 13:34:16 +02:00
Michael Peick 9ecc67fb3a Sent git hash and branch in the HTTP header of the webhook. 2019-10-25 10:42:37 +02:00
Michal Lula 94818756af 🔧 add depth flag support and cover with tests 2019-10-21 10:40:51 +02:00
Michal Lula d263429c6d 🎨 add todo comment for --depth flag support 2019-10-18 17:50:04 +02:00
Michal Lula 41c8572ad6 add tests 2019-10-11 17:58:47 +02:00
Michal Lula 3f06a3ba4b :spakrles: add git submodules support 2019-10-02 16:41:28 +02:00
Filip Filmar bbf6d60f36 git-sync: removes special exit on first error
Old code used to exit at any error seen on first sync attempt.  This
didn't prove useful in practice, so removing that special case.

This may make git-sync slower to recover after user fixes a
non-retryable error, as now flMaxSyncFailures are needed before the pod
fails.  It may make sense in practice.

Fixes #161, in a different way than is proposed in PR #162.
2019-04-02 10:06:00 -07:00
Tim Hockin 4493070350 Add --version flag 2019-03-25 08:54:44 -07:00
Tim Hockin 831eae8f9f Use official logr rather than thockin 2019-03-25 08:54:44 -07:00
Tim Hockin 51f19b81c9 Fix SSH
* Create a git-sync user to run as, with an entry in /etc/passwd and
writable homedir

* Remove our own validation of key perms - let SSH do that.

* Update docs,
2019-02-07 16:32:01 -08:00
Tim Hockin abf5f0748d
Merge branch 'master' into metrics 2019-01-23 08:18:21 -08:00
Thomas Jackson 6cfa3e1690 Add pprof endpoint
This requires moving to a non-default ServeMux so we can control whether
pprof is enabled or not
2019-01-22 17:26:27 -08:00
Thomas Jackson 73a0e50ee1 Add dumb liveliness endpoint
This currently returns 200 always. In the future we can add options for
controling what constitues "liveliness"
2019-01-22 17:26:27 -08:00
Thomas Jackson 0beb2decf4 Change HTTP flags
This enables the HTTP endpoint by default using ":8080". In addition
this adds a flag for disabling the metrics endpoint
2019-01-22 17:26:27 -08:00
Thomas Jackson e32712b301 Add basic prometheus metrics 2019-01-22 17:26:27 -08:00
Thomas Jackson 4df44b1fcf Add http handler option 2019-01-22 17:26:27 -08:00
Thomas Jackson f1a1a1b61e Use depth option when doing fetches
Previously the `depth` flag was only used for the initial clone-- so
although you might start with a depth=10 as more commits show up you are
always >10. With this diff we enforce that depth on each fetch, this way
old-commits can get GCd off to reduce the size of the local checkout
required.
2019-01-22 16:44:16 -08:00
Thomas Jackson 87503c6dce Clarify webhook behavior in docs/README 2019-01-22 14:12:49 -08:00
Thomas Jackson edaa75b8a5 Remove empty comment line 2019-01-22 14:12:49 -08:00
Thomas Jackson ad41260327 Clarify success-status config/option 2019-01-22 14:12:49 -08:00
Thomas Jackson 54ec971ba0 Remove "duration" from flag/env/var names 2019-01-22 14:12:49 -08:00
Thomas Jackson 6e0bd948ec Add option to control backoff for failed webhook calls 2019-01-22 14:12:49 -08:00
Thomas Jackson fdc9b49de2 Reduce to a single webhook call 2019-01-22 14:12:49 -08:00
Thomas Jackson 96714ebed2 Remove global trigger channel
Instead change syncRepo to return a boolean which is whether a change
occured.
2019-01-22 14:12:49 -08:00
Thomas Jackson 39ca0a2ca0 Fix error log to print out actual status codes 2019-01-22 14:12:49 -08:00
Thomas Jackson 18f68d3ab6 Move timeout into the json arg for webhook 2019-01-22 14:12:49 -08:00
Thomas Jackson a45699efb1 goimports 2019-01-22 14:12:49 -08:00