diff options
author | Paul Okstad <pokstad@gitlab.com> | 2020-06-03 02:51:50 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2020-06-03 02:51:50 +0300 |
commit | 8e18cae9f3d52b6838dc02a0eebdd17b0748d34a (patch) | |
tree | 1d6a1c9cdd39897079b077177331e6e3252d565d | |
parent | 57490bbd9b948aa50449e1c8f572691ebd6f10aa (diff) | |
parent | 64d8c755e0670b5fc3ce13a9117a442f9f262a2a (diff) |
Merge branch 'jc-disable-gitlab-api-with-no-hooks' into 'master'
Skip creation of gitlab api if GITALY_TESTING_NO_GIT_HOOKS is set
See merge request gitlab-org/gitaly!2245
-rw-r--r-- | changelogs/unreleased/jc-disable-gitlab-api-with-no-hooks.yml | 5 | ||||
-rw-r--r-- | cmd/gitaly/main.go | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/changelogs/unreleased/jc-disable-gitlab-api-with-no-hooks.yml b/changelogs/unreleased/jc-disable-gitlab-api-with-no-hooks.yml new file mode 100644 index 000000000..c0e3f4bb1 --- /dev/null +++ b/changelogs/unreleased/jc-disable-gitlab-api-with-no-hooks.yml @@ -0,0 +1,5 @@ +--- +title: Skip creation of gitlab api if GITALY_TESTING_NO_GIT_HOOKS is set +merge_request: 2245 +author: +type: changed diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go index a03e31ebd..535095a5b 100644 --- a/cmd/gitaly/main.go +++ b/cmd/gitaly/main.go @@ -85,9 +85,16 @@ func main() { // Inside here we can use deferred functions. This is needed because // log.Fatal bypasses deferred functions. func run(b *bootstrap.Bootstrap) error { - gitlabAPI, err := hook.NewGitlabAPI(config.Config.Gitlab) - if err != nil { - log.Fatalf("could not create gitlab api client: %v", err) + var gitlabAPI hook.GitlabAPI + var err error + + if config.SkipHooks() { + log.Warn("skipping GitLab API client creation since hooks are bypassed via GITALY_TESTING_NO_GIT_HOOKS") + } else { + gitlabAPI, err = hook.NewGitlabAPI(config.Config.Gitlab) + if err != nil { + log.Fatalf("could not create GitLab API client: %v", err) + } } servers := bootstrap.NewGitalyServerFactory(gitlabAPI) |