Commit Graph

943 Commits

Author SHA1 Message Date
Tim Hockin 97c0d585a8 Fix up CI for GH app tests
For now we skip
2024-09-25 12:38:45 -07:00
Nan Yu 8441240d9a Enable the GitHub app e2e test
The GitHub app e2e test requires a GitHub app to be created and
installed, and also requires a few environment variables to be set.

This commit updates the GitHub action workflow by providing the
environment variables which can be set via GitHub Secret. GitHub
Secrests cannot start with `GITHUB_`. Hence, this commit prepends
`TEST_` to the env variables.

It also updates how GitHub app private key file is set. It can be set by
either `TEST_GITHUB_APP_PRIVATE_KEY` or
`TEST_GITHUB_APP_PRIVATE_KEY_FILE`.
2024-09-25 11:51:39 -07:00
Liam Wyllie 0e2e0f0adc Add support for GitHub app authentication
Signed-off-by: Liam Wyllie <risset@mailbox.org>
2024-09-25 11:51:39 -07:00
Tim Hockin 69d239562d Fix SSH docs to use correct image 2024-09-16 09:58:03 -07:00
Kubernetes Prow Robot a5a965f08b
Merge pull request #914 from sdowell/git-lock-files
fix: recover when there is unreleased lock file
2024-08-12 11:09:47 -07:00
Sam Dowell ae22b20d07 fix: recover when there is unreleased lock file
If a previous git invocation crashes, it is possible that an orphaned
lock file (e.g. shallow.lock) is left on the filesystem. This previously
caused git-sync to crash loop because the lock file is never deleted.

This change adds a check in sanityCheckRepo for the existence of a git
lock file. If the git lock file exists at this stage, then initRepo will
re-initialize the repository.
2024-08-12 10:55:47 -07:00
Tim Hockin 9782ee2cfb Add docs on symlink 2024-08-12 10:27:24 -07:00
Kubernetes Prow Robot f73ee0008d
Merge pull request #910 from sdowell/e2e-image-build
test: harden e2e image build logic
2024-07-16 16:37:05 -07:00
Sam Dowell f6f7401e6b test: harden e2e image build logic
This introduces several changes to make the e2e test image logic more
robust:

- Rename IMAGE to GIT_SYNC_E2E_IMAGE to minimize accidental misuse
- Ensure that the image built by make container is the same as the image
  used by docker run
- Do not build the container if a custom image is specified

As an example, with the prior logic the following command always fails:
IMAGE="" make test
...
Unable to find image 'gcr.io/k8s-staging-git-sync/git-sync:latest' locally

Because the docker run command pulls a different image from the one
built by make container.
2024-07-16 16:07:29 -07:00
Tim Hockin 6af1e6921d Add lint for shellcheck, fix issues 2024-07-04 15:25:25 -07:00
Kubernetes Prow Robot 458a7e5c97
Merge pull request #905 from rul/sc_testgit
test_git.sh: shellcheck entire file
2024-06-28 12:02:39 -07:00
Raúl Benencia d12d9f2a01 test_git.sh: declare restore_opts and assign separately
This avoids masking return values. Fixes SC2155. Part of #891.
2024-06-28 11:29:31 -07:00
Raúl Benencia 0e81260572 test_git.sh: use mapfile to split command output
Fixes SC2207. Part of #891.
2024-06-28 11:28:32 -07:00
Raúl Benencia 4f0dc5679b test_git.sh: add quotes to to prevent globbing and word splitting
Fixes SC2086. Part of #891.
2024-06-28 11:28:25 -07:00
Raúl Benencia 6716848f4b test_git.sh: add '-r' to 'read' to avoid mangling backslashes
Fixes SC2162. Part of #891.
2024-06-28 11:24:30 -07:00
Raúl Benencia ae368ba2f1 test_git.sh: use parameter expansion instead of sed
Fixes SC2001. Part of #891.
2024-06-28 11:21:22 -07:00
Raúl Benencia 2ee13eb2bc test_git.sh: quote literal {}
Fixes SC1083. Part of #891.
2024-06-28 10:56:31 -07:00
Raúl Benencia 99d693d647 test_git.sh: replace test regex for glob match
Don't quote rhs of =~, it'll match literally rather than as a
regex. Fixes SC2076. Part of #891.
2024-06-28 07:09:09 -07:00
Kubernetes Prow Robot de02f72cd7
Merge pull request #904 from VICIWUOHA/dev-viciwuoha-fix
Fix Slight Typos In Docs
2024-06-24 16:56:32 -07:00
Raúl Benencia c8089abf31 test_e2e.sh: disable SC2120 for 'caller' function 2024-06-24 16:45:51 -07:00
Raúl Benencia c97fb8ac36 test_e2e.sh: revert explicitly passing parameters to 'caller'
This reverts commit d67c7c6c93.
2024-06-24 16:45:51 -07:00
Raúl Benencia 27a325e9f3 test_e2e.sh: quote $expected_depth 2024-06-24 16:45:51 -07:00
Raúl Benencia 81a4409a04 test_e2e.sh: declare restore_opts and assign separately
This avoids masking return values. Fixes SC2155. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 3200ee55f6 test_e2e.sh: replace test regex for glob match
Don't quote rhs of =~, it'll match literally rather than as a
regex. Fixes SC2076. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 9b980c479b test_e2e.sh: use mapfile to split command output
Fixes SC2207. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 81bb72f296 test_e2e.sh: add exceptions for SC2016
Fixes SC2016. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 89d568d7d2 test_e2e.sh: Quote literal { }
Fixes SC1083. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 1346a81e4d test_e2e.sh: Quote the rhs of != in [[ ]] to prevent glob matching
Fixes SC2053. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 49310e18b6 test_e2e.sh: add '-r' to 'read' to avoid mangling backslashes
Fixes SC2162. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia f41adab119 test_e2e.sh: remove useless cats
Fixes SC2002. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia bfe0a0bc17 test_e2e.sh: add quotes to to prevent word splitting
Fixes SC2046. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia e7a8600806 test_e2e.sh: remove unnecessary $ on arithmetic variables
Fixes SC2004. Part of #891.
2024-06-24 16:45:51 -07:00
Raúl Benencia 791aecfc17 test_e2e.sh: explicitly pass parameters to 'caller' function
Fixes SC2120. Part of #891.
2024-06-24 16:45:51 -07:00
VICIWUOHA 28cf42fdaa fix slight typo in v3-to-v4 docs 2024-06-24 23:12:15 +01:00
VICIWUOHA af8126a4a0 fix slight typo in README 2024-06-24 23:11:48 +01:00
Tim Hockin da2d7ca2f2 Shellcheck stage_binaries.sh 2024-06-21 19:52:27 -07:00
Kubernetes Prow Robot eab3f83458
Merge pull request #901 from rul/fix-sc2128
test_e2e.sh: Use index to expand FUNCNAME
2024-06-21 19:20:55 -07:00
Raúl Benencia c8eabb1213 test_e2e.sh: Use index to expand FUNCNAME
Fixes SC2128. Part of #891.
2024-06-21 17:51:23 -07:00
Kubernetes Prow Robot 9d32cb1fed
Merge pull request #900 from sdowell/debian-build-image
use debian build image and bash build scripts
2024-06-21 11:42:55 -07:00
Sam Dowell aece8508b1 ci: switch BUILD_IMAGE from alpine->debian
This is more consistent with the BASEIMAGE OS, and also ships with bash.
2024-06-21 11:24:27 -07:00
Sam Dowell 742b941a6d Reapply "consistently use bash shebang for shell scripts"
This reverts commit 9fac204a9c.
2024-06-21 11:24:27 -07:00
Sam Dowell fe77b4e0c6 Revert "Fix build scripts to be strict sh"
This reverts commit 8ed7195384.
2024-06-21 11:24:27 -07:00
Tim Hockin 1b5c314d00 Fix default-value bug in build.sh 2024-06-21 10:36:33 -07:00
Kubernetes Prow Robot 54491b2011
Merge pull request #896 from thockin/master
Revert 894, fix build scripts to be strict sh
2024-06-21 09:30:55 -07:00
Tim Hockin 8ed7195384
Fix build scripts to be strict sh 2024-06-21 08:59:01 -07:00
Tim Hockin 9fac204a9c
Revert "consistently use bash shebang for shell scripts"
This reverts commit 2c0d32b603.
2024-06-21 08:46:00 -07:00
Kubernetes Prow Robot 650be63833
Merge pull request #894 from sdowell/bash-shebang
consistently use bash shebang for shell scripts
2024-06-20 13:58:40 -07:00
Sam Dowell 2c0d32b603 consistently use bash shebang for shell scripts
This updates the build scripts to use a bash shebang for consistency
with other scripts as well as better portability. If using a non-alpine
BUILDIMAGE (e.g. debian) the build scripts are not valid sh syntax.
2024-06-20 13:23:15 -07:00
Tim Hockin efd8ecf490 Remove e2e debug code 2024-06-19 12:30:13 -07:00
Kubernetes Prow Robot faba6051f4
Merge pull request #892 from rul/fix-e2e-sc2086
test_e2e.sh: quote variables to prevent globbing and word splitting
2024-06-19 11:54:42 -07:00