Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make git notes not trigger jenkins pipeline #1288

Merged
merged 6 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

### Added
- Added webhook proxy logic to skip requests with the ref id starting with "refs/notes/"

### Changed
- Update SonarQube to 9.9.6 ([#1292](https://github.com/opendevstack/ods-core/pull/1292))
Expand Down
10 changes: 10 additions & 0 deletions jenkins/webhook-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,16 @@ func (s *Server) HandleRoot() http.HandlerFunc {
return
}

// Skip requests with where the ref id is starting with "refs/notes/"
// Reference 1: https://community.atlassian.com/t5/Bitbucket-questions/disable-quot-git-notes-add-quot-behaviour-for-semantic-release/qaq-p/1837322
// Reference 2: https://github.com/semantic-release/semantic-release/discussions/2017#discussioncomment-995308
if len(req.Changes) > 0 && strings.Contains(req.Changes[0].Ref.DisplayID, "refs/notes/") {
log.Println(requestID, "Skipping request with refs/notes/ prefix in ref id")
// Return 200 OK to Bitbucket to avoid retries
http.Error(w, "OK", http.StatusOK)
return
}

if req.EventKey == "repo:refs_changed" {
repo = req.Repository.Slug
if component == "" {
Expand Down
Loading