Commit Graph

436 Commits

Author SHA1 Message Date
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
Kubernetes Prow Robot 6f5c1a9a22
Merge pull request #353 from thockin/fix-v4-tests
Fix tests on master - reset needs "--" arg
2021-03-15 09:17:05 -07:00
Tim Hockin cc094858b3 Fix tests on master - reset needs "--" arg
Now that the worktree dirs are the same name as the hash, `git reset`
doesn't know if we are asking for reset-to-hash or reset-the-dir.
Adding "--" makes that unambiguous.

Tests pass now.
2021-03-15 08:59:34 -07:00
Kubernetes Prow Robot d02bcce8e5
Merge pull request #351 from thockin/readlink-is-api-v4
Change the symlink targets to just the SHA (v4)
2021-03-12 02:58:17 -08:00
Kubernetes Prow Robot aab6380c0d
Merge pull request #349 from thockin/build-no-cache-v4
Build container without cache
2021-03-12 02:56:17 -08:00
Kubernetes Prow Robot a8660c02bf
Merge pull request #347 from thockin/update-git-v4
Update git from backports
2021-03-12 02:54:17 -08:00
Tim Hockin e5a438e446 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:11:35 -08:00
Tim Hockin 813337fe2d Update git from backports
Some bugs have been fixed that impact some users.
2021-03-11 22:11:35 -08:00
Tim Hockin a082bf83cf Build container without cache 2021-03-11 19:25:01 -08:00
Tim Hockin 858cc8d735 Update git from backports
Some bugs have been fixed that impact some users.
2021-03-11 19:23:13 -08:00
Kubernetes Prow Robot 45852714fc
Merge pull request #336 from justaugustus/image
Makefile: Update base and build images
2021-02-12 11:01:59 -08:00
Stephen Augustus 35507943ce Makefile: Update base and build images
- base: debian-base:v2.0.0 --> debian-base:buster-v1.4.0
- build: golang:1.14-alpine --> golang:1.15-alpine

Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-02-12 12:15:59 -05:00
Kubernetes Prow Robot 14b9f07f58
Merge pull request #332 from thockin/v4-e2e-use-docker-nc
Use docker to run helper servers in e2e
2021-02-03 03:02:29 -08:00
Tim Hockin ccde597b7d Always specify branch name in e2e
As git changes the default from "master" to "main", it's not
predictable.  Now the test owns the decision.

This was already merged on release-3.x.
2021-01-23 16:13:26 -08:00
Tim Hockin a285a770e2 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 master branch now.
2021-01-23 15:59:24 -08:00
Kubernetes Prow Robot 75bfc00fb6
Merge pull request #330 from thockin/v4-container-mkdir
Default the git-sync root dir in container
2021-01-22 04:35:27 -08:00
Tim Hockin b6a1c61e83 Default the git-sync root dir in container
This should make the container image easier to use, without defaulting
the root dir in non-container usage.
2021-01-21 12:37:07 -08:00
Tim Hockin 02d291c495 Set HOME in Dockerfile
Clean up other comments, too.
2021-01-21 12:37:07 -08:00
Kubernetes Prow Robot e52396c9fd
Merge pull request #328 from thockin/pod-yaml-doc
Add an example pod YAML
2021-01-21 01:55:03 -08:00
Tim Hockin 08fbf383f8 Add an example pod YAML 2021-01-20 16:28:57 -08:00