Final Step required for parsing unit tests or other clean up or roll back

Issue #13317 open
Thomas Turrell-Croft
created an issue

Bamboo has a final step which allows unit test to be parsed no matter if there is a failing test. I believe this would be a useful feature for Pipelines assuming that multiple steps are implemented.

Comments (19)

  1. Charlie Jonas

    I also need this feature!

    We are doing CI on Salesforce and have to spin off a "temporary" org environment for each run. We have a very limited # of these orgs that can be active at once, and thus need to be cleaned up at the end of every CI run, regardless if it succeeds or not.

  2. Hugh Ma

    We spin up various public cloud instances for cross-platform testing. As of right now, we'll probably have to build in self-destruct commands into the instances, but ideally, if a pipeline fails or even succeeds, there should be a block that "always runs" for us to be able to spin down and clean up any environment.

  3. Michael Diamond

    I'd like to be able to upload test artifacts (e.g. the generated output from a framework like JUnit or TestNG) to Google Cloud Storage regardless of the outcome of the tests themselves. Currently I have to jump through some hoops to make that work properly since Pipelines terminates at the first non-zero exit code. A post-run hook or a similar run-always feature would be very useful.

  4. Sandro Manke

    I am doing docker-compose tests in CI and it would probably be best to clean up all that mess after, or would that be handled already well by the current implementation?

  5. Juan Pablo Vega

    We're spinning up test environments for each build/test suite and we need to clean them up as the end of the pipeline run, no matter what. It feels like an "always-run" type of step is missing in Pipelines..

  6. Geoff Maude

    Would something like the following work (for the finally: case), by relying on a shell trap function, e.g:

    step:
      script:
        -  cleanup() { echo "Always executes, call your cleanup script here..." ; }
        -  trap cleanup 0 1
        -  exit 1  # to error out, remove line to test positive case
        -  echo "Not reached unless exit 1 removed."
    
    ...
    
  7. Brandon Williams

    +1

    Would love to have the ability to destroy / rollback images in EC2 conditionally based on results of tests.

    Edit: I suppose I can just handle tthis via a shell script ran via the pipeline yaml. Still would be a cool out-of-the-box feature!

  8. Jeremy Stafford

    I think a more productive ask would really just to add additional stages to the build for setup and teardown which happen outside of the build pipeline. For example, appveyor has an init step where you can perform any action before the build starts and various finalizer steps (build succeed, build fail, etc.) that run after the build pipeline.

  9. Log in to comment