I won't have any more time to look at it for the rest of the week. If someone wants to take a stab, please check out the commit.
While researching how to implement this, I came across an answer on StackOverflow where the author outlined some issues with this approach: https://stackoverflow.com/a/47817363/624884
In summary, they used scm:checkin to commit the files. This meant that they will also be committed even when the -DdryRun=true argument is used. I tried scm:add in my own version, but couldn't get the files to update or change.
I think using docker hooks per Vladimir's suggestion is probably the simplest way. The implementation is quite simple, we simply set ARG AVATICA_VERSION to empty in our dockerfiles. We then create files in the hooks folder for each build phase of the dockerfiles we want to intercept. The hook would just be a simple bash script where we can pass the tag being built to the docker build command. See an example of one I implemented for one of my projects here: https://github.com/Boostport/kubernetes-vault/blob/master/cmd/init/hooks/build
If there is consensus on using docker hooks, I think it should be possible to get that included into the 1.13.0-rc0 release.
On 22/11/2018 5:41 am, Vladimir Sitnikov wrote:
I'm not sure what combination of plugins would be best to do thisJosh, you might have missed, yet there's an option to add DockerHub hook files to the repository, and DockerHub will execute them at build. Then no replacements would be required. What do you think? Vladimir