Commit Graph

455 Commits

Author SHA1 Message Date
Kubernetes Prow Robot a8b0acef1d
Merge pull request #418 from thockin/master
Clean up worktree dirs during sync loop
2021-06-22 18:02:10 -07:00
Tim Hockin 530ac2899b Clean up worktree dirs during sync loop
Avoid "already exists" error.  This is a port of #412 but I changed
the e2e to use `docker pause`.
2021-06-22 15:07:16 -07:00
Tim Hockin 9b1bfc7a97 Make e2e pass on v4 2021-06-22 15:04:00 -07:00
Tim Hockin 16c89cec6f Don't use global variables (flags)
'
2021-06-22 15:04:00 -07:00
Tim Hockin 476fba3d3e Use plflag, not flag
Make it harder to accidentally mess this up again.
2021-06-22 15:04:00 -07:00
Tim Hockin c6878026a1 unbreak e2e for github 2021-06-22 08:29:30 -07:00
Kubernetes Prow Robot bce1306613
Merge pull request #406 from thockin/master
bump to logr v1.0.0-rc1 (v4)
2021-06-16 14:08:00 -07:00
Kubernetes Prow Robot bf2b854690
Merge pull request #407 from briantkennedy/response
Improve error message for askpass.
2021-06-15 14:11:43 -07:00
Brian Kennedy a87c78665d Improve error message for askpass.
When endpoint returns non-200 status, include the body in the error
message since it can contain useful information for debugging.  Also
defer closing the response body ReadCloser as this may have leaked in
the past.
2021-06-15 13:26:32 -07:00
Tim Hockin 841b4894c7 bump to logr v1.0.0-rc1 (v4) 2021-06-13 11:02:03 -07:00
Tim Hockin 903d86dd66 Update README to spec UID/GID 2021-06-04 16:00:26 -07:00
Tim Hockin ffe2ac4d2f Change libcurl workaround to be less precise 2021-05-29 09:17:06 -07:00
Kubernetes Prow Robot 5918570aac
Merge pull request #399 from thockin/master
Downgrade libcurl to work around HTTP bug (v4)
2021-05-29 06:20:25 -07:00
Tim Hockin 421fc4e298 Add a testcase for github HTTPS 2021-05-28 14:18:58 -07:00
Tim Hockin 5ecd341782 Downgrade libcurl to avoid HTTP bug 2021-05-27 10:18:34 -07:00
Tim Hockin 79de193be5 Dockerfile: apt install with --no-install-recommends 2021-05-27 10:02:02 -07:00
Tim Hockin 8b4f7d5be5 Dockerfile: use apt-get (more stable) 2021-05-27 09:59:58 -07:00
Tim Hockin 394a460405 Makefile: plain output when building container 2021-05-27 09:57:58 -07:00
Tim Hockin 48bc7fbbf9 Dockerfile: use multi-stage for cleaner result 2021-05-27 09:56:29 -07:00
Tim Hockin 0222a95f29 Make sure all code files have headers 2021-05-27 08:46:00 -07:00
Tim Hockin f96cdbca17 Small error string cleanup 2021-05-26 17:04:06 -07:00
Kubernetes Prow Robot 581139e56c
Merge pull request #390 from nan-yu/master
Grant read access for the error file to all users
2021-05-26 14:49:38 -07:00
Nan Yu c05d17c50c Grant read access for the error file to all users 2021-05-26 14:35:29 -07:00
Tim Hockin 16c3bf7dd1 move test cleanup to the end 2021-05-26 14:31:16 -07:00
Kubernetes Prow Robot 5e9516d2b4
Merge pull request #386 from thockin/master
Clean up global flRoot use (v4)
2021-05-21 17:15:37 -07:00
Tim Hockin 295cfd442d Clean up global flRoot use 2021-05-21 17:08:49 -07:00
Kubernetes Prow Robot 53e0c0d9fd
Merge pull request #385 from nan-yu/master
Create the root directory if it doesn't exist
2021-05-21 16:59:37 -07:00
Nan Yu 583ae46ec6 Create the root directory if it doesn't exist
The `git clone` command will create the root directory if it doesn't
exist, but if `git clone` fails, the root directory needs to be present
so that we can write the error to a file under the directory.
2021-05-21 16:51:21 -07:00
Kubernetes Prow Robot 1c2a18b0cb
Merge pull request #381 from thockin/master
Add support for sparse-checkout (v4 vbranch)
2021-04-26 07:39:02 -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
Tim Hockin a0379cbcd4 Bump go to 1.16 2021-04-23 09:00:59 -07:00
Tim Hockin a8a7ffb5a2 Sort the flags in the manual output 2021-04-21 21:48:55 -07:00
Kubernetes Prow Robot 79498367fc
Merge pull request #375 from nan-yu/master
Export the error details to an error file
2021-04-21 21:42:34 -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 6ac6e4eefd Fix licenses for other arch'es 2021-04-16 08:22:18 -07:00
Tim Hockin bb6f4441fd Update to latest base image debian-base:buster-v1.6.0 (v4) 2021-04-15 08:44:15 -07:00
Nan Yu f2581cff93 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:33:16 -07:00
Kubernetes Prow Robot 13af14e3bf
Merge pull request #370 from thockin/exec-hook-after-symlink-v4
Move sync-hook to after symlink flip
2021-04-07 16:47:42 -07:00
Kubernetes Prow Robot e0fe34164d
Merge pull request #366 from thockin/licenses-v4
Copy all licenses into the container image (v4)
2021-04-07 05:17:53 -07:00
Tim Hockin d6c1fd3c6b Move sync-hook to after symlink flip 2021-04-05 17:02:00 -07:00
Tim Hockin 592cbcb9d0 update go.mod to 1.16 2021-03-29 21:16:23 -07:00
Tim Hockin ed5e78472e Copy all licenses into the container image 2021-03-29 16:54:35 -07:00
Tim Hockin f77e3a54fc Add infrastructure for build tools
As per discussion with Go team.  it's hacky but it works.

create tools.go
git add tools.go
go mod vendor
git add vendor
go mod tidy
go mod vendor # again
2021-03-29 16:51:08 -07:00
Tim Hockin dcb918f846 WIP: startup tests 2021-03-29 16:48:50 -07:00
Kubernetes Prow Robot d89ac710a2
Merge pull request #362 from thockin/build-no-tty-v4
Don't require a TTY to build/test
2021-03-18 05:29:19 -07:00
Tim Hockin ac6f5036a2 Don't require a TTY to build/test 2021-03-17 22:02:32 -07:00
Kubernetes Prow Robot 7b594781f8
Merge pull request #344 from thockin/fix-pid1-exit-code-v4
Fix exit non-zero exit codes when running as pid1
2021-03-15 09:39:06 -07:00
Tim Hockin 45b28530a7 Fix exit non-zero exit codes when running as pid1
(v4 branch)

Prior to this we would swallow the exit code and always exit(0).
2021-03-15 09:28:26 -07:00
Kubernetes Prow Robot 03c87de032
Merge pull request #342 from thockin/add-git-configs-flag-4.x
Add --git-config flag
2021-03-15 09:27:06 -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