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
f0ec409582
Populate last hash value in case webhook is slower than the main loop.
2019-10-27 14:33:40 +01: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
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
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
Zac
160d68f29c
removed unecessary logs
2019-01-22 14:12:49 -08:00
Zac
6b8aac0b83
modularized and documented
2019-01-22 14:12:49 -08:00
Zac
e437d8e9a3
adding changes from previous PR, updated README
2019-01-22 14:12:49 -08:00
Zac
01f007a753
updated verbosity settings for POST request log
2019-01-22 14:12:49 -08:00
Zac
f8f555d73a
updated post request code
2019-01-22 14:12:49 -08:00
Zac
0eac8fc5cf
added some logs and moved where the post request is made
2019-01-22 14:12:49 -08:00
Zac
7f64d79bbe
Updated main to add the env var and send a post request
2019-01-22 14:12:49 -08:00
Thomas Jackson
b9c0ed3f5d
Update env vars based on comments
2019-01-22 13:41:45 -08:00
Thomas Jackson
088065e494
Normalize flag names to include `-file`
2019-01-22 13:41:45 -08:00
Thomas Jackson
933bbdfc1f
Add flag for ssh known hosts file
2019-01-22 13:41:45 -08:00
Thomas Jackson
c4c68e2620
Move SSH key path to a flag
2019-01-22 13:41:45 -08:00
Thomas Jackson
5573584fc6
Only allow -1 as "unlimited failures"
2019-01-18 09:08:50 -08:00
Thomas Jackson
ba3f44ca28
Add option to allow for unlimited failures
2019-01-17 16:01:49 -08:00
George Angel
a86ad5d950
add timeout tests
...
- custom `git` command option
- tests on slow running git commands
2019-01-04 22:32:53 +00:00
George Angel
cb8eac2b75
revert to original conditional format
2019-01-04 20:50:57 +00:00
George Angel
5a2584188f
fix context cancelling
2019-01-04 20:50:57 +00:00
George Angel
db07a432cd
Add a configurable timeout to the sync process
2019-01-04 20:50:57 +00:00
Tim Hockin
40e188fb26
Switch to rev-parse
...
This handles non-annotated tags, which were not handled well before. It
does mean that we use the hash of the (annotated) tag object instead of
the commit, but that seems OK.
Added a test case.
2018-11-09 10:16:36 -08:00
Tim Hockin
296093b9df
Clean up failed clones
...
If an initial clone crashes, it can leave the git-root in a bad state
such that git can't retry the clone. This change forces it to clean up
the mess and retry.
2018-08-21 08:04:45 -07:00
Tim Hockin
2e46b74cf8
Make the default checkout root be under HOME)
2018-08-08 11:37:19 -07:00
Bryce Cronkite-Ratcliff
ef9bc21b8f
Error if HTTP & SSH parameters provided
...
If both HTTP and SSH parameters are provided to the container on
startup, return an error to help users that have confused their
configurations.
2018-06-01 14:45:06 -07:00
Bryce Cronkite-Ratcliff
f69e8fb2c0
Add gitcookie configuration option
...
Add an option to specify a git http cookie file in the k8s yaml
that will be configured as the global git cookie file in the git-sync
client.
This is a useful access mechanism for some some hosted repositories
where SSH and passwords are not easily available, such as Google Cloud
Source Repositories.
2018-06-01 14:45:06 -07:00
Frank Farzan
c9f2e62ed3
Don't set GIT_SYNC_DEST in Dockerfile.
...
I'm guessing this is an artifact of previous refactorings.
Currently, GIT_SYNC_ROOT defaults to /git and GIT_SYNC_DEST
defaults to leaf dir of repo.
2018-02-05 19:21:13 -08:00
Pieter Lange
cdd6f09878
Flip the known_hosts enforcement to true so the git hosts actually gets verified
2017-09-16 01:28:04 +02:00
Tim Hockin
ac0817b212
Fix one-shot sync of a rev
2017-09-15 10:04:50 -07:00
Pieter Lange
899cf5974e
Add feature flag to enable ssh host key verification.
2017-04-25 00:34:01 +02:00
Pieter Lange
3b8bf0308c
Use secure defaults (check hostkeys)
2017-04-21 15:09:37 +02:00
Michael Grosser
cb9851e1b5
Revert "Update copyright notice"
...
This reverts commit b647219b69 .
2017-03-22 04:25:39 +00:00
Michael Grosser
b647219b69
Update copyright notice
2017-03-22 04:23:08 +00:00
ideahitme
b8cc35f4fc
clean up Dockerfile, remove ssh-wrapper.sh and set env var
2017-01-26 19:04:24 +01:00
fate-grand-order
fa78169d25
fix misspell "recommended" in main.go
2017-01-17 15:26:27 +08:00
Aman
ea98806bc9
Remove chmod command since we can specify permissions for Secret Volumes
...
- Fixed because of https://github.com/kubernetes/kubernetes/pull/28936
2016-12-19 21:55:34 +05:30
TerraTech
cf180e765b
main.go: Fixes git error: did you mean `--depth` (with two dashes ?)
2016-11-13 03:47:02 -05:00
Tim Hockin
70feeb5ae1
Use the go-build-template
...
Faster builds and versions from tags. Also use alpine as a base image. We
need alpine for other architectures...
Also change the --wait flag to take a float for sub-second waits.
2016-10-30 17:09:06 -07:00