Hello,
we're currently migrating from Bamboo. Bamboo had "final tasks" ... these tasks are fired even if the "normal" tasks were failing.
I'm looking for a replacement. I'm starting some docker containers on a remote maschine and have to stop them afterwards.
I'm thinking of something like "teardown steps" but couldn't find anythink like that.
Any Ideas?
Regards,
Dirk
@Dittmar_ Dirk Welcome! Are you referring to after steps?: https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines
Nicolas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, no... but kind of (I guess)
The "after-script" is run after the the "script" in the step...
I'm looking for a step after all the steps... I'm thinking of something like:
pipelines:
custom:
nightly-integration-tests:
- stage:
steps:
- step:
runs-on:
- self.hosted
- linux
name: "start docker containers"
image: atlassian/default-image:4
script:
- |
ssh -o "StrictHostKeyChecking no" foo@bar 'bash -s' < start-postgres15-and-solr.sh
- step:
runs-on:
- self.hosted
- linux
name: "run the integration tests"
image: maven:3.9.5-eclipse-temurin-17-focal
script:
- |
mvn ...
- step: # or something like "after-steps"
runs-on:
- self.hosted
- linux
name: "shutdown docker containers"
image: atlassian/default-image:4
script:
- |
ssh -o "StrictHostKeyChecking no" foo@bar 'bash -s' < stop-all-docker-containers.sh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you start the container as part of "run integration tests" and use `after-script` on that step to stop it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, no...
the "run the integration tests" is a step where I run a Maven3 build. The other steps use an image where I can run SSH "things". I could shove everything in one image but than I have to nurse that image myself... and where is the sense of the "steps" and stages then?
Maybe I can do something with conditions (or something like that)? 🤔
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, I see... You mean start conditions? 🤔
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
... yes ... but that's only for conditions like "do this if files in some directory were changed" ... and the step is not executed because the pipeline stops at the step that has a non zero return code...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hmm... yeah, the failure scenario would not work.
What you use 'after-script' with trigger-pipe?
Set a `after-script` on every step after the setup and, check whether it has failed and trigger a 'clean up' pipeline for the intermediate steps, and always trigger on the last step?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hmmm ... no, but I see the idea...
The second step (see above) uses `maven:3.9.5-eclipse-temurin-17-focal` which does not have an ssh-client like the image in the last step (`atlassian/default-image:4`)
I guess I have to stuff everything in one image and use one step only... kinda anoying really... where can I file a feature request?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you define a separated 'clean up' pipeline you can use the 'atlassian/default-image:4'. So you would have 'nightly-integration-tests' pipeline which triggers 'clean up'.
Usually Atlassian support monitors the posts here and create a request if it doesn't already exists.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's not a sulution ether ... I'm just testing with a one database but I have to build this for 5 other databases... like:
so... I guess there is no easy way to do it 🤷
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dirk,
We have a feature request for an after-step here:
The request has been closed due to inactivity; no comments or votes for an extended period of time, so it didn't make it to the roadmap. However, you can still leave a comment with your use case to express your interest, as our product managers continue to monitor even closed requests.
The after-script is the only available option right now, and Saxea _Flowie_'s replies have covered what is possible.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.