Skip to content

Add initial jq-based templating engine #730

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

yosifkit
Copy link
Member

Similar to docker-library/php#1052.

This also takes some bits (like dirCommit and Dockerfile.debian) from #680 in order to support that PR easier.

The new Dockerfile template should make it easier to keep the version-specific Dockerfiles in sync.

--- ../official-images/library/mysql	2020-10-22 15:16:01.132359192 -0700
+++ /dev/fd/63	2020-11-18 15:46:54.728546973 -0800
@@ -1,17 +1,20 @@
-# this file is generated via https://github.com/docker-library/mysql/blob/ff627942605ce08a32fa527993337df0e9856760/generate-stackbrew-library.sh
+# this file is generated via https://github.com/docker-library/mysql/blob/e0ac64268f0f2d151baea664b5fa9dbcaa0c9321/generate-stackbrew-library.sh
 
 Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon),
              Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
 GitRepo: https://github.com/docker-library/mysql.git
 
 Tags: 8.0.22, 8.0, 8, latest
-GitCommit: 1a25a09159a3d7b6b5b8ad0e6c7eb53504b3aab5
+GitCommit: e0ac64268f0f2d151baea664b5fa9dbcaa0c9321
 Directory: 8.0
+File: Dockerfile.debian
 
 Tags: 5.7.32, 5.7, 5
-GitCommit: 1a25a09159a3d7b6b5b8ad0e6c7eb53504b3aab5
+GitCommit: e0ac64268f0f2d151baea664b5fa9dbcaa0c9321
 Directory: 5.7
+File: Dockerfile.debian
 
 Tags: 5.6.50, 5.6
-GitCommit: 1a25a09159a3d7b6b5b8ad0e6c7eb53504b3aab5
+GitCommit: e0ac64268f0f2d151baea664b5fa9dbcaa0c9321
 Directory: 5.6
+File: Dockerfile.debian

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.

Overall looks good, nice work!

Just a few (minor) comments. 👍

for version; do
export version

if [ -n "$(jq -r '.[env.version].debian // ""' versions.json)" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

If this jq fails for some reason (syntax error, .[env.version] being undefined, etc), then this script will silently skip this $version instead of also failing, so I think we need to split this out:

Suggested change
if [ -n "$(jq -r '.[env.version].debian // ""' versions.json)" ]; then
debianVersion="$(jq -r '.[env.version].debian // ""' versions.json)"
if [ -n "$debianVersion" ]; then

Alternatively, we could (should?) ditch this conditional completely and just let the template generate always -- if we someday remove/deprecate the "debian" variant in a future major/minor release post-#680, then we would introduce a check.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tianon
Copy link
Member

tianon commented Nov 20, 2020

(I look forward to rebasing #680 😆)

@tianon
Copy link
Member

tianon commented Nov 20, 2020

Looks great -- actual Dockerfile changes are very minimal, and this improves the maintainability (especially the ability to verify PRs are updating templates properly and that the CI is testing the PR changes and that @docker-library-bot won't unexpectedly revert or change things post-merge).

@tianon tianon merged commit 79fb37b into docker-library:master Nov 20, 2020
@tianon tianon deleted the jq-template branch November 20, 2020 22:10
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Nov 20, 2020
Changes:

- docker-library/mysql@79fb37b: Merge pull request docker-library/mysql#730 from infosiftr/jq-template
- docker-library/mysql@ee33a21: Add initial jq-based templating engine
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants