Would be useful to have a step that runs after every other step, regardless of whether the build succeeds or not (essentially a tidy up/tear down step)
My specific use case is wanting to remove a directory from a cache after a build on a feature branch (which is essentially caused by this npm issue)
Thoughts?
Designs
An error occurred while loading designs. Please try again.
Child items
0
Show closed items
GraphQL error: The resource that you are attempting to access does not exist or you don't have permission to perform this action
No child items are currently open.
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
Any update on this feature? It sounds very useful in general. I specifically want to cat test.log | grep "failure", i.e. to see what's caused CTest to fail.
We will most likely introduce: finally_script. It's more definitive then after_script. Everything in finally_script will be executed also when build is failed or canceled. This will require significant changes to Runner to make it possible, but this is something needed to do proper cleanup of resources.
@ayufan I like the idea, but I don't like the name. What about calling it post_script? Similar to to the post_receive hook in git https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks And it is kinda funny since post script is the P.S. in a letter and a computer language for creating vector graphics.
Does finally_script is planned to be used on each job ?
My use case: after each job script (success or fail) I need to perform a task inside the job then process the next job. As I use CI variables, I really need an isolation for each job for finally_script. Am I clear ? :)
I'd be tempted to keep the name as after_script simply so its the same as Travis uses, making it easier to migrate (or use both as i am sure many people do)
@mcfedr Yes, the after_script will have timeout. Not sure where will it be configured, but most likely we will limit it to some arbitrary value (most likely 5 or 10 minutes) that will later be configurable.
Is there any way to know the status of the build in after_script? Maybe some environmental variable indicating the status, but I couldn't find anything yet?
@rogosz.marek I don't believe there is, but that's a good idea. I think there might even be an issue for it already. If not, can you create a new feature request with your use-case?
I would like to see the addition of a property for after_script, the same used for stages
after_script: when: on_failure script: - execute clean up
our use case is
stages: - build_cloud_cluster - test_cluster - cleanup_clusterbuild_cloud_cluster: stage: build_cloud_cluster script: - make cluster after_script: when: on_failure script: - save log as artifact - make clean......
Right now we can use a separate Stage to handle failure in the previous stage, but it becomes messy in the pipeline view when you end up with a clean up stage for each stages.