As demonstrated via 357faf4a, using $CI_BUILD_REF is DANGEROUS and can lead to conflicts. Making use of $CI_PIPELINE_ID keeps all the jobs in pipeline isolated.
$CI_BUILD_REF
$CI_PIPELINE_ID