How do I create an incrementing minor version numb...
# general
f
How do I create an incrementing minor version number? (ex: for an image in ECR)
What I don't want is to have to do this all the time:
https://www.pulumi.com/docs/concepts/options/version/
l
This is not a Pulumi operation. You will need to use the functionality provided by your language or another library to do this.
Image version numbers should probably be defined in their Dockerfile.
f
Any suggestions/examples on how to do that?
not the dockerfile route, in code
l
The most simple and self-documenting would be to use a Pulumi config setting and require the system or developer to change it. This allows for external tools to do the work, to get the value from your CI vaults, or any other place. Alternatively, you could write a value to well-known global location (a vault, DynamoDB table, even a file in an S3 bucket), then read-increment-write it. This has a problem in that there is limited user control, and is susceptible to being broken by (for example) failed deployments, credential expiry, accidental change / deletion, and more.
You would have problems like: what if someone updated the global value to be lower, thus causing a conflict with a deployed resource later?
Having it in your Pulumi config file is good, because then normal code review practices ensure it is correct.
f
Yep that all makes sense. I am just a solo dev right now, so was tired of copy and pasting some randomly generate string for the latest image to my other application that needs to know what to pull
l
Is a timestamp suitable?
f
Hmmm thats better? Still more or less the exact same problem, but an easier to interpret string
l
Or maybe the sha1 of the latest commit?
f
eb1e1cbc3296736335a6f36b694a182d5319b63fefc0481de768c1cb67a23b6c
->
1693929292010
But what I would prefer is to go into my other application after a deploy and just change
0.0.21
->
0.0.22
l
If you use a tool that supports it (npm/yarn, maven with the version extension, etc.) you can use your project's package version.
f
Ya that's not a terrible idea
thanks for the ideas!
b
Maybe this is kinda over-engineering, but why not using a Dynamic Provider which keeps the version under control and has one or more keepers that will cause the version to bump if the keeper change. So if the git commit is a keeper, the version will bump if the commit changes. Another advantage the version could then be an Pulumi output that could be referenced in other Pulumi programs.