Tim Hockin
b36c6851a2
Use a private gitconfig file
...
This was changing my own ~/.gitconfig whenever run by hand outside of a
container. Oops.
2023-04-06 17:46:05 -07:00
Tim Hockin
31e2a2669d
Add logs when we use deprecated flags
2023-02-16 14:44:25 -08:00
Timothy Rule
2b3f1bcdd7
Add cli option sync-on-signal to trigger git-sync with a signal. ( #664 )
...
Operation:
git-sync --repo https://github.com/kubernetes/kubernetes --sync-on-signal SIGHUP
git-sync --repo https://github.com/kubernetes/kubernetes --sync-on-signal HUP
git-sync --repo https://github.com/kubernetes/kubernetes --sync-on-signal 1
Signals can be sent to docker containers with cmd:
docker kill -signal SIGHUP <Container ID>
2023-02-15 12:00:22 -08:00
Kubernetes Prow Robot
681dacd6b7
Merge pull request #676 from thockin/v4_deref_tags
...
v4: Deref tags on ls-remote
2023-02-14 11:49:52 -08:00
Tim Hockin
2d61e6a5ea
Default http-metrics to false
...
After the change to require http-bind, this default doesn't make sense.
My local branch had other commits, which hid this error.
2023-02-11 10:38:17 -08:00
Tim Hockin
139352ecee
Deref tags on ls-remote
...
A previous commit (2f7335868e ) introduced
a quiet bug which results in the "update needed" condition triggering
every loop. e2e passed for me by sheer luck of winning races. Until it
didn't. Walking thru with the debugger to figure it out, I realized
this issue.
The short story: `ls-remote` for a tag gets us the SHA of the tag, but
`rev-parse HEAD` gets us the SHA of the commit to which that tag is
attached. Those are never equal, so we detect "update needed" every
loop.
Now we ask `ls-remote` for the rev and the dereferenced rev. If that
rev is a branch, the deref does nothing. If that rev is a tag it
produces both results. ls-remote does its own sort, so the deref (if
found) comes after the non-deref. This means that, in both cases, the
last line is the one we want.
2023-02-10 21:18:34 -08:00
Tim Hockin
8abd849e2c
Require --http-bind when using other http flags
...
Also use the word "set" for bool flags, rather than "specified" (easier
to read.
2023-02-10 21:18:21 -08:00
yoyehan
2f7335868e
Fix cases of syncing different SHAs back to back
...
Prior to this, it would fail if the 2nd SHA wasn't in the local repo.
Now it doesn't care what the local SHA for rev is, it only cares what is
checked out at HEAD.
2022-12-25 14:02:12 -08:00
Tim Hockin
7f8aad23e6
e2e: fix sync_fetch_skip_depth_1
...
e2e: fix sync_fetch_skip_depth_1
The improvements in e2e perf broke this test case. Make it more
explicit - this is not a success (triggering touch), but not really a
failure either. Now it will not touch the touch-file.
2022-11-24 17:50:02 -08:00
Tim Hockin
8081a6e1c3
Allow quoted keys for --git-config
...
This allows keys to contain literal ':' which would previously confuse
the parser.
2022-11-19 17:28:06 -08:00
Tim Hockin
a05f6c0745
Updated gofmt style
2022-11-19 16:32:41 -08:00
Eng Zer Jun
91113aa314
refactor: move from io/ioutil to io and os packages
...
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.
[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-11-04 20:34:57 +08:00
Kubernetes Prow Robot
bc5db09fe2
Merge pull request #639 from thockin/v4_touch_file
...
Add --touch-file flag and use it in tests
2022-10-31 07:18:43 -07:00
Tim Hockin
bda1f84614
Add --touch-file flag and use it in tests
...
This is mostly designed to make testing easier instead of sleep.
2022-10-30 17:01:55 -07:00
Tim Hockin
428169b87e
Do print-and-exit flags before logging
2022-10-30 16:50:42 -07:00
Kubernetes Prow Robot
34c33c724a
Merge pull request #633 from thockin/use-makeAbsPath
...
use makeAbsPath for link
2022-09-11 08:49:23 -07:00
Kubernetes Prow Robot
2edd4e5d9e
Merge pull request #632 from thockin/error-file-abs-path
...
Make --error-file allow abs paths
2022-09-11 08:47:23 -07:00
Tim Hockin
87cbd3a691
use makeAbsPath for link
2022-09-05 14:54:25 -07:00
Tim Hockin
c32a042213
Make --error-file allow abs paths
...
This also enforces th previously unenforced "must not start with a
period" rule.
2022-09-05 14:54:10 -07:00
Tim Hockin
3bff6b3cf8
Change the sync loop to do a full sync
...
No longer distinguish the first sync from the rest. This will make later
changes easier.
2022-09-05 14:53:39 -07:00
Kubernetes Prow Robot
77edb67ecf
Merge pull request #627 from thockin/manual_text
...
Fix some of the manual help text
2022-09-04 05:42:35 -07:00
Tim Hockin
f78dc35bf2
Fix some of the manual help text
2022-09-03 10:37:39 -07:00
Tim Hockin
21d331ca7d
typo
2022-09-02 13:45:04 -07:00
Kubernetes Prow Robot
6e03c52fc3
Merge pull request #615 from thockin/fetch_if_depth_and_rev_not_found
...
Support shallow sync when the rev is not in-range
2022-08-30 02:51:01 -07:00
Kubernetes Prow Robot
0c0c6f007b
Merge pull request #618 from thockin/fix-env-var-names
...
Allow flags to have multiple env var names
2022-08-30 02:09:01 -07:00
Kubernetes Prow Robot
a1837b827a
Merge pull request #621 from thockin/remove-vestigial-field-sync-command
...
Remove now-obsolete flag from struct
2022-08-29 04:46:37 -07:00
Kubernetes Prow Robot
8a6652e980
Merge pull request #620 from thockin/max-failures-flag-name
...
--max-sync-failures -> --max-failures
2022-08-29 04:44:37 -07:00
Tim Hockin
cdd6980782
Remove now-obsolete flag from struct
...
This was changed to the more general `exechook`, but must have been
missed.
2022-08-21 10:49:27 -07:00
Tim Hockin
eb33e7cfcb
--max-sync-failures -> --max-failures
...
Deprecate but retain the old flag and env.
2022-08-21 10:48:20 -07:00
Tim Hockin
8c6dfeab89
Allow flags to have multiple env var names
...
Anything but the 0th name is considered deprecated.
2022-08-20 17:33:56 -07:00
Tim Hockin
ff0a73f5ad
Support shallow sync when the rev is not in-range
...
If I ask for `--depth 1` and a branch, it's fine.
If I ask for `--depth 1` and a tag, and that tag is not within 1 commit
of the branch that was cloned, it will give an error. Oddly, if the
initial `clone` was OK, and subsequent syncs drift, it is OK, because of
how we `fetch`. But if it is too far away at the beginning, kaboom.
This betrays that the current model of `--branch` and `--rev` is really
broken, and should be revamped. For now, I did something simple - if
the rev can't be found, try a fetch. A "real" fix is more involved.
Also add tests.
2022-08-20 15:41:33 -07:00
Tim Hockin
e047848966
Retain user-provided GIT_SSH_COMMAND
2022-08-20 15:24:00 -07:00
Tim Hockin
b3347f5b24
Log before running command
2022-08-15 09:07:48 -07:00
Kubernetes Prow Robot
a1d0e16ad6
Merge pull request #610 from thockin/redact_repo_url
...
Better passwd redacting - including URLs
2022-08-15 02:28:13 -07:00
Kubernetes Prow Robot
5e2996ab91
Merge pull request #606 from thockin/reset_soft_root
...
Reset --soft in the root
2022-08-15 01:36:13 -07:00
Kubernetes Prow Robot
2e2f991604
Merge pull request #605 from thockin/symlink_rename
...
Use os.Symlink() and os.Rename() instead of exec
2022-08-15 01:14:13 -07:00
Tim Hockin
f46dae659f
Better passwd redacting - including URLs
2022-08-14 16:32:45 -07:00
Tim Hockin
74b6a13d76
Log when exiting after --one-time
2022-08-12 21:00:46 -07:00
Tim Hockin
8b99b7c143
Use os.Symlink() and os.Rename() instead of exec
...
Should be more portable (MacOS flags to ln and mv are not the same as
GNU).
2022-08-12 21:00:28 -07:00
Tim Hockin
5050413d09
Reset --soft in the root
...
Using --hard checks out all the files. Not resetting fails tests.
2022-08-12 16:34:14 -07:00
Tim Hockin
037af64d3f
Add notes about volumes and lost+found
2022-07-29 14:20:41 -07:00
Tim Hockin
3cf0d42517
Add missing key to log-line
2022-07-29 14:00:03 -07:00
Kubernetes Prow Robot
9785945874
Merge pull request #596 from thockin/v4_log_env_at_startup
...
Log a redacted form of environment at startup
2022-07-27 01:10:31 -07:00
Tim Hockin
0b92a4971c
Log env at startup
2022-07-26 11:28:38 -07:00
Tim Hockin
9529c24f6d
Redact password when logging args
2022-07-26 11:28:38 -07:00
Tim Hockin
035072b718
Fix wrong env var name in docs
2022-07-26 11:24:36 -07:00
Tim Hockin
058ccea621
Don't set known_hosts to /dev/null
...
This causes git to log, repeatedly, that it is "adding to known hosts".
2022-07-14 10:11:13 -07:00
Tim Hockin
e8ef2c05be
Change from "store" to "cache" for credentials
...
This means they need to be refreshed every so often, so we'll just do it
every sync loop.
2022-07-14 10:08:12 -07:00
Tim Hockin
e765289185
log.V(9) md5sums of credentials
2022-07-14 09:53:35 -07:00
Tim Hockin
94e8d00093
Logging and error handling cleanup
2022-07-14 08:29:53 -07:00