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

feat(auto-cancel): add pipeline and yaml field for auto cancel #299

Merged
merged 3 commits into from
Oct 9, 2023

Conversation

ecrupper
Copy link
Contributor

@ecrupper ecrupper commented Jul 18, 2023

This change allows users to specify an auto_cancel policy in their pipeline metadata. This policy will impact whether or not running and/or pending builds that may be stale/obsolete will be canceled.

For example, let's consider a pipeline like this

version: "1"

metadata:
    auto_cancel:
        pending: true
        running: true
        default_branch: false

steps:
    - name: example
       image: alpine:latest
       commands:
           - echo "hello"

If I were to push twice to a feature branch in quick succession using this pipeline, the first push build would be canceled in favor of the second.

pending: obsolete builds in a pending state will be canceled (default to true unless the entire block is not provided, then default to false).
running: obsolete builds in a running state will be canceled
default_branch: obsolete push builds to the default branch will be canceled

Draft server PR: go-vela/server#911

@ecrupper ecrupper requested a review from a team as a code owner July 18, 2023 13:56
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Merging #299 (3224f21) into main (9b2ca77) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #299   +/-   ##
=======================================
  Coverage   97.08%   97.08%           
=======================================
  Files          62       62           
  Lines        6816     6837   +21     
=======================================
+ Hits         6617     6638   +21     
  Misses        147      147           
  Partials       52       52           
Files Coverage Δ
yaml/metadata.go 100.00% <100.00%> (ø)

@ecrupper ecrupper added the v0.22.0 Content slotted for v0.22.0 release label Aug 8, 2023
@ecrupper ecrupper self-assigned this Aug 8, 2023
@ecrupper ecrupper merged commit b3cfe9c into main Oct 9, 2023
10 checks passed
@ecrupper ecrupper deleted the hackathon-auto-cancel branch October 9, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v0.22.0 Content slotted for v0.22.0 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants