diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-01-22 18:32:17 +0300 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-01-22 18:35:33 +0300 |
commit | 12ef6ced271cf06ac04534fbabb48539a9290c16 (patch) | |
tree | a91c33ce3c71a26bf2c80195d792b3572bf4afaa | |
parent | cd2554dff135b46110094d6bbea236b2b927aab0 (diff) |
Operations: log failed update-ref commandsavar/log-update-ref-errors
Do what we did in Ruby in 97a7930d6 (Update gitlab_git to
4a0f720a502ac02423, 2017-10-04) for numerous pure-Go calls. This is a
more general solution to problem[1] brought up in the UserUpdateBranch
MR[2].
1. https://gitlab.com/gitlab-org/gitaly/-/merge_requests/3013#note_491544296
2. https://gitlab.com/gitlab-org/gitaly/-/merge_requests/3013
-rw-r--r-- | changelogs/unreleased/avar-log-update-ref-errors.yml | 5 | ||||
-rw-r--r-- | internal/gitaly/service/operations/update_with_hooks.go | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/changelogs/unreleased/avar-log-update-ref-errors.yml b/changelogs/unreleased/avar-log-update-ref-errors.yml new file mode 100644 index 000000000..6d206b165 --- /dev/null +++ b/changelogs/unreleased/avar-log-update-ref-errors.yml @@ -0,0 +1,5 @@ +--- +title: 'Operations: log failed update-ref commands' +merge_request: 3044 +author: +type: fixed diff --git a/internal/gitaly/service/operations/update_with_hooks.go b/internal/gitaly/service/operations/update_with_hooks.go index 2e2ce16e3..603fe4ee1 100644 --- a/internal/gitaly/service/operations/update_with_hooks.go +++ b/internal/gitaly/service/operations/update_with_hooks.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/git/updateref" "gitlab.com/gitlab-org/gitaly/internal/gitaly/hook" @@ -93,11 +94,14 @@ func (s *Server) updateReferenceWithHooks(ctx context.Context, repo *gitalypb.Re return err } - if err := updater.Update(git.ReferenceName(reference), newrev, oldrev); err != nil { + referenceName := git.ReferenceName(reference) + if err := updater.Update(referenceName, newrev, oldrev); err != nil { + ctxlogrus.Extract(ctx).WithError(err).Errorf("'git update-ref' in %v failed with args (%v, %v, %v)", repo.GetGlProjectPath(), referenceName, newrev, oldrev) return err } if err := updater.Wait(); err != nil { + ctxlogrus.Extract(ctx).WithError(err).Errorf("'git update-ref' in %v failed on exit", repo.GetGlProjectPath()) return updateRefError{reference: reference} } |