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

Multibranch Pipeline Branch Scanning Hang #458

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

arechavarria
Copy link

Description of Changes

This pull request introduces a configurable indexingTimeout parameter to the gitlab-branch-source plugin in Jenkins, enabling users to set a maximum wait time in seconds for indexing GitLab repositories. This timeout is applied in two key methods:

  • retrieve(SCMHead head, TaskListener listener): Updated to use an ExecutorService and Future, allowing the operation to be cancelled if it exceeds the specified timeout.
  • retrieveActions(SCMSourceCriteria criteria, SCMHeadObserver observer, SCMHeadEvent<?> event, TaskListener listener): Modified to respect the indexingTimeout configuration across the indexing process, including checks on branches, merge requests, and tags.

Additionally, a new indexingTimeout property has been added to the UI configuration in the config-detail.jelly file, enabling users to set the timeout through Jenkins' interface.

image

Testing Done

Manual tests were conducted to validate indexingTimeout functionality in various scenarios:

  1. Defined Timeout (greater than 0): A sample timeout was set, and it was verified that the operation would be interrupted if it exceeded the specified time.

image

  1. Undefined Timeout (0): Confirmed that the operation continued without interruption when indexingTimeout was set to 0.

image

  1. Regression: Tested across different projects and merge requests to ensure the new functionality did not interfere with standard GitLab indexing.

Submitter Checklist

  • Opening from a topic/feature/bugfix branch and not from the main branch.
  • The pull request title represents the desired changelog entry.
  • Clear description of changes made.
  • Links to relevant issues in GitHub or Jira.
  • Links to relevant pull requests, especially upstream and downstream changes.
  • Provided tests that demonstrate feature works or fixes the issue.

@arechavarria arechavarria marked this pull request as draft November 13, 2024 22:10
@arechavarria arechavarria marked this pull request as ready for review November 13, 2024 22:10
Aaron Echavarria added 5 commits December 10, 2024 20:30
This commit removes a unit test that relied on Mockito to mock static methods inside a separate thread. Mockito encounters issues when mocks are accessed across different threads, leading to inconsistent behavior and null values in asynchronous contexts.

The test was causing failures due to these limitations, as static mocks were not reliably available within the ExecutorService thread. A potential solution could involve restructuring the code to allow synchronous execution in a single-threaded context for testing purposes, or exploring alternative approaches for mocking in multi-threaded scenarios.

Further investigation into better testing strategies for this case is recommended.
Aaron Echavarria added 3 commits December 10, 2024 20:31
This commit removes a unit test that relied on Mockito to mock static methods inside a separate thread. Mockito encounters issues when mocks are accessed across different threads, leading to inconsistent behavior and null values in asynchronous contexts.

The test was causing failures due to these limitations, as static mocks were not reliably available within the ExecutorService thread. A potential solution could involve restructuring the code to allow synchronous execution in a single-threaded context for testing purposes, or exploring alternative approaches for mocking in multi-threaded scenarios.

Further investigation into better testing strategies for this case is recommended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant