Skip to content

Add initial jq-based templating engine #262

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

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions .architectures-lib

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/verify-templating.yml
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" ]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.jq-template.awk
35 changes: 20 additions & 15 deletions 19.03-rc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM alpine:3.12

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

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

RUN set -eux; \
\
# this "case" statement is generated via "update.sh"
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
# amd64
x86_64) dockerArch='x86_64' ;; \
# arm32v6
armhf) dockerArch='armel' ;; \
# arm32v7
armv7) dockerArch='armhf' ;; \
# arm64v8
aarch64) dockerArch='aarch64' ;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
'x86_64') \
url='https://download.docker.com/linux/static/test/x86_64/docker-19.03.13-beta2.tgz'; \
;; \
'armhf') \
url='https://download.docker.com/linux/static/test/armel/docker-19.03.13-beta2.tgz'; \
;; \
'armv7') \
url='https://download.docker.com/linux/static/test/armhf/docker-19.03.13-beta2.tgz'; \
;; \
'aarch64') \
url='https://download.docker.com/linux/static/test/aarch64/docker-19.03.13-beta2.tgz'; \
;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-${DOCKER_VERSION}.tgz"; then \
echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
exit 1; \
fi; \
wget -O docker.tgz "$url"; \
\
tar --extract \
--file docker.tgz \
Expand Down
25 changes: 11 additions & 14 deletions 19.03-rc/dind-rootless/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM docker:19.03-rc-dind

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

RUN set -eux; \
\
# this "case" statement is generated via "update.sh"
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
# amd64
x86_64) dockerArch='x86_64' ;; \
# arm32v6
armhf) dockerArch='armel' ;; \
# arm32v7
armv7) dockerArch='armhf' ;; \
# arm64v8
aarch64) dockerArch='aarch64' ;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
'x86_64') \
url='https://download.docker.com/linux/static/test/x86_64/docker-rootless-extras-19.03.13-beta2.tgz'; \
;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
if ! wget -O rootless.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-rootless-extras-${DOCKER_VERSION}.tgz"; then \
echo >&2 "error: failed to download 'docker-rootless-extras-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
exit 1; \
fi; \
wget -O rootless.tgz "$url"; \
\
tar --extract \
--file rootless.tgz \
Expand Down
6 changes: 6 additions & 0 deletions 19.03-rc/dind/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM docker:19.03-rc

# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
Expand Down
6 changes: 6 additions & 0 deletions 19.03-rc/git/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM docker:19.03-rc

RUN apk add --no-cache git
35 changes: 20 additions & 15 deletions 19.03/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM alpine:3.12

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

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

RUN set -eux; \
\
# this "case" statement is generated via "update.sh"
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
# amd64
x86_64) dockerArch='x86_64' ;; \
# arm32v6
armhf) dockerArch='armel' ;; \
# arm32v7
armv7) dockerArch='armhf' ;; \
# arm64v8
aarch64) dockerArch='aarch64' ;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
'x86_64') \
url='https://download.docker.com/linux/static/stable/x86_64/docker-19.03.13.tgz'; \
;; \
'armhf') \
url='https://download.docker.com/linux/static/stable/armel/docker-19.03.13.tgz'; \
;; \
'armv7') \
url='https://download.docker.com/linux/static/stable/armhf/docker-19.03.13.tgz'; \
;; \
'aarch64') \
url='https://download.docker.com/linux/static/stable/aarch64/docker-19.03.13.tgz'; \
;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-${DOCKER_VERSION}.tgz"; then \
echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
exit 1; \
fi; \
wget -O docker.tgz "$url"; \
\
tar --extract \
--file docker.tgz \
Expand Down
25 changes: 11 additions & 14 deletions 19.03/dind-rootless/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM docker:19.03-dind

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

RUN set -eux; \
\
# this "case" statement is generated via "update.sh"
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
# amd64
x86_64) dockerArch='x86_64' ;; \
# arm32v6
armhf) dockerArch='armel' ;; \
# arm32v7
armv7) dockerArch='armhf' ;; \
# arm64v8
aarch64) dockerArch='aarch64' ;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
'x86_64') \
url='https://download.docker.com/linux/static/stable/x86_64/docker-rootless-extras-19.03.13.tgz'; \
;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
if ! wget -O rootless.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-rootless-extras-${DOCKER_VERSION}.tgz"; then \
echo >&2 "error: failed to download 'docker-rootless-extras-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
exit 1; \
fi; \
wget -O rootless.tgz "$url"; \
\
tar --extract \
--file rootless.tgz \
Expand Down
6 changes: 6 additions & 0 deletions 19.03/dind/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM docker:19.03

# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
Expand Down
6 changes: 6 additions & 0 deletions 19.03/git/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM docker:19.03

RUN apk add --no-cache git
37 changes: 30 additions & 7 deletions Dockerfile-dind-rootless.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker:%%VERSION%%-dind
FROM docker:{{ env.version }}-dind

# busybox "ip" is insufficient:
# [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
Expand All @@ -15,13 +15,36 @@ RUN set -eux; \

RUN set -eux; \
\
# this "case" statement is generated via "update.sh"
%%ARCH-CASE%%; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
{{
[
.arches | to_entries[]
| select(.value.rootlessExtrasUrl)
| .key as $bashbrewArch
| (
{
amd64: "x86_64",
arm32v6: "armhf",
arm32v7: "armv7",
arm64v8: "aarch64",
}
| .[$bashbrewArch] // $bashbrewArch
) as $apkArch
| .value
| (
-}}
{{ $apkArch | @sh }}) \
url={{ .rootlessExtrasUrl | @sh }}; \
;; \
{{
)
] | add
-}}
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
if ! wget -O rootless.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-rootless-extras-${DOCKER_VERSION}.tgz"; then \
echo >&2 "error: failed to download 'docker-rootless-extras-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
exit 1; \
fi; \
wget -O rootless.tgz "$url"; \
\
tar --extract \
--file rootless.tgz \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile-dind.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker:%%VERSION%%
FROM docker:{{ env.version }}

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

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

RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-git.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM docker:%%VERSION%%
FROM docker:{{ env.version }}

RUN apk add --no-cache git
Loading