How to use variable name trimming in image section of .yml

I’m trying to perform variable trimming in the image section of the job.
i.e

image:my_image_name:${CI_COMMIT_SHA:0:7}

and it is getting interpreted as an empty string whereas ${CI_COMMIT_SHA} correctly evaluates to the full sha. .

Is this a bug in gitlab CI ?