Skip to content

Feature request: "on_abort" hook  #120

Closed

Description

@xtreme-sameer-vohra

When a task acquires an env and uses on_failure to release the env, it doesn't fire on abort.
This makes it difficult to manage env resources that are passed between a series of jobs.

Could we add an on_abort hook or allow on_failure to also fire on aborting a job?

The former seems like the right thing to do.
Another idea would be to have a pipeline level ensure.

Regards,
Ergin & Sameer

Activity

  1. concourse-bot commented on Aug 10, 2015

    @concourse-bot

    Hi there!

    We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.

    The current status is as follows:

    • #140235749 Feature request: "on_abort" hook
    • #100965266 As a pipeline author I can use an "on_abort" hook

    This comment, as well as the labels on the issue, will be automatically updated as the status in Tracker changes.

  2. spikymonkey commented on Mar 14, 2016

    @spikymonkey

    Hi Concourse,

    This would definitely be useful for us too. We have on_failure cleanups which aren't being automatically run whenever a user manually aborts a task. If the user forgets to run the cleanups manually then this causes us issues the next time the job runs. Ideally the user wouldn't have to remember to trigger the cleanups manually since the act of aborting the job in concourse would run them automatically.

    Cheers,
    Gareth

  3. JamesClonk commented on Jan 23, 2017

    @JamesClonk
    Contributor

    Yes, this would be immensely useful for some of our pipelines. (dealing with github PRs / gitlab merge-requests)

  4. timrchavez commented on Oct 20, 2017

    @timrchavez
    Contributor

    This is finally happening folks :)

  5. vito commented on Nov 27, 2017

    @vito
    Contributor

    @mhuangpivotal @timrchavez Looks like the UI hasn't been updated for this.

    With the following job...:

    jobs:
    - name: running
      on_abort:
        task: say-bye
        config:
          platform: linux
          image_resource:
            type: docker-image
            source: {repository: busybox}
          run:
            path: echo
            args: [bye from job]
      plan:
      - task: run
        on_abort:
          task: say-bye
          config:
            platform: linux
            image_resource:
              type: docker-image
              source: {repository: busybox}
            run:
              path: echo
              args: [bye from step]
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: busybox
          run:
            path: sh
            args:
            - -ec
            - |
              echo hello
    
              while sleep 1; do
                echo looping
              done

    ... I get a console error when viewing the build:

    failed to fetch plan: BadPayload "I ran into the following problems at _.plan:\n\nExpecting an object with a field named `task` but instead got: {\"id\":\"5a1c6b2e\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2c\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2a\",\"task\":{\"name\":\"run\",\"privileged\":false}},\"on_abort\":{\"id\":\"5a1c6b2b\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}},\"on_abort\":{\"id\":\"5a1c6b2d\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}}\nExpecting an object with a field named `get` but instead got: {\"id\":\"5a1c6b2e\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2c\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2a\",\"task\":{\"name\":\"run\",\"privileged\":false}},\"on_abort\":{\"id\":\"5a1c6b2b\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}},\"on_abort\":{\"id\":\"5a1c6b2d\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}}\nExpecting an object with a field named `put` but instead got: {\"id\":\"5a1c6b2e\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2c\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2a\",\"task\":{\"name\":\"run\",\"privileged\":false}},\"on_abort\":{\"id\":\"5a1c6b2b\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}},\"on_abort\":{\"id\":\"5a1c6b2d\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}}\nExpecting an object with a field named `dependent_get` but instead got: {\"id\":\"5a1c6b2e\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2c\",\"on_abort\":{\"step\":{\"id\":\"5a1c6b2a\",\"task\":{\"name\":\"run\",\"privileged\":false}},\"on_abort\":{\"id\":\"5a1c6b2b\",\"task\":{\"name\":\"say-bye\",\"privileged\":false}}}},\"on_abort\":{\"id\":\"5a1c6b2d\",\"task\":{\"name\":\"say-bye\",\
  6. added 2 commits that reference this issue on Nov 27, 2017
  7. modified the milestone: v3.7.0 on Nov 29, 2017
  8. added a commit that references this issue on Jan 11, 2018
  9. added a commit that references this issue on Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions