Commit Graph

39 Commits

Author SHA1 Message Date
Tim Hockin 7b32caee77 v4: use repo default branch instead of master 2021-11-01 23:05:48 -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
XinYang 78a1cffbd3
remove broken analytics links
Signed-off-by: XinYang <xinydev@gmail.com>
2021-07-03 23:51:53 +08:00
Tim Hockin 903d86dd66 Update README to spec UID/GID 2021-06-04 16:00:26 -07:00
Tim Hockin a3d9b673a8 Port #372 to v4 dev branch (from SpencerMalone)
Wanted to finally tackle #54, I sidestepped the problem of how to handle the volume of flags that might be required by instead specifying a sparsecheckout file.

The workflow as I've had has been...
- Do a local sparse checkout, add the files you want ignored (or included on if you did a cone pattern https://git-scm.com/docs/git-sparse-checkout#_cone_pattern_set)
- Grab your .git/info/sparecheckout file, and reserve it for later use with this new flag

It's not quite as easy as specifying it all from a CLI, but I think it's a reasonable first pass.

Here are some logs of it being run on https://github.com/SpencerMalone/logstash-output-prometheus:

```
test-repo % cat sparseconfig
!/*
!/*/
README.md
test-repo % docker run --rm -d \
    -v $(pwd)/git-data:/tmp/git \
    -v $(pwd):/test \
    docker.io/registry/git-sync:tag__linux_amd64  \
        --repo=https://github.com/SpencerMalone/logstash-output-prometheus.git \
        --branch=master \
        --sparse-checkout-file=/test/sparseconfig
41494548dd64caf0ff8f7b75e4d3a86014cfaefc40ff31b14ba19accf99aa82f
test-repo % ls git-data/db86200b1ab158ce9ad403d06de2301b15333601
README.md
```

As you can see, I ignored everything but the `README.md`, and sure enough only got that file in my final checkout.
2021-04-23 09:01:05 -07:00
Nan Yu 53f3fa17a0 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-21 16:42:28 -07:00
Tim Hockin 83b4dd21de 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-15 09:20:02 -07:00
Haiyan Meng 0010dafe6d Add the `--root` flag into the Usage section 2020-11-17 18:44:35 -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
Tim Hockin af2ae5b533 Make the --root flag required, no default
BREAKING CHANGE

The default of $HOME has caused problems for people playing with
git-sync, so this change makes it a required argument.
2020-11-09 08:30:29 -08:00
Tim Hockin fa0e8696e2 Change time-related flags to durations
Add '--period' to replace '--wait', which is now obsolete.

Add '--sync-timeout' to replace '--timeout', which is now obsolete.

Both of these new flags take a Go-style time string, rather than a bare
number. For example "1s" for 1 second or "1m" for one minute.

The old flags have been kept and will take precedence if specified.
2020-11-05 16:46:09 -08:00
Tim Hockin 20696689f3 Add help and manual flags, use pflag
THIS IS A BREAKING CHANGE

Switch flags implementation to use pflag.  This means that long flags
like `-username` must now use 2 dashes: `--username`.

The `-v` flag (verbose) used to accept `-v` or `--v`.  Now it only
accepts `-v.

The `--help` and `-h` flags are new.

The `--man` flag is new (print a man-page like help message).

Several glog flags which used to be exposed (e.g. --logtostderr) are no
longer exposed.  Logs always go to stderr.
2020-10-31 00:50:51 -07:00
Xiang Dai 7df021c9ff README: add buildx comment
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
2020-10-28 16:44:00 +08:00
Kubernetes Prow Robot c72a880352
Merge pull request #294 from andres-lowrie/master
docs: add PAT option for `--password`
2020-10-11 10:48:47 -07:00
Andres Lowrie 3c79569bd7
docs: add PAT option for `--password`
This could help users that are not aware that github personal access tokens can be used as passwords. It's verbose could be helpful
2020-10-06 11:23:18 -05:00
Michael Grosser decb118c58 Fix line breaks in README 2020-10-06 15:04:38 +00:00
unknowingknow 26cd942b2a change to a command name with no args 2020-10-02 19:29:03 +09:00
unknowingknow e1c4717de6 add an option to run the command when the repository is updated 2020-10-02 19:28:25 +09:00
Kubernetes Prow Robot 66320a6b92
Merge pull request #243 from killuazhu/kyle-relax-wait
Relax wait between sync
2020-09-25 10:30:26 -07:00
Tim Hockin 89aad82a31 Minor tweaks to submodules strings & consts
Rename consts internally and shorten help string a bit.
2020-09-04 20:06:44 -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
Kyle Zhu 1546e3415f
Reduce wait time 2020-04-24 17:32:32 -04:00
Kyle Zhu c1d4d77216
Relax wait between sync 2020-04-24 15:21:09 -04:00
Jim Angel 55b3e5e6ef added table for env vars 2020-02-10 16:09:47 -06:00
Tim Hockin 0057fac0a4 Clean up docs 2019-11-26 14:12:47 -08:00
Tim Hockin 59c5910890
Merge branch 'master' into master 2019-01-23 08:04:22 -08:00
Thomas Jackson 87503c6dce Clarify webhook behavior in docs/README 2019-01-22 14:12:49 -08:00
Thomas Jackson 9bfa91b0af Update README to new flags 2019-01-22 14:12:49 -08:00
Thomas Jackson 5c63dc9cb5 Update README based on comments in #110 2019-01-22 14:12:49 -08:00
Zac e437d8e9a3 adding changes from previous PR, updated README 2019-01-22 14:12:49 -08:00
chris060986 ea7c288dc3 Add proxy support to build 2018-12-20 14:41:06 +01:00
Joshua Carp 1415acdf0e Update example volume mount
Since the default clone path is $HOME/git and the docker image sets $HOME to /tmp, we have to mount the volume at `/tmp/git` for the container to write files to the volume. As written, the example doesn't write to the volume.
2018-12-17 10:57:06 -08:00
mattjmcnaughton 71ea5e8473 Fix README
The README instructs the user to overwrite the TAG variable to set the
tag on `make container`. However, the user should actually overwrite the
`VERSION` variable.
2018-06-01 08:11:24 -07:00
Michael Grosser 237fc1c63e Fix typo 2017-02-06 20:30:35 +00:00
Tim Hockin be407edce3 update README 2016-09-16 08:35:27 -07:00
Tim Hockin 0a403496bf Fix README to actually run 2016-09-16 08:35:26 -07:00
Tim Hockin 2a7645cb0f Scrub 'contrib' 2016-08-20 14:17:17 -07:00
Tim Hockin ad53194601 Add files from github.com/kubernetes/contrib/git-sync 2016-08-20 14:14:27 -07:00