Commit Graph

653 Commits

Author SHA1 Message Date
ChrisERo 0246fb509f feat: added e2e --one-time tests for webhook 2022-01-10 20:06:25 -05:00
ChrisERo 8e098f8c2a fix: made exechook_once tests more efficient
* Removed multiple iterations of tests
* Reduced sleep time after GIT_SYNC command execution
2022-01-10 20:06:24 -05:00
ChrisERo b8970bef85 fix: reduced time spent sleeping in SLEEPTY exechooks 2022-01-10 20:06:23 -05:00
ChrisERo 0df6e005d3 refactor: fixed in-line documentation and added line-wraps where needed 2022-01-10 20:06:23 -05:00
ChrisERo f67669662b fix: corrected comment for hook channels to refflect true functionality 2022-01-10 20:06:22 -05:00
ChrisERo d2a4320e6c fix: execute hook check only on --one-time
Execute hook check only if --one-time  is true and corrected log spelling of webhook and exechook
2022-01-10 20:06:22 -05:00
ChrisERo a362b4a5f4 feat: added tests for this PR that test exechook paired with --one-time flag 2022-01-10 20:06:21 -05:00
ChrisERo 3b5ed549eb fix: addressed several concers raised by thockin
- Renamed [x]HookChannel to [x]hookChannel for consistency
- Made hookChannels buffered chanels of size 1
- Added clarifying documentation and renamed functions expalining how I was
    - ensuring that hooks execute at least once, assuming that main thread does not crash
    - make sure chanels are not written to more than once
2022-01-10 20:06:06 -05:00
ChrisERo 9e6348c3b5 fix: resolve issue number 463
Resolved original issue by introducing a boolean chanel by which exechook runner can communicate with main thread.
Then introduced and used webhook executed-at-least-once chanel and added documentation explaining sections of of code
only executed when git-sync pulls for first time.
2022-01-10 20:05:53 -05:00
Kubernetes Prow Robot ba34a38e14
Merge pull request #465 from nan-yu/master
Expose the ssh diagnostic message
2022-01-10 10:48:25 -08:00
Nan Yu 25a13c5288 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:34:56 -08:00
Kubernetes Prow Robot eb822be2e5
Merge pull request #462 from thockin/master
Avoid writing to /etc/passwd unless needed
2022-01-03 04:41:00 -08:00
Tim Hockin c6c19dc61a Avoid writing to /etc/passwd unless needed
Port #461 by mac-chaffee to v4 branch.
2021-12-23 09:04:18 -08:00
Kubernetes Prow Robot 65a5bc7f90
Merge pull request #455 from thockin/master
v4: Replace glogr with funcr
2021-11-25 04:08:34 -08:00
Tim Hockin 4603f559f3 Replace glogr with funcr
No difference in flags.  Log output will now be JSON.

example:

{"logger":"","ts":"2021-11-24 11:19:46.340238","caller":{"file":"main.go","line":1031},"level":0,"msg":"cloning repo","origin":"https://github.com/thockin/git-sync","path":"/tmp/gt"}
2021-11-24 11:18:07 -08:00
Kubernetes Prow Robot 72ed142afc
Merge pull request #451 from thockin/master
v4: use repo default branch instead of master
2021-11-08 23:29:39 -08:00
Tim Hockin 7b32caee77 v4: use repo default branch instead of master 2021-11-01 23:05:48 -07:00
Tim Hockin 2b471ba2d7 E2E: build IFF running tests 2021-10-18 09:36:52 -07:00
Tim Hockin 6e52fb0d22 E2E: Add whitespace for reading 2021-10-18 09:36:52 -07:00
Tim Hockin 320a4a7e93 E2E: Move code
Reduce the diff between v3 and v4
2021-10-18 09:36:52 -07:00
Tim Hockin 27f2c905fc E2E: Rename test funcs 2021-10-18 09:36:52 -07:00
Tim Hockin dfcafc9ca0 E2E: Fix endless loop on error 2021-10-18 09:36:52 -07:00
Tim Hockin e2ed136aad 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
(uses of $TESTCASE and so on).
2021-10-18 09:36:52 -07:00
Tim Hockin e06f9c6acb E2E: Make SIGINT handling more complete 2021-10-18 09:36:52 -07:00
Tim Hockin 7b3454e51b E2E: Use vars for branch names 2021-10-18 09:36:52 -07:00
Tim Hockin 286175cb94 E2E: always use '[[ ]]' 2021-10-18 09:36:52 -07:00
Tim Hockin a91777288a use branch revision during worktree add (v4)
This is a port of the v3 commit 2c3bb035f6
2021-10-18 09:32:57 -07:00
Tim Hockin 4d286fc44f Fix e2e cases to not destroy logs 2021-10-18 09:32:57 -07:00
Kubernetes Prow Robot 80b7774dc0
Merge pull request #441 from thockin/master
Make exechooks work like webhooks.
2021-08-18 13:59:45 -07:00
Tim Hockin 05f0476d63 Fix env var names 2021-08-17 08:28:15 -07:00
Tim Hockin 0ea10cbbc2 Add one call depth to compensate for log pkg 2021-08-16 23:45:10 -07:00
Tim Hockin dc02fd98c0 Make logging and exec members of the git struct
Otherwise they are floating global pointers, which sucks in tests.
2021-08-16 23:21:26 -07:00
Tim Hockin 0075df238c Make exechooks work like webhooks.
This deprecates the `--sync-hook-command` flag in favor of
`--exechook-command`, `--exechook-timeout`, and `--exechook-backoff`.
2021-08-16 23:21:20 -07:00
Kubernetes Prow Robot 766682c5fa
Merge pull request #436 from thockin/master
Small nits I found with password-file while porting #431
2021-07-06 00:22:18 -07:00
Tim Hockin 18947d3e37 Small nits I found with password-fil while porting
Forgot the manual entry for it, tweaked some words.
2021-07-05 15:39:56 -07:00
Kubernetes Prow Robot 83d9a44f4f
Merge pull request #431 from zhouhaibing089/flag-password-file
Add option to read password from file
2021-07-05 15:21:38 -07:00
Haibing Zhou 6076daf3c4 Add option to read password from file
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.
1. If `--username` is specified, then one of `--password` or
`--password-file` must be specified.
2021-07-05 14:34:03 -07:00
Kubernetes Prow Robot 8003e8cc1b
Merge pull request #434 from xinydev/remove-broken-links
Remove broken analytics links
2021-07-04 15:30:19 -07:00
XinYang 78a1cffbd3
remove broken analytics links
Signed-off-by: XinYang <xinydev@gmail.com>
2021-07-03 23:51:53 +08:00
Kubernetes Prow Robot 78a7aa0cb7
Merge pull request #433 from thockin/master
Bump base image version (v4 branch)
2021-07-01 13:53:51 -07:00
Tim Hockin 5d9abd7bdf Bump base image version 2021-07-01 13:50:18 -07:00
Kubernetes Prow Robot 3757ce7f85
Merge pull request #427 from thockin/master
Update RELEASING doc (v4 branch)
2021-06-24 10:17:41 -07:00
Tim Hockin 22727fb813 Update RELEASING doc 2021-06-24 09:00:10 -07:00
Kubernetes Prow Robot 2671030f3f
Merge pull request #420 from thockin/master
Add Janet and Nan as approvers (master)
2021-06-24 05:35:41 -07:00
Kubernetes Prow Robot c70b5ac3a2
Merge pull request #421 from thockin/v4-port-413
Handle a race between ls-remote and fetch
2021-06-23 14:34:11 -07:00
Tim Hockin d1afc12e67 Handle a race between ls-remote and fetch
This is a port of PR #413.
2021-06-23 12:51:15 -07:00
Tim Hockin ab0fe416de Rename slow_git to slow_git_clone
Making room for slow_git_fetch upcoming.
2021-06-23 12:28:12 -07:00
Tim Hockin dcbebf05b3 Add Janet and Nan as approvers
They are using git-sync and have had a bunch of ideas for improvements.
I have had a hard time finding enough time to devote to this and they
offered to help.
2021-06-23 09:59:15 -07:00
Kubernetes Prow Robot a8b0acef1d
Merge pull request #418 from thockin/master
Clean up worktree dirs during sync loop
2021-06-22 18:02:10 -07:00
Tim Hockin 530ac2899b Clean up worktree dirs during sync loop
Avoid "already exists" error.  This is a port of #412 but I changed
the e2e to use `docker pause`.
2021-06-22 15:07:16 -07:00