https://pulumi.com logo
#general
Title
# general
f

famous-kitchen-30533

11/13/2023, 11:00 PM
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

little-cartoon-10569

11/13/2023, 11:02 PM
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

famous-kitchen-30533

11/13/2023, 11:04 PM
Any suggestions/examples on how to do that?
not the dockerfile route, in code
l

little-cartoon-10569

11/13/2023, 11:07 PM
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

famous-kitchen-30533

11/13/2023, 11:09 PM
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

little-cartoon-10569

11/13/2023, 11:09 PM
Is a timestamp suitable?
f

famous-kitchen-30533

11/13/2023, 11:10 PM
Hmmm thats better? Still more or less the exact same problem, but an easier to interpret string
l

little-cartoon-10569

11/13/2023, 11:10 PM
Or maybe the sha1 of the latest commit?
f

famous-kitchen-30533

11/13/2023, 11:10 PM
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

little-cartoon-10569

11/13/2023, 11:11 PM
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

famous-kitchen-30533

11/13/2023, 11:12 PM
Ya that's not a terrible idea
thanks for the ideas!
b

big-architect-71258

11/14/2023, 2:08 PM
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.