[go: up one dir, main page]

Skip to content

Pipelines are triggered on branch delete

Summary

When Gitaly sends a post_receive internal API request to GitLab advising of a branch deletion, pipeline creation is triggered in GitLab. As the ref no longer exists, the Git::BranchHooksService fails with a message of Error creating pipeline and error Reference not found. We can see a lot of these errors in GitLab.com Sidekiq logs using the query:

json.message:"Error creating pipeline" AND json.pipeline_params.after:"0000000000000000000000000000000000000000" AND json.errors:"Reference not found"

This issue was created from a discussion in the #g_create_source-code Slack channel (internal):

We currently create pipelines for all git pushes no matter if they create/update or delete a branch. I agree, it doesn’t sound right when we trigger a pipeline for deleted branches. We can fix that by skipping a pipeline creation for the delete branch case.

Steps to reproduce

You can reproduce this by either:

  • Deleting a branch in the GitLab UI; or
  • Deleting a remote branch via a Git push

Example Project

https://gitlab.com/tmike_ultimate_group/zd571421/zd571421

What is the current bug behavior?

Pipeline creation is triggered but errors because the branch ref has been removed

What is the expected correct behavior?

Skip pipeline creation for that ref when it has been deleted

Relevant logs and/or screenshots

Elasticsearch (internal)

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Michael Trainor