Skip to content

Commit 12d1c27

Browse files
committed
Add initial jq-based templating engine
1 parent 66c83a5 commit 12d1c27

21 files changed

+489
-357
lines changed

.architectures-lib

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Verify Templating
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
defaults:
8+
run:
9+
shell: 'bash -Eeuo pipefail -x {0}'
10+
11+
jobs:
12+
apply-templates:
13+
name: Check For Uncomitted Changes
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Apply Templates
18+
run: ./apply-templates.sh
19+
- name: Check Git Status
20+
run: |
21+
status="$(git status --short)"
22+
[ -z "$status" ]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.jq-template.awk

19.03-rc/Dockerfile

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM alpine:3.12
28

39
RUN apk add --no-cache \
@@ -11,32 +17,31 @@ RUN apk add --no-cache \
1117
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
1218
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
1319

14-
ENV DOCKER_CHANNEL test
1520
ENV DOCKER_VERSION 19.03.13-beta2
1621
# TODO ENV DOCKER_SHA256
1722
# https://github.com/docker/docker-ce/blob/5b073ee2cf564edee5adca05eee574142f7627bb/components/packaging/static/hash_files !!
1823
# (no SHA file artifacts on download.docker.com yet as of 2017-06-07 though)
1924

2025
RUN set -eux; \
2126
\
22-
# this "case" statement is generated via "update.sh"
2327
apkArch="$(apk --print-arch)"; \
2428
case "$apkArch" in \
25-
# amd64
26-
x86_64) dockerArch='x86_64' ;; \
27-
# arm32v6
28-
armhf) dockerArch='armel' ;; \
29-
# arm32v7
30-
armv7) dockerArch='armhf' ;; \
31-
# arm64v8
32-
aarch64) dockerArch='aarch64' ;; \
33-
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
29+
'x86_64') \
30+
url='https://download.docker.com/linux/static/test/x86_64/docker-19.03.13-beta2.tgz'; \
31+
;; \
32+
'armhf') \
33+
url='https://download.docker.com/linux/static/test/armel/docker-19.03.13-beta2.tgz'; \
34+
;; \
35+
'armv7') \
36+
url='https://download.docker.com/linux/static/test/armhf/docker-19.03.13-beta2.tgz'; \
37+
;; \
38+
'aarch64') \
39+
url='https://download.docker.com/linux/static/test/aarch64/docker-19.03.13-beta2.tgz'; \
40+
;; \
41+
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
3442
esac; \
3543
\
36-
if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-${DOCKER_VERSION}.tgz"; then \
37-
echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
38-
exit 1; \
39-
fi; \
44+
wget -O docker.tgz "$url"; \
4045
\
4146
tar --extract \
4247
--file docker.tgz \

19.03-rc/dind-rootless/Dockerfile

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM docker:19.03-rc-dind
28

39
# busybox "ip" is insufficient:
@@ -15,24 +21,15 @@ RUN set -eux; \
1521

1622
RUN set -eux; \
1723
\
18-
# this "case" statement is generated via "update.sh"
1924
apkArch="$(apk --print-arch)"; \
2025
case "$apkArch" in \
21-
# amd64
22-
x86_64) dockerArch='x86_64' ;; \
23-
# arm32v6
24-
armhf) dockerArch='armel' ;; \
25-
# arm32v7
26-
armv7) dockerArch='armhf' ;; \
27-
# arm64v8
28-
aarch64) dockerArch='aarch64' ;; \
29-
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
26+
'x86_64') \
27+
url='https://download.docker.com/linux/static/test/x86_64/docker-rootless-extras-19.03.13-beta2.tgz'; \
28+
;; \
29+
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
3030
esac; \
3131
\
32-
if ! wget -O rootless.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-rootless-extras-${DOCKER_VERSION}.tgz"; then \
33-
echo >&2 "error: failed to download 'docker-rootless-extras-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
34-
exit 1; \
35-
fi; \
32+
wget -O rootless.tgz "$url"; \
3633
\
3734
tar --extract \
3835
--file rootless.tgz \

19.03-rc/dind/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM docker:19.03-rc
28

39
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies

19.03-rc/git/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM docker:19.03-rc
28

39
RUN apk add --no-cache git

19.03/Dockerfile

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM alpine:3.12
28

39
RUN apk add --no-cache \
@@ -11,32 +17,31 @@ RUN apk add --no-cache \
1117
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
1218
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
1319

14-
ENV DOCKER_CHANNEL stable
1520
ENV DOCKER_VERSION 19.03.13
1621
# TODO ENV DOCKER_SHA256
1722
# https://github.com/docker/docker-ce/blob/5b073ee2cf564edee5adca05eee574142f7627bb/components/packaging/static/hash_files !!
1823
# (no SHA file artifacts on download.docker.com yet as of 2017-06-07 though)
1924

2025
RUN set -eux; \
2126
\
22-
# this "case" statement is generated via "update.sh"
2327
apkArch="$(apk --print-arch)"; \
2428
case "$apkArch" in \
25-
# amd64
26-
x86_64) dockerArch='x86_64' ;; \
27-
# arm32v6
28-
armhf) dockerArch='armel' ;; \
29-
# arm32v7
30-
armv7) dockerArch='armhf' ;; \
31-
# arm64v8
32-
aarch64) dockerArch='aarch64' ;; \
33-
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
29+
'x86_64') \
30+
url='https://download.docker.com/linux/static/stable/x86_64/docker-19.03.13.tgz'; \
31+
;; \
32+
'armhf') \
33+
url='https://download.docker.com/linux/static/stable/armel/docker-19.03.13.tgz'; \
34+
;; \
35+
'armv7') \
36+
url='https://download.docker.com/linux/static/stable/armhf/docker-19.03.13.tgz'; \
37+
;; \
38+
'aarch64') \
39+
url='https://download.docker.com/linux/static/stable/aarch64/docker-19.03.13.tgz'; \
40+
;; \
41+
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
3442
esac; \
3543
\
36-
if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-${DOCKER_VERSION}.tgz"; then \
37-
echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
38-
exit 1; \
39-
fi; \
44+
wget -O docker.tgz "$url"; \
4045
\
4146
tar --extract \
4247
--file docker.tgz \

19.03/dind-rootless/Dockerfile

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM docker:19.03-dind
28

39
# busybox "ip" is insufficient:
@@ -15,24 +21,15 @@ RUN set -eux; \
1521

1622
RUN set -eux; \
1723
\
18-
# this "case" statement is generated via "update.sh"
1924
apkArch="$(apk --print-arch)"; \
2025
case "$apkArch" in \
21-
# amd64
22-
x86_64) dockerArch='x86_64' ;; \
23-
# arm32v6
24-
armhf) dockerArch='armel' ;; \
25-
# arm32v7
26-
armv7) dockerArch='armhf' ;; \
27-
# arm64v8
28-
aarch64) dockerArch='aarch64' ;; \
29-
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
26+
'x86_64') \
27+
url='https://download.docker.com/linux/static/stable/x86_64/docker-rootless-extras-19.03.13.tgz'; \
28+
;; \
29+
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
3030
esac; \
3131
\
32-
if ! wget -O rootless.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-rootless-extras-${DOCKER_VERSION}.tgz"; then \
33-
echo >&2 "error: failed to download 'docker-rootless-extras-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
34-
exit 1; \
35-
fi; \
32+
wget -O rootless.tgz "$url"; \
3633
\
3734
tar --extract \
3835
--file rootless.tgz \

19.03/dind/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM docker:19.03
28

39
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies

19.03/git/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM docker:19.03
28

39
RUN apk add --no-cache git

Dockerfile-dind-rootless.template

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker:%%VERSION%%-dind
1+
FROM docker:{{ env.version }}-dind
22

33
# busybox "ip" is insufficient:
44
# [rootlesskit:child ] error: executing [[ip tuntap add name tap0 mode tap] [ip link set tap0 address 02:50:00:00:00:01]]: exit status 1
@@ -15,13 +15,36 @@ RUN set -eux; \
1515

1616
RUN set -eux; \
1717
\
18-
# this "case" statement is generated via "update.sh"
19-
%%ARCH-CASE%%; \
18+
apkArch="$(apk --print-arch)"; \
19+
case "$apkArch" in \
20+
{{
21+
[
22+
.arches | to_entries[]
23+
| select(.value.rootlessExtrasUrl)
24+
| .key as $bashbrewArch
25+
| (
26+
{
27+
amd64: "x86_64",
28+
arm32v6: "armhf",
29+
arm32v7: "armv7",
30+
arm64v8: "aarch64",
31+
}
32+
| .[$bashbrewArch] // $bashbrewArch
33+
) as $apkArch
34+
| .value
35+
| (
36+
-}}
37+
{{ $apkArch | @sh }}) \
38+
url={{ .rootlessExtrasUrl | @sh }}; \
39+
;; \
40+
{{
41+
)
42+
] | add
43+
-}}
44+
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
45+
esac; \
2046
\
21-
if ! wget -O rootless.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-rootless-extras-${DOCKER_VERSION}.tgz"; then \
22-
echo >&2 "error: failed to download 'docker-rootless-extras-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
23-
exit 1; \
24-
fi; \
47+
wget -O rootless.tgz "$url"; \
2548
\
2649
tar --extract \
2750
--file rootless.tgz \

Dockerfile-dind.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker:%%VERSION%%
1+
FROM docker:{{ env.version }}
22

33
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
44
RUN set -eux; \
@@ -31,7 +31,7 @@ RUN set -x \
3131
&& echo 'dockremap:165536:65536' >> /etc/subgid
3232

3333
# https://github.com/docker/docker/tree/master/hack/dind
34-
ENV DIND_COMMIT %%DIND-COMMIT%%
34+
ENV DIND_COMMIT {{ .dindCommit }}
3535

3636
RUN set -eux; \
3737
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \

Dockerfile-git.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM docker:%%VERSION%%
1+
FROM docker:{{ env.version }}
22

33
RUN apk add --no-cache git

0 commit comments

Comments
 (0)