I am trying to set an environmental variable in a format of YYYY.MM.DD.BuildId
for versioning binaries, but I cannot seem to figure out how to do this. I need it available from the buildspec.yml file to reference in the compiler commands. It doesn't seem like it should be this difficult, but I cannot seem to update the environmental variables with any kind of dynamic logic.
I've tried variations on this theme in the yaml file:
env:
variables:
BUILD_VERSION: "$(date +%Y.%m.%d).$(CODEBUILD_BUILD_NUMBER)"
...but it always treats the build version as a literal value. No substitution takes place.
I can't be the only person that's tried to do this sort of thing. How can I make this work? This is stupidly easy in Azure Devops, and trivial in Jenkins as well, so it's surprising how long I've been at this.