Completed pipelines with manual jobs incorrectly showing as cancelable

Description

Finished pipelines are currently showing as cancelable when they should not be. This appears to be a regression introduced by merge request !159776 (merged) which added 'manual' to the CANCELABLE_STATUSES constant.

Current Behavior

  • Finished pipelines are displaying as cancelable in the UI when a manual build is in the pipeline.
  • This is currently happening on production

Expected Behavior

  • Finished pipelines should show cancelable: false with a manual build
  • Only active/running pipelines should be cancelable

Root Cause

The current cancelable? method implementation:

def cancelable?
  cancelable_statuses.any? && internal_pipeline?
end

This checks if the pipeline has any cancelable status jobs, rather than checking if the pipeline itself has a cancelable status.

Proposed Solution

Update the logic to check if the pipeline has a cancelable status rather than checking for any cancelable status jobs within the pipeline.

def cancelable?
      CANCELABLE_STATUSES.include?(pipeline.status) && internal_pipeline?
    end

Related

Edited by 🤖 GitLab Bot 🤖