Commit Graph

522 Commits

Author SHA1 Message Date
sed-i 9780b620c0 Add repo-sync test 2022-02-25 03:46:37 -05:00
sed-i 4ca7832b0f Do not pass global flags outside of main 2022-02-25 02:22:37 -05:00
sed-i 50f6327baf Replace "origin" literal with flRepo
Replaces the hard-coded literal "origin" with the --repo value.
This way cleanup takes place even if --repo value changes between
invocations.
2022-02-24 23:33:15 -05:00
Tim Hockin 5707870ecc Make e2e treat args as tests-name regexes 2022-02-24 09:04:24 -08:00
Tim Hockin ad3955c0fa Add --git-gc flag to control GC on each sync
Values:
* "auto" - run `git gc --auto` (default, respects git gc.* configs)
* "always" - run `git gc`
* "aggressive" - run `git gc --aggressive` (may require a longer timeout)
* "off" - do not run `git gc` on each sync (good for --one-time use)
2022-02-23 16:23:55 -08:00
Tim Hockin 47404c921e Set some gc.* git config
In particular, this sets `gc.autoDetach` to "false".
2022-02-19 16:40:31 -08:00
Kubernetes Prow Robot e98bbb0228
Merge pull request #493 from thockin/release-3.x
Set repoReady even when there wasn't a 1st clone (v3 branch)
2022-02-14 04:33:29 -08:00
Tim Hockin ff156800a0 Set repoReady even when there wasn't a 1st clone
E.g. if the repo is already present (after a restart).
2022-02-12 17:35:04 -08:00
Kubernetes Prow Robot 53b4dbd00d
Merge pull request #490 from thockin/release-3.x
Set $GITSYNC_HASH in exechook (v3)
2022-02-06 23:41:43 -08:00
Tim Hockin 32e0d53b33 Set $GITSYNC_HASH in exechook 2022-02-06 16:26:04 -08:00
Kubernetes Prow Robot 83b5d64e26
Merge pull request #483 from thockin/release-3.x
Bump to go 1.17
2022-01-31 01:46:24 -08:00
Tim Hockin 8f46cbbb51 Bump go.mod to 1.17
run `go mod tidy` and `go mod vendor`
2022-01-28 20:10:20 -08:00
Tim Hockin a2f4f2446e Bump go to 1.17 2022-01-28 20:05:50 -08:00
Tim Hockin 76654434f2 Fix bug caused in previous PR
The .git to check is not the root/.git but the link/.git - tests pass
now.
2022-01-24 11:01:26 -08:00
Kubernetes Prow Robot 0ce336f03c
Merge pull request #477 from thockin/v3-link-abspath
Allow --dest to be an absolute path (v3)
2022-01-23 02:37:56 -08:00
Kubernetes Prow Robot c0aa9f675d
Merge pull request #475 from thockin/v3-double-register-hook-metric
Don't double-register the hook metric (v3)
2022-01-23 01:17:56 -08:00
Kubernetes Prow Robot bf112d08d8
Merge pull request #473 from thockin/release-3.x
Don't try to remove the root if it appears corrupt (v3)
2022-01-23 01:11:56 -08:00
Tim Hockin ce8c4d38e0 Allow --dest to be an absolute path
This means it might live outside of --root.
2022-01-22 23:26:36 -08:00
Tim Hockin cbf8b896a3 Don't double-register the hook metric 2022-01-22 14:25:24 -08:00
Tim Hockin fb895f2c12 Don't try to remove the root if it appears corrupt
The `--root` is often a volume and can't be removed.  Instead, remove
the contents of it.  Adjust tests to hit this.
2022-01-22 12:47:19 -08:00
Tim Hockin d88ae88b34 Fix e2e, dropped 'finish()' func 2022-01-21 20:24:09 -08:00
Kubernetes Prow Robot a385492d63
Merge pull request #469 from thockin/release-3.x
Ensure web/exec hooks complete in --one-time
2022-01-20 04:15:51 -08:00
Tim Hockin 89b0bd5448 Ensure web/exec hooks complete in --one-time
Also some small e2e cleanups.  This is a port from master branch.
2022-01-19 12:01:15 -08:00
Kubernetes Prow Robot 890531f7b0
Merge pull request #464 from nan-yu/release-3.x
Expose the ssh diagnostic message
2022-01-06 16:26:30 -08:00
Nan Yu ad7f801609 Expose the ssh diagnostic message
When git-sync fails to clone the git project, the ssh diagnostic message
is suppressed. It is sometimes helpful for debugging the cloning issue.
One example of the ssh dianostic message is
```
ssh: Could not resolve hostname ${REPO_HOST}: Name or service not known
```

This commit removes the `-q` flag from the ssh command to expose such
message.
2022-01-06 16:12:06 -08:00
Mac Chaffee 0f1ed5e8e6
Avoid writing to /etc/passwd unless needed (#461)
* Avoid writing to /etc/password unless needed

Signed-off-by: Mac Chaffee <me@macchaffee.com>

* Use user.LookupId to check /etc/passwd

Signed-off-by: Mac Chaffee <me@macchaffee.com>

* Remove unused variables

Signed-off-by: Mac Chaffee <me@macchaffee.com>
2021-12-23 09:22:37 -08:00
Kubernetes Prow Robot dc324f4283
Merge pull request #454 from yedamao/release-3.x
fix typo
2021-11-24 11:03:32 -08:00
yedamo a7acf14da7 fix typo 2021-11-20 13:08:19 +08:00
Tim Hockin aceea84578 E2E: build IFF running tests 2021-10-18 09:38:06 -07:00
Tim Hockin fb9dd2d730 E2E: Add whitespace for reading 2021-10-18 09:38:06 -07:00
Tim Hockin d190159438 E2E: Rename test funcs 2021-10-18 09:38:06 -07:00
Tim Hockin dbd0b47635 E2E: make all test cases be funcs
Make all test cases functions so they can be called individually on the
CLI.  Call test_e2e.sh with `-?` to list tests.   Fix related crashes
2021-10-18 09:38:06 -07:00
Tim Hockin e1ea155f92 E2E: Make SIGINT handling more complete 2021-10-18 09:38:06 -07:00
Tim Hockin 470d70bb42 E2E: Use vars for branch names 2021-10-18 09:38:06 -07:00
Tim Hockin 62830c2a19 E2E: always use '[[ ]]' 2021-10-18 09:38:06 -07:00
Tim Hockin 722ad23e60 Fix e2e cases to not destroy logs 2021-10-18 09:38:06 -07:00
and-1 cca5a5e917 Fix password-file flag declaration 2021-10-12 21:38:25 -07:00
Kubernetes Prow Robot 26c61968d3
Merge pull request #445 from natbaker/use_hash_for_worktree
use branch revision during worktree add
2021-10-04 15:29:43 -07:00
Natalie Baker 2c3bb035f6 Use hash for branch when adding a new worktree 2021-10-04 16:55:32 -04:00
Kubernetes Prow Robot f52e17ea2c
Merge pull request #442 from thockin/release-3.x
Port small fixes from v4 branch
2021-08-18 08:44:08 -07:00
Tim Hockin 9835c219d0 Fix env var names 2021-08-17 08:26:59 -07:00
Tim Hockin 44306c0dd8 Rename exechook receivers 2021-08-16 23:45:48 -07:00
Tim Hockin 2d3ccf6026 Add one call depth to compensate for log pkg 2021-08-16 23:43:47 -07:00
Kubernetes Prow Robot a510b67602
Merge pull request #437 from eminugurkenar/release-3.x
Add syncHookCommand error metric
2021-08-16 12:44:23 -07:00
ugurkenar df69fab365 cmd,hook and logging package 2021-08-16 12:40:27 +03:00
Kubernetes Prow Robot 5fcf46aee4
Merge pull request #435 from thockin/release-3.x
Add option to read passwd from file (v3 branch)
2021-07-06 04:24:21 -07:00
Tim Hockin 2a81ea69f0 Add option to read passwd from file
This is a port of #431.

A new flag `--password-file` is added. This allows git-sync to read
password from file and this is considered as safer than reading from
env or flag directly.

Few more checks are added as well:

1. `--password` and `--password-file` can't be specified at the same
time.
2. If `--username` is specified, then one of `--password` or
`--password-file` must be specified.
2021-07-05 15:49:18 -07:00
Kubernetes Prow Robot 259f7d8000
Merge pull request #432 from amccague/patch-1
Update to latest base image debian-base:buster-v1.8.0
2021-06-30 17:15:54 -07:00
Adrian McCague d1a773f818
Update Makefile
Use the latest promoted debian base image: https://github.com/kubernetes/k8s.io/pull/2256

Overcomes 2 critical vulnerabilities:
* https://nvd.nist.gov/vuln/detail/CVE-2021-20231
* https://nvd.nist.gov/vuln/detail/CVE-2021-20232

My organisation cares about published and fixed vulnerabilities and we use this tool extensively, thank you for it :)
2021-06-30 13:37:04 +01:00
Kubernetes Prow Robot fc7162b321
Merge pull request #426 from thockin/release-3.x
Update RELEASING doc
2021-06-24 10:17:41 -07:00