-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This makes our templating much more sustainable, and will allow our commit automation to make better commit messages (`Update 3.8 to openssl 1.1.1i`, `Update 3.8 to 3.8.10`, etc).
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/*/**/Dockerfile linguist-generated | ||
/*/**/docker-entrypoint.sh linguist-generated | ||
/Dockerfile*.template linguist-language=Dockerfile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Verify Templating | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
defaults: | ||
run: | ||
shell: 'bash -Eeuo pipefail -x {0}' | ||
|
||
jobs: | ||
apply-templates: | ||
name: Check For Uncomitted Changes | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Apply Templates | ||
run: ./apply-templates.sh | ||
- name: Check Git Status | ||
run: | | ||
status="$(git status --short)" | ||
[ -z "$status" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.jq-template.awk |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env bash | ||
set -Eeuo pipefail | ||
|
||
[ -f versions.json ] # run "versions.sh" first | ||
|
||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" | ||
|
||
jqt='.jq-template.awk' | ||
if [ -n "${BASHBREW_SCRIPTS:-}" ]; then | ||
jqt="$BASHBREW_SCRIPTS/jq-template.awk" | ||
elif [ "$BASH_SOURCE" -nt "$jqt" ]; then | ||
wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/5f0c26381fb7cc78b2d217d58007800bdcfbcfa1/scripts/jq-template.awk' | ||
fi | ||
|
||
if [ "$#" -eq 0 ]; then | ||
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" | ||
eval "set -- $versions" | ||
fi | ||
|
||
generated_warning() { | ||
cat <<-EOH | ||
# | ||
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" | ||
# | ||
# PLEASE DO NOT EDIT IT DIRECTLY. | ||
# | ||
EOH | ||
} | ||
|
||
for version; do | ||
export version | ||
|
||
for variant in alpine ubuntu; do | ||
export variant | ||
|
||
echo "processing $version/$variant ..." | ||
|
||
{ | ||
generated_warning | ||
gawk -f "$jqt" "Dockerfile-$variant.template" | ||
} > "$version/$variant/Dockerfile" | ||
|
||
cp -a docker-entrypoint.sh "$version/$variant/" | ||
|
||
if [ "$variant" = 'alpine' ]; then | ||
sed -i -e 's/gosu/su-exec/g' "$version/$variant/docker-entrypoint.sh" | ||
fi | ||
|
||
echo "processing $version/$variant/management ..." | ||
|
||
{ | ||
generated_warning | ||
gawk -f "$jqt" Dockerfile-management.template | ||
} > "$version/$variant/management/Dockerfile" | ||
done | ||
done |