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

Add support for canceling goals #572

Merged
merged 16 commits into from
Nov 13, 2018
Merged

Add support for canceling goals #572

merged 16 commits into from
Nov 13, 2018

Conversation

cdupuis
Copy link
Member

@cdupuis cdupuis commented Nov 12, 2018

This adds support for canceling goals:

export const cancel = new Cancel({ goals: [autofix, build, dockerBuild, publish] });

This goal when added to a goal set will cancel all pending or in process auto fix, build, docker build and publish goal instances on the current goal's push.before.sha of the same branch.

Which goals should be canceled can you be defined with the goalFilter on CancelOptions:

/**
 * Options to configure the Cancel goal
 */
export interface CancelOptions {

    /**
     * Goals that should be canceled if they are in a state that allows cancellation
     */
    goals: Array<Goal | Goals>;

    /**
     * Filter goals to cancel based on goalSet or state
     * @param goalSet
     */
    goalFilter?: (goal: SdmGoalEvent) => boolean;
}

fixes #571

@cdupuis cdupuis changed the title Add tests for Cancel goal Add support for canceling goals Nov 12, 2018
@cdupuis cdupuis added auto-merge:on-approve Auto-merge on review approvals auto-merge-method:squash Auto-merge with squash and merge changelog:added Add this issue or pull request to added changelog section labels Nov 12, 2018
Copy link
Contributor

@ddgenome ddgenome left a comment

Choose a reason for hiding this comment

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

Looks good. One question about a null check.

lib/api-helper/listener/executeCancel.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@lievendoclo lievendoclo left a comment

Choose a reason for hiding this comment

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

OK

@atomist-bot atomist-bot merged commit d64899f into master Nov 13, 2018
@atomist-bot
Copy link
Contributor

Pull request auto merged by Atomist.

[atomist:generated] [auto-merge:on-approve]

@atomist-bot atomist-bot deleted the cancel-goal branch November 13, 2018 11:02
atomist-bot added a commit that referenced this pull request Nov 13, 2018
[atomist:generated]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge:on-approve Auto-merge on review approvals auto-merge-method:squash Auto-merge with squash and merge changelog:added Add this issue or pull request to added changelog section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for limiting number of concurrent GoalSets for a branch
4 participants