Unable to specify the tag value in an image pull

Hello,
How can I specify the tag image in an image pull? See below the DRONE_COMMIT value.

With DRONE_COMMIT&{DRONE_COMMIT} I get on the first step (clone) of the pipeline: fatal: reference is not a tree: 0c0f1171…
With $${DRONE_COMMIT} clone is OK but It’s in an infinite loop in suite1, no messages at all for suite1 step and drone log view says:
strconv.Atoi: parsing “”: invalid syntax

Thank you.

I am sorry, I am having a little bit of difficulty understanding the post, however, I did notice a syntax error it the example you provided. To use emulated bash string substitution, you need to use curly braces:

-image: registry.test.com/repo_name:$DRONE_COMMIT
+image: registry.test.com/repo_name:${DRONE_COMMIT}

This of course assumes an image exists for your commit sha. But many people have used this method in the past to build and publish images, and then use them in subsequent pipeline steps.

it works, thank you so much!

Quick question:

image: registry.test.com/repo_name:${DRONE_COMMIT} still does not work with drone exec if you specify the .env vars into another location.

My command is:
echo DRONE_COMMIT=(git rev-parse HEAD)>.drone/env.txt & drone exec --pipeline test --resume-at suite1 --secret-file .drone/secrets.txt --env-file .drone/env.txt --registry=… .drone.yml

As you can see, I use a .drone folder and because of this I get this error message:
mapping values are not allowed in this context

But if I use the .env file at the root of my project, it works which is annoying because the code already uses that file.

Any idea why:
image: registry.test.com/repo_name:${DRONE_COMMIT}
does not use the variables from a file specified with --env-file:
docker exec … --env-file .drone/env.txt
?
Thank you