Add CI_JOB_STATUS=(failed,passed,skipped,cancelled) for after_script
after_script can be configured to run on success and on failure via when.
In the case of always the after script has no knowledge whether it's invoked in error or success condition.
A variable CI_JOB_STATUS=(failed,passed,skipped,cancelled) could be created for after_script to access to solve this problem.
As of 12.4.x there is no similar variable present.
Edited by Elan Ruusamäe