Commit Graph

36 Commits

Author SHA1 Message Date
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
Juraj Michálek 0afb5a27af
chore: fix missing unit duration in the k8s example 2024-02-08 15:19:11 +01:00
Tim Hockin 4ccf0633fb Deprecate --ssh - it's not really needed
As long as a repo uses SSH transport (user@host:path or ssh://...), SSH
is active.  This is true for the main repo or submodules.
2023-09-27 13:32:15 -07:00
Tim Hockin 8ee0f7ef9a Update README and other docs 2023-05-16 16:10:50 -07:00
Tim Hockin 7e6b429362 Make all env var names GITSYNC_FOO
Still support GIT_SYNC_FOO for compat.
2023-05-04 08:45:25 -07:00
Tim Hockin ee6664748f Total overhaul of sync loop
The previous (v3) sync loop betrays my lack of understanding about git.
It tried to codify my archaic mental model (e.g. --branch and --rev
being disting things) and was ultimately a patchwork of corner-cases
evolved over a few years.

This commit is less of a "diff" and more of a "rewrite".

The new logic is simpler and more efficient.  It does not `git clone`
ever.  It does not differentiate the first sync from subsequent syncs.
It uses `git fetch` to get the exact SHA and then makes a worktree from
that.

The new `--ref` flag replaces both `--rev` and `--branch`, though it
will use those if specified.  In fact, almost all of the e2e tests
passed without change - using --ref and --branch!

I will follow this commit up with more cleanups and e2es.
2023-04-21 17:25:25 -07:00
James Blair 104563fc47
Replace deprecated k8s registry references.
Problem: Previously all of Kubernetes' image hosting has been out of gcr.io. There were significant egress costs associated with this when images were pulled from entities outside gcp.  Refer to https://github.com/kubernetes/k8s.io/wiki/New-Registry-url-for-Kubernetes-(registry.k8s.io)

Solution: As highlighted at KubeCon NA 2022 k8s infra SIG update, the replacement for k8s.gcr.io which is registry.k8s.io is now ready for mainstream use and the old k8s.gcr.io has been formally deprecated and projects are requested to migrate off it. This commit migrates remaining references for kubernetes/git-sync to registry.k8s.io.
Signed-off-by: James Blair <mail@jamesblair.net>
2023-02-14 16:26:30 +13:00
Tim Hockin 8c6dfeab89 Allow flags to have multiple env var names
Anything but the 0th name is considered deprecated.
2022-08-20 17:33:56 -07:00
Tim Hockin 08fbf383f8 Add an example pod YAML 2021-01-20 16:28:57 -08:00
Tim Hockin a2fa689296 Fix SSH docs to use 2 dashes 2020-11-09 08:36:14 -08:00
Tim Hockin 0e802450ee Don't allow --dest to start with a dot
BREAKING CHANGE

It's useful to reserve names that start with a dot.
2020-11-09 08:36:10 -08:00
David Karlsen 3b52b63327
add documentation
Signed-off-by: David Karlsen <david@davidkarlsen.com>
2020-09-08 12:25:11 +02:00
Marco Micera 4857717d30
Fixed Docker image tag in SSH documentation page 2020-02-03 00:24:31 +01:00
Tim Hockin 083c189924 Fix SSH docs permissions 2020-01-07 08:25:36 -08:00
Tim Hockin 5154ace66d Add --add-user to write UID/GID to passwd 2020-01-03 16:16:15 -08:00
Chuanying Du d8d9ff72b8 add e2e test for askpasswd_url 2019-12-18 21:07:01 -08:00
Chuanying Du c57553a2eb fix docs 2019-12-18 10:52:02 -08:00
Chuanying Du 34daaefbb8 update some docs to retrigger the scan 2019-12-17 11:24:03 -08:00
Chuanying Du 1f67515afa fix docs link 2019-12-17 11:16:06 -08:00
Chuanying Du 6c6c354c72 update docs from auth-url to askpass-url 2019-12-17 11:02:03 -08:00
Chuanying Du 67a0788aa2 Rename to GIT_ASKPASS_URL and also update related examples. 2019-12-17 10:48:20 -08:00
Chuanying Du 9cae624f8c Add a new authentiate method GIT_SYNC_AUTH_URL.
It specifies a HTTP URL which will return username&password which will
be used to authenticate access to the git repo.

This is mainly used for git repo accecpt dynamic password (for example
oauth bare token). Because the dynamic password might expire very soon,
so it's added to the main syncRepo loop.

Typical usage case is work with a sidecar called gce-node-auth on GKE,
it uses the GCE service account's oauth token as password to access
Cloud Source Repo.

Please see the repo below for how it worked.
https://github.com/cydu-cloud/gce-node-auth/blob/master/git-sync-with-gce-node-auth.yaml
2019-12-16 23:45:37 -08:00
Philippe Dupont 0c3b730403 Fix Typo 2019-02-21 15:46:51 +01:00
Tim Hockin 51f19b81c9 Fix SSH
* Create a git-sync user to run as, with an entry in /etc/passwd and
writable homedir

* Remove our own validation of key perms - let SSH do that.

* Update docs,
2019-02-07 16:32:01 -08:00
Eugene Chung 4b8d266d1f
~ -> $HOME
On Mac, ~ is not translated to the home directory. I guess $HOME is more portable.
2019-01-31 17:15:38 +09:00
Tim Hockin 644151a1d3 Fix hugo demo and docs
The hugo demo runs again.

Also removed docs on need to run as root.  Pretty sure you do not need
to.
2018-12-17 11:44:50 -08:00
Tim Hockin 9ceb61f794 Clean up doc on GIT_COOKIE_FILE 2018-07-02 14:37:25 -07:00
Bryce Cronkite-Ratcliff f69e8fb2c0 Add gitcookie configuration option
Add an option to specify a git http cookie file in the k8s yaml
that will be configured as the global git cookie file in the git-sync
client.

This is a useful access mechanism for some some hosted repositories
where SSH and passwords are not easily available, such as Google Cloud
Source Repositories.
2018-06-01 14:45:06 -07:00
Hanlin Wang d22b14bec9
Update ssh.md 2018-03-10 15:31:55 +08:00
Pieter Lange 899cf5974e Add feature flag to enable ssh host key verification. 2017-04-25 00:34:01 +02:00
Pieter Lange 3b8bf0308c Use secure defaults (check hostkeys) 2017-04-21 15:09:37 +02:00
Steve Jernigan 20f4c73cb7 Update ssh.md
Adding requirement for runAsRoot and suggested configuration for defaultMode.  These are required after previous change to remove the chmod on the key.
2017-02-17 11:08:25 -05:00
Aman ea98806bc9
Remove chmod command since we can specify permissions for Secret Volumes
- Fixed because of https://github.com/kubernetes/kubernetes/pull/28936
2016-12-19 21:55:34 +05:30
Tim Hockin ad53194601 Add files from github.com/kubernetes/contrib/git-sync 2016-08-20 14:14:27 -07:00