I made an initial attempt at replacing the AVATICA_VERSION in the
dockerfiles during a build using the maven-replacer-plugin and the scm
plugin. Unfortunately, I was not able to get it to work correctly. The
commit is here:
https://github.com/F21/calcite-avatica/commit/d3f13910e6db1fbe536933c1c7c619bfdd5f5c93
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 this
Josh, 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