Commit Graph

21 Commits

Author SHA1 Message Date
Tim Hockin 1894192b0f Run hooks at startup
This ensures we do not miss events.  E.g.

before:
    t0: hash changes to X
    t1: send webhook(X), waiting for response
    t2: hash changes to Y
    t3: queue next webhook(Y) but can't send because previous is not done
    t4: crash
    t5: restart
    t6: find repo at hash Y

    no webhook(Y) was sent.

after:
    t0: hash changes to X
    t1: send webhook(X), waiting for response
    t2: hash changes to Y
    t3: queue next webhook(Y) but can't send because previous is not done
    t4: crash
    t5: restart
    t6: find repo at hash Y
    t7: send webhook(Y), waiting for response
2023-05-29 14:50:24 -07:00
Tim Hockin a4afa2f438 Improve logging levels a bit 2023-05-26 09:04:55 -07:00
Tim Hockin 7797e5d0e3 Log actual flags rather than args+env 2023-05-24 10:52:39 -07:00
Tim Hockin 9318041657 Better logging around hooks
This also returns stderr distinct from stdout.
2023-05-24 10:52:21 -07:00
Tim Hockin ed170912c9 Move main.go to root of repo
This allows `go install k8s.io/git-sync` which I like.
2023-05-22 08:40:24 -07:00
Tim Hockin 70feeb5ae1 Use the go-build-template
Faster builds and versions from tags.  Also use alpine as a base image.  We
need alpine for other architectures...

Also change the --wait flag to take a float for sub-second waits.
2016-10-30 17:09:06 -07:00
Tim Hockin 94ff3e8fae Fix non-master branches and tags
This plus the test should ensure no regressions.  Git makes it tricky to do
some things on a remote that you would think to do on a local repo.
`ls-remote` gives me the info I need with only one test for "HEAD" vs anything
else.
2016-10-28 17:02:25 +02:00
Tim Hockin 0adea90c44 Fix when a tag/rev moves
I know this used to work.  I must have broken it at some point. Manually
verified for HEAD and a real tag.

Also fix some logging so it is less chatty by default.

v2.0.2
2016-10-12 21:56:34 -07:00
Tim Hockin 4523b3a28d Better flag help, error on bad --dest, v2.0.1 2016-10-07 17:20:41 -07:00
Tim Hockin dd09cac833 Default dest to leaf of repo 2016-09-16 08:35:27 -07:00
Tim Hockin dd60fb0312 Clean up logging using glogr 2016-09-16 08:35:27 -07:00
Tim Hockin ff73d8e4f0 Overhaul git logic to sync only when needed
I wanted to understand it all so I ran a bunch of tests and found that it was
resyncing when not required any time the rev was not == HEAD.  Some
stackoverflow and git manpage spelunking produced this.  Nice side-effect is
tha the workdir is named after the githash instead of random.
2016-09-16 08:35:26 -07:00
Tim Hockin 7fcc902aa7 Print the git hash for any rev 2016-09-16 08:35:26 -07:00
Tim Hockin 75998b9237 clean up logging of git runs 2016-09-16 08:35:26 -07:00
Tim Hockin cd1f719e8b Overhaul runCommand()
Better args, logging.
2016-09-16 08:35:26 -07:00
Tim Hockin 344eca6507 Reorder args to make more sense 2016-09-16 08:35:26 -07:00
Tim Hockin 119465829f Minor log cleanup in prep for later changes 2016-09-16 08:35:26 -07:00
Tim Hockin 2d9dbf9fa6 clean up flag definitions 2016-09-16 08:35:26 -07:00
Tim Hockin c39a9369b9 Make /git a parameter rather than const
This makes easier testing.
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