Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an existing gerrit.config #106

Open
dmitvitalii opened this issue Oct 30, 2018 · 4 comments
Open

Provide an existing gerrit.config #106

dmitvitalii opened this issue Oct 30, 2018 · 4 comments

Comments

@dmitvitalii
Copy link
Contributor

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.

docker run \
  --name gerrit \
  -e GERRIT_CONFIG_FILE=path/to/gerrit.config \ # with all existing configuartions
  -e WEBURL=http://my-gerrit.example.com \ # e.g. if we want different url
  -d openfrontier/gerrit
@thinkernel
Copy link
Contributor

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.

@dmitvitalii
Copy link
Contributor Author

dmitvitalii commented Oct 31, 2018

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.

@thinkernel
Copy link
Contributor

I added some commends in your commit. Would you please check it there?

@dmitvitalii
Copy link
Contributor Author

Thank you for comments! Will check them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants