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

move init-file processing into a function #402

Merged
merged 1 commit into from
Apr 30, 2018

Conversation

wpalmer
Copy link
Contributor

@wpalmer wpalmer commented Apr 10, 2018

I have often found myself deriving the mysql image in order to make
it easier to process initialisation files in multiple paths, or to change
the rules used for processing such initialisation files. After having
made such extensions repeatedly, I have now attempted to clean
them up and make them generic enough for inclusion into the
upstream repository.

files found within /docker-entrypoint-initdb.d/* are processed using
specific rules based on their filename. It was previously difficult to
re-use this logic recursively, or to add logic for handling additional
filetypes.

By moving this logic into a shell function, we both enable inner shell
scripts to easily re-use the same logic (for example, for including
files from additional directories or sub-directories), and the
possibility of overriding these processing rules entirely, for example
to enable handling of additional filename patterns.

There is a potential change of functionality compared to the previous
version: the mysql command can no-longer be overridden by changing the
mysql variable. Instead, the mysql command may be overridden only by
overriding the process_init_file() function.

There is a potentially loss of functionality in that included scripts
can no-longer use "break" to escape the file loop. There is presently
no work-around for this, as this is not expected to have been an
intended feature.

files found within /docker-entrypoint-initdb.d/* are processed using
specific rules based on their filename. It was previously difficult to
re-use this logic recursively, or to add logic for handling additional
filetypes.

By moving this logic into a shell function, we both enable inner shell
scripts to easily re-use the same logic (for example, for including
files from additional directories or sub-directories), and the
possibility of overriding these processing rules entirely, for example
to enable handling of additional filename patterns.

There is a potential change of functionality compared to the previous
version: the mysql command can no-longer be overridden by changing the
mysql variable. Instead, the mysql command may be overridden only by
overriding the process_init_file() function.

There is a potentially loss of functionality in that included scripts
can no-longer use "break" to escape the file loop. There is presently
no work-around for this, as this is not expected to have been an
intended feature.
@wpalmer
Copy link
Contributor Author

wpalmer commented Apr 10, 2018

though automated travis-ci has failed, (if I am reading the log correctly) these failures appear to be unrelated to the requested change.

@wpalmer wpalmer closed this Apr 11, 2018
@wpalmer wpalmer deleted the process_init_file-function branch April 11, 2018 13:54
@wpalmer wpalmer restored the process_init_file-function branch April 11, 2018 13:54
@wpalmer wpalmer deleted the process_init_file-function branch April 11, 2018 14:00
@wpalmer wpalmer restored the process_init_file-function branch April 11, 2018 14:01
@wpalmer
Copy link
Contributor Author

wpalmer commented Apr 11, 2018

I am reopening after having caused a successful travis build based on my own repository ( no changes required - the issue appears to be a known instability in ha.pool.sks-keyservers.net , which is not involved in this pull request's changes )

@wpalmer wpalmer reopened this Apr 11, 2018
@ltangvald
Copy link
Collaborator

I'm +1 on this, as compartmentalizing the different sections of the entrypoint script will in general make it easier to debug and make improvements

Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ltangvald ❤️

LGTM 👍

@tianon tianon merged commit fc3e856 into docker-library:master Apr 30, 2018
tianon added a commit to infosiftr/stackbrew that referenced this pull request May 3, 2018
- `buildpack-deps`: add `netbase`
- `gcc`: 8.1.0
- `ghost`: 1.22.5, 0.11.13
- `haproxy`: 1.7.11
- `mariadb`: 10.0.35
- `mongo`: 3.7.9
- `mysql`: docker-library/mysql#402
- `openjdk`: 11-ea-11, 8u171
- `php`: docker-library/php#627, docker-library/php#632
- `pypy`: docker-library/pypy#23
- `python`: add `netbase`, 3.7.0b4
- `rabbitmq`: 3.7.5-rc.1
- `rocket.chat`: 0.64.1
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

Successfully merging this pull request may close these issues.

3 participants