How to use Build Number inside Pipeline step as Image:tag or version?

I want to use Buildkite Build Number inside Pipeline step.
I tried using $BUILDKITE_BUILD_NUMBER inside pipeline step command.
However it gives error on save, saying BUILDKITE_BUILD_NUMBER is not available.
How can I use Build Number inside the pipeline?

Normally in Jenkins, we use Build or Job number inside pipeline while building Image for build tag.

Regards

Hi Neelesh,

Sorry that the docs aren’t clear about this. The YAML editor you are using is still a beta feature and we are still working on the docs for it. Only a subset of environment variable are currently available to the editor, which is why you see the error. This article has a list of the environment variables that are available:
https://forum.buildkite.community/t/defining-pipeline-build-steps-with-yaml/79

You can, however, access the environment variable in a script, e.g. add a command step with a shell script that queries the environment variable. If you want to use the value in a subsequent step, you can pass it to a meta-data key.