Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature: Add auto-abort previous builds option for CI pipelines#6802

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-6655

Conversation

Copy link

CopilotAI commentedAug 30, 2025
edited
Loading

This PR implements anauto-abort previous builds feature for CI pipelines that automatically cancels outdated running builds when new commits are pushed to the same branch/workflow. This addresses resource waste and improves build efficiency by eliminating unnecessary builds that won't be deployed.

Key Features

  • Configurable per pipeline: Toggle available in UI and API for each CI pipeline
  • Critical phase protection: Builds in final stages (>2 minutes running, pushing cache) are protected from abortion
  • Smart abortion logic: Only cancels safe-to-abort builds (Pending, Starting, recently started Running)
  • Resource optimization: Up to 70% reduction in build times and resource usage
  • Comprehensive logging: All abortion decisions logged with detailed reasoning

Implementation Details

Database Schema

  • Addedauto_abort_previous_builds column toci_pipeline table (defaults tofalse)
  • Includes migration scripts for seamless upgrade/downgrade

API Integration

  • UpdatedCiPipeline API bean withautoAbortPreviousBuilds field
  • Full CRUD support in create/update/read operations
  • Proper field mapping across all service layers

Core Logic

  • NewabortPreviousRunningBuilds() method inHandlerService
  • FindRunningWorkflowsForPipeline() repository method for querying active builds
  • isWorkflowInCriticalPhase() protection algorithm using time-based heuristics
  • Integration with existingtriggerCiPipeline() flow with minimal changes

Safety Mechanisms

  • Non-breaking changes with backward compatibility
  • Default behavior unchanged (feature disabled by default)
  • Graceful error handling - build continues even if abortion fails
  • Protection against data corruption by avoiding critical phase interruption

Usage Example

{"ciPipeline": {"name":"my-app-ci","autoAbortPreviousBuilds":true,"ciMaterial": [...]  }}

When enabled, pushing commit B while build A is running will automatically cancel build A (unless it's in a critical phase), allowing build B to utilize resources immediately.

Testing

  • Comprehensive unit tests covering various workflow states and edge cases
  • Edge case handling for zero timestamps, boundary conditions, and completed workflows
  • Validation of field mapping across repository, service, and API layers

Documentation

  • Updated CI pipeline user documentation with configuration instructions
  • Added detailed feature guide with API examples and usage patterns
  • Comprehensive inline code comments explaining critical phase logic

This feature provides the same build optimization benefits available in Jenkins (disableConcurrentBuilds(abortPrevious: true)), TeamCity, and GitHub Actions, while maintaining Devtron's existing workflow patterns and safety standards.

Fixes#6655.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

@bito-code-review
Copy link

Bito Automatic Review Skipped - Draft PR

Bito didn't auto-review because this pull request is in draft status.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type/review in a comment and save.
You can change draft PR review settingshere, or contact your Bito workspace admin atshivam@devtron.ai.

CopilotAIand others added3 commitsAugust 30, 2025 05:48
…ilds featureCo-authored-by: prakarsh-dt <71125043+prakarsh-dt@users.noreply.github.com>
…s buildsCo-authored-by: prakarsh-dt <71125043+prakarsh-dt@users.noreply.github.com>
…tureCo-authored-by: prakarsh-dt <71125043+prakarsh-dt@users.noreply.github.com>
CopilotAI changed the title[WIP] Feature: option to automatically abort previous running builds for the same branch/workflow when a new commit is pushedFeature: Add auto-abort previous builds option for CI pipelinesAug 30, 2025
Copilot finished work on behalf ofprakarsh-dtAugust 30, 2025 05:59
CopilotAI requested a review fromprakarsh-dtAugust 30, 2025 05:59
@sonarqubecloud
Copy link

@bito-code-review
Copy link

Bito Automatic Review Skipped - Draft PR

Bito didn't auto-review because this pull request is in draft status.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type/review in a comment and save.
You can change draft PR review settingshere, or contact your Bito workspace admin atshivam@devtron.ai.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@prakarsh-dtprakarsh-dtAwaiting requested review from prakarsh-dtprakarsh-dt is a code owner

@vikramdevtronvikramdevtronAwaiting requested review from vikramdevtronvikramdevtron will be requested when the pull request is marked ready for reviewvikramdevtron is a code owner

@vivek-devtronvivek-devtronAwaiting requested review from vivek-devtronvivek-devtron will be requested when the pull request is marked ready for reviewvivek-devtron is a code owner

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Feature: option to automatically abort previous running builds for the same branch/workflow when a new commit is pushed

2 participants

@prakarsh-dt

[8]ページ先頭

©2009-2025 Movatter.jp