Hi all,
I’ve some Packer, post-processors that I want to set/have conditions on depending on where a build has been run and which branch it has been run/sourced from - For example:
- From a build server, from
master
/main
branch - From a build server, from another branch (e.g.
feature
branch, or as part of aPR
build) - From a local/workstation build
Depending on the build location and branch, I may want to set different tags, and/or skip the push of the image to a Docker registry/hub. I want to avoid having to remove and re-add, config to skip some of these items when run locally.
I’ve been trying to have a look through Packer documentation and only seemed to find the only
clause (which only filters by source), and a similar request/issue with limited responses/actions/implementations of the back of it.
I’d have expected some conditional logic on these (that can make use of Packer, configuration variables and/or session, environment variables) to determine if these are run or not, and whilst it currently seems this logic isn’t there, I was wondering if people had any suitable suggestions/alternatives that avoid duplicating code/config and manual tasks/changes on a local build.
Cheers,
Paul