Commit Graph

975 Commits

Author SHA1 Message Date
Tim Hockin b752a5eedc Fix tests to set missing arg 2022-02-06 16:29:57 -08:00
Kubernetes Prow Robot 2a7f7f543b
Merge pull request #486 from thockin/master
small manual text fix (v4 branch)
2022-02-01 11:45:49 -08:00
Tim Hockin ec169cb7d3 small manual text fix 2022-02-01 11:07:11 -08:00
Kubernetes Prow Robot 238fbb88b6
Merge pull request #484 from thockin/master
Bump go to 1.17
2022-01-31 01:30:25 -08:00
Tim Hockin 6653b2c791 Bump go.mod to 1.17
run `go mod tidy` and `go mod vendor`
2022-01-28 20:12:08 -08:00
Tim Hockin 944bf01f81 Bump go to 1.17 2022-01-28 20:11:04 -08:00
Tim Hockin f24435fa47 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:14:24 -08:00
Kubernetes Prow Robot d3324e0b90
Merge pull request #478 from thockin/v4-link-abspath
Allow --dest to be an absolute path (v4)
2022-01-23 02:41:56 -08:00
Kubernetes Prow Robot 10fd8e662b
Merge pull request #476 from thockin/v4-double-register-hook-metric
Don't double-register the hook metric (v4)
2022-01-23 01:17:56 -08:00
Kubernetes Prow Robot 6dc0e44697
Merge pull request #472 from thockin/master
Don't try to remove the root if it appears corrupt (v4)
2022-01-23 01:15:56 -08:00
Tim Hockin 4fc67f5f5f Allow --dest to be an absolute path
This means it might live outside of --root.
2022-01-22 23:39:56 -08:00
Tim Hockin 248a53461d 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 14:28:09 -08:00
Tim Hockin 2a611a72c0 Don't double-register the hook metric 2022-01-22 14:24:47 -08:00
Kubernetes Prow Robot 5aac288e7d
Merge pull request #468 from thockin/master
Followup to #466 - small cleanups for one-time hooks
2022-01-20 04:15:51 -08:00
Tim Hockin c143bfd31a Small cleanup on one-time x hooks 2022-01-19 11:48:50 -08:00
Tim Hockin 9eed6946b7 e2e cleanup
Fix some whitespace and names.
Make command-line and flag handling a bit cleaner.
2022-01-19 11:38:23 -08:00
Kubernetes Prow Robot d8bd262b87
Merge pull request #466 from ChrisERo/master
fix: resolve issue #463
2022-01-19 11:24:05 -08:00
ChrisERo ad6a34abb5 refactor: corrected variable names and logs inside HookRunner.WaitForCompletion 2022-01-15 15:23:06 -05:00
ChrisERo 394b2c7149 fix: perform hook null check before waiting
Last 2 commits introduced fatal null-pointer exception when waiting on
HookRunner object when not set, e.g. waiting for WebhookRunner when no
webhook is defined. Fixed bug and got test_e2e.sh to run successfully.
2022-01-15 15:19:31 -05:00
ChrisERo 5490b721d8 fix: made tests more efficient by waiting less 2022-01-14 13:53:09 -05:00
ChrisERo 8827bf7489 refactor: imporved efficiency and code style
* changed sendCompletedOnceMessageIfApplicable so that it kills thread
  after executing
* moved logic for waiting on HookRunner into function defined in
  HookRunner itself
2022-01-14 13:41:59 -05:00
ChrisERo 043c356c03 fix: fixed e2e tests
Resolved a few issues with e2e tests discovered after running
test_e2d.sh. Just finished setting up Linux (Fedora) environment in
which this script can be run.
2022-01-14 03:23:20 -05:00
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