Commit Graph

91 Commits

Author SHA1 Message Date
Tim Hockin 414839fc62 Make ssh e2e test not use --one-time
There is functionality that needs to be tested beyond that.
2022-06-11 10:52:45 -07:00
Tim Hockin 9f02915f02 Pass CLEANUP=0 to test_e2e to leave logs 2022-06-11 19:49:23 +02:00
Tim Hockin 812da0c43e Pass the whole environment to exechooks 2022-05-16 18:07:46 -07:00
Tim Hockin d1c8a4277c reorder test cases 2022-03-11 08:41:01 -08:00
Tim Hockin ce4f7a192d rename test case 2022-03-11 08:41:01 -08:00
Kubernetes Prow Robot dbbebf2e48
Merge pull request #499 from sed-i/feature/support_repo_change
Support repo change between invocations
2022-03-10 17:08:08 -08:00
sed-i c3791f59b2 Add volume mount for the repo sync test 2022-02-25 11:51:01 -05:00
sed-i 9780b620c0 Add repo-sync test 2022-02-25 03:46:37 -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 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 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
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 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
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
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
Natalie Baker 2c3bb035f6 Use hash for branch when adding a new worktree 2021-10-04 16:55:32 -04:00
ugurkenar df69fab365 cmd,hook and logging package 2021-08-16 12:40:27 +03:00
barney-s 6baccb4c5d Check for rev to be present after a fetch
When we fetch expecting a rev/hash to be present, defensively check and fail gracefully so that a subsequent sync would get it.  Check for missing hash after a git fetch with shallow depth
2021-06-23 14:56:39 -04:00
Kubernetes Prow Robot 9cd1e24966
Merge pull request #414 from barney-s/411
Cleanup worktree defensively
2021-06-22 14:36:10 -07:00
barney-s fe9c059828 Cleanup worktree defensively
This is to avoid wedge cases where the worktree was created but this function error'd without cleaning the worktree.
Next timearound, the sync loop fails to create the worktree and bails out.

We observed a case where due to #412, the next sync loop failed with this error:
" Run(git worktree add /repo/root/rev-nnnn origin/develop): exit status 128: { stdout: \"Preparing worktree (detached HEAD nnnn)\\n\", stderr: \"fatal: '/repo/root/rev-nnnn' already exists\\n\" }"
2021-06-22 16:40:58 -04:00
Tim Hockin 80a9d54ae0 unbreak e2e for github 2021-06-22 08:28:59 -07:00
Tim Hockin 3f0d678d19 Add a testcase for github HTTPS 2021-05-28 14:18:20 -07:00
Tim Hockin 4765eb5b14 Make sure all code files have headers 2021-05-27 08:45:36 -07:00
Tim Hockin fd481d0a16 move test cleanup to the end 2021-05-26 14:30:01 -07:00
Kubernetes Prow Robot a3affe9040
Merge pull request #372 from SpencerMalone/sparse-checkouts
Add support for sparse-checkout
2021-04-23 08:32:02 -07:00
Spencer Malone 07e552b506 Add support for sparse-checkout 2021-04-23 08:17:58 -07:00
Nan Yu 8ea449292b Export the error details to an error file
The current git-sync process outputs the error information to standard
out, which is inaccessible from outside the container. Users have to
dump the logs using kubectl logs in order to check the error details in
the git-sync process. This commit exports the error details to a file,
which provides users the capability to check the errors directly from
other sidecar containers.

proposal: https://github.com/kubernetes/git-sync/issues/326
2021-04-09 11:00:52 -07:00
Tim Hockin d508f04bbe Move sync-hook to after symlink flip 2021-04-05 17:04:44 -07:00
Tim Hockin 11c2a1fd7b Fix exit non-zero exit codes when running as pid1
Prior to this we would swallow the exit code and always exit(0).
2021-03-15 09:30:46 -07:00
Kubernetes Prow Robot de2a216922
Merge pull request #341 from thockin/add-git-configs-flag-3.x
Add --git-config flag
2021-03-15 07:45:05 -07:00
Tim Hockin 770314995f Change the symlink targets to just the SHA
This allows users to call readlink() on the link and learn the current
checked out SHA.
2021-03-11 22:07:07 -08:00
Tim Hockin 45bba183ca Add --git-config flag
This allows arbitrary git configs to be passed in.  For example:

`git config --global http.postBuffer 1048576000`

`git config --global http.sslCAInfo /path/to/cert/file`

`git config --global http.sslVerify false`

This flag takes a comma-separated list of `key:val` pairs.  The key part
is passed to `git config` and must be a valid gitconfig section header
and variable name.  The val part can be either a quoted or unquoted
value.  For all values the following escape sequences are supported:
   * `\n` => [newline]
   * `\t` => [tab]
   * `\"` => `"`
   * `\,` => `,`
   * `\\` => `\`

Within unquoted values, commas MUST be escaped. Within quoted values,
commas MAY be escaped, but are not required to be.  Any other escape
sequence is an error.

Example:

`--git-config=foo.one:val1,foo.two:"quoted val",foo.three:12345`

This commit exposed a bug in runCommand() which modified its args when
they had an embedded space.
2021-03-10 19:07:05 -08:00
Tim Hockin a524d5eacd Use docker to run helper servers in e2e
Reliably cleaning up leftover things like nc processes is surprisingly
difficult in pure shell. e2e passes on the 3.x branch now.
2021-01-23 15:56:08 -08:00
Tim Hockin a37a672b40 Fix e2e to always specify branch name
As git changes the default from "master" to "main", it's not
predictable.  Now the test owns the decision.
2021-01-07 09:44:34 -08:00
Tim Hockin 771011f0cc Move --v into e2e framework (always same) 2020-10-02 14:38:19 -07:00
unknowingknow 9661d3132e add e2e test for --sync-hook-command 2020-10-02 19:29:21 +09:00
Tim Hockin 1992a2bfab logtostderr defaults to true: don't set it in test 2020-09-28 16:31:33 -07:00
Tim Hockin 44e94a16b0 Fix webhook regression: allow -1 to ignore status 2020-09-25 11:17:56 -07:00
Tim Hockin a29fab5bfa Remove useless test case 2020-09-04 20:03:37 -07:00
alix.cook11 dcf169c10a
add option to NOT recursively clone submodules (#246)
* add option to NOT recursively clone submodules

* Add "shallow" and "off" modes to submodule clone

* update readme to reflect new flag

* wording and such feedback
2020-07-30 21:29:07 -07:00
Tim Hockin ef8f5cf703 Bump to debian-base 2.0.0 (buster)
This changed `git fetch` to require a `-f` the way we use it.

Also fix a flaky test case for SSH.
2020-01-31 09:20:54 -08:00