Is there a way to guarantee a shell command/action excution at a pipeline finish?
after_script. It is not always executed at pipeline finish, here are descriptions:
trap "do-final-cut" EXIT KILL QUIT STOP TERM ABRT INT
is not working too if Cancel pressed at GUI. It’s used inside build scripts under the hood and is not launched in case of pipelines under Gitlab-runner control. However, it works if used in a regular way.
Do I missed a signal to mention in the list??? - signal(7) - Linux manual page
How do I implement such a thing?
P.S. Build process (if interrupted) may leave read-only items in build directory tree which will prevent Gitlab’s directory cleanup at next
git clone while pipeline start. It happens when Cancel is pressed. However,
before_script - Keyword reference for the .gitlab-ci.yml file | GitLab - is running after clone, as it is concatenated with any scripts you specify in the main
script: and executed together in a single shell. No chance to use before git clone. What a good way is to unconditinally launch an actions at pipeline finish or before git clone?