Open dmitvitalii opened 5 years ago
This is an interesting idea. Let me think about it.
Basicly, I can add a cp path/to/gerrit.config ${GERRIT_HOME}/review_site/etc
in the gerrit-entrypoint.sh somewhere before setting other parameters according to the environment variables. This is not a big deal.
On the user's hand, you should mount this file into the container by using docker run -v
or ConfigMap in k8s, but on the other hand, is it even better to mount gerrit.config file on the ${GERRIT_HOME}/review_site/etc/gerrit.config directly? I've never done this before, just an idea worth considering.
For now I came up with something like:
# gerrit-entrypoint.sh
copy_gerrit_config() {
su-exec ${GERRIT_USER} cp "${1}" "${GERRIT_SITE}/etc/gerrit.config"
}
......
#Copy gerrit.config, replace an existing one
if [ -n "${GERRIT_CONFIG_FILE}" ]; the
copy_gerrit_config "${GERRIT_CONFIG_FILE}"
fi
and going to test it soon.
There is a drawback:
docker run \
--name gerrit \
-e WEBURL=http://my-gerrit.example.com \
-e GERRIT_CONFIG_FILE=path/to/gerrit.config
will cause an ignoring of previously provided parameters (WEBURI
in this case).
UPD: I'ts not gonna work. I wasn't able to access an external FS from gerrit-entrypoint.sh
to get a file that way.
I added some commends in your commit. Would you please check it there?
Thank you for comments! Will check them.
In case of migration it would be really useful to have an ability to provide a single
gerrit.config
file instead of/with providing parameters separately. E.g.