Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(batch-changes): disallow retry on deleted changesets#63336

Merged
BolajiOlajide merged 7 commits into
mainfrom
bo/stop-retry-on-deleted-changesets
Jun 20, 2024
Merged

fix(batch-changes): disallow retry on deleted changesets#63336
BolajiOlajide merged 7 commits into
mainfrom
bo/stop-retry-on-deleted-changesets

Conversation

@BolajiOlajide

@BolajiOlajide BolajiOlajide commented Jun 19, 2024

Copy link
Copy Markdown
Contributor

Closes SRCH-524

Slack Context

Bitbucket Server (v5.1) added the ability to decline and delete pull requests - this isn't replicated across other supported codehosts such as:

  • GITHUB
  • GITLAB
  • BITBUCKET CLOUD
    e.t.c
output.mp4

Due to this, whenever a pull request is deleted, Batch Changes services (like Syncer & Reconciler) keep retrying whatever operation they're running, thereby spamming the codehost in the process.
In this PR, I ensured whenever we encounter certain status code from a HTTP request to a codehost, it returns a NonRetryable error to reduce spamming.

The logic for handling non-existent pull requests lived here, however that condition was never met because httpError did not fulfil the Unwrap interface therefore errors.As couldn't unwrap the underlying error.

Test plan

Create a test batch change targeting a bitbucket server codehost. Once the pull request has been created, delete the pull request.

Once the changeset has been synced on Sourcegraph, the status of the changeset will be updated toCLOSED.

name: testbbdecline2
description: Add Hello World to READMEs

# Find the first 100 search results for README files.
# This could yield less than 100 repos/workspaces if some repos contain multiple READMEs.
on:
  - repositoriesMatchingQuery: repo:^bitbucket\.sgdev\.org/BABU/(delve|compose)$ 

# In each repository, run this command. Each repository's resulting diff is captured.
steps:
  - run: IFS=$'\n'; echo Hello World | tee -a $(find -name README.md)
    container: ubuntu:18.04

# Describe the changeset (e.g., GitHub pull request) you want for each repository.
changesetTemplate:
  title: Hello World
  body: My first batch change!
  commit:
    message: Append Hello World to all README.md files
  # Optional: Push the commit to a branch named after this batch change by default.
  branch: ${{ batch_change.name }}

Changelog

  • Disallow auto-retry when a changeset is deleted.

@BolajiOlajide BolajiOlajide self-assigned this Jun 19, 2024
@cla-bot cla-bot Bot added the cla-signed label Jun 19, 2024
@BolajiOlajide BolajiOlajide force-pushed the bo/stop-retry-on-deleted-changesets branch from 46c75fa to a8376c1 Compare June 19, 2024 12:19
@BolajiOlajide BolajiOlajide changed the title fix(search): (batch-changes) disallow retry on deleted changesets fix(code-search): (batch-changes) disallow retry on deleted changesets Jun 19, 2024
@BolajiOlajide BolajiOlajide changed the title fix(code-search): (batch-changes) disallow retry on deleted changesets fix(batch-changes): disallow retry on deleted changesets Jun 19, 2024
@BolajiOlajide BolajiOlajide requested a review from a team June 19, 2024 16:58

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending removal of the extra Unwrap!

Comment thread internal/extsvc/bitbucketserver/client.go Outdated
Comment thread internal/errcode/code.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@BolajiOlajide BolajiOlajide force-pushed the bo/stop-retry-on-deleted-changesets branch from 4cb044b to 82b3750 Compare June 20, 2024 12:20
@BolajiOlajide BolajiOlajide merged commit 75b506c into main Jun 20, 2024
@BolajiOlajide BolajiOlajide deleted the bo/stop-retry-on-deleted-changesets branch June 20, 2024 13:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants