Skip to content

Commit

Permalink
Let github-file-commit keep timestamp information (instead of throw…
Browse files Browse the repository at this point in the history
…ing the data away)
  • Loading branch information
tianon committed Nov 26, 2024
1 parent 5e2df83 commit c6deafb
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 24 deletions.
20 changes: 16 additions & 4 deletions .libs/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,22 @@ github-file-commit() {

local atom
atom="$(wget -qO- --header 'Accept: application/json' "https://github.com/$repo/commits/$branch/$file.atom")"
local commit
commit="$(jq <<<"$atom" -r '.payload | first(.commitGroups[].commits[].oid)')"
local shell
shell="$(jq <<<"$atom" -r '
first(.payload.commitGroups[].commits[])
| @sh "local commit=\(.oid) date=\(first([ .committedDate, .authoredDate ] | sort | reverse[]))"
')"
eval "$shell"
[ -n "$commit" ] || return 1 # TODO error message?
[ -n "$date" ] || return 1
local unix
unix="$(date --utc --date "$date" '+%s')" || return 1 # TODO error message?

echo >&2 "github $repo - $file: $commit"
echo >&2 "github $repo - $file: $commit ($date -- @$unix)"

jq -nc --arg commit "$commit" '{ version: $commit }'
jq -nc --arg commit "$commit" --arg date "$date" --arg unix "$unix" '{
version: $commit,
$date,
unix: ($unix | tonumber),
}'
}
5 changes: 3 additions & 2 deletions containerd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT 65cfcc28ab37cb75e1560e4b4738719c07c6618e
# https://github.com/docker/docker/commit/65cfcc28ab37cb75e1560e4b4738719c07c6618e -- 2023-11-27T14:48:51.000+01:00 (@1701092931)
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
sh -n /usr/local/bin/dind; \
chmod +x /usr/local/bin/dind

Expand Down
5 changes: 3 additions & 2 deletions containerd/Dockerfile.1.6
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT 65cfcc28ab37cb75e1560e4b4738719c07c6618e
# https://github.com/docker/docker/commit/65cfcc28ab37cb75e1560e4b4738719c07c6618e -- 2023-11-27T14:48:51.000+01:00 (@1701092931)
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
sh -n /usr/local/bin/dind; \
chmod +x /usr/local/bin/dind

Expand Down
5 changes: 3 additions & 2 deletions containerd/Dockerfile.1.7
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT 65cfcc28ab37cb75e1560e4b4738719c07c6618e
# https://github.com/docker/docker/commit/65cfcc28ab37cb75e1560e4b4738719c07c6618e -- 2023-11-27T14:48:51.000+01:00 (@1701092931)
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
sh -n /usr/local/bin/dind; \
chmod +x /usr/local/bin/dind

Expand Down
5 changes: 3 additions & 2 deletions containerd/Dockerfile.rc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT 65cfcc28ab37cb75e1560e4b4738719c07c6618e
# https://github.com/docker/docker/commit/65cfcc28ab37cb75e1560e4b4738719c07c6618e -- 2023-11-27T14:48:51.000+01:00 (@1701092931)
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
sh -n /usr/local/bin/dind; \
chmod +x /usr/local/bin/dind

Expand Down
5 changes: 3 additions & 2 deletions containerd/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT {{ .dind.version }}
# https://github.com/docker/docker/commit/{{ .dind.version }} -- {{ .dind.date }} (@{{ .dind.unix | tostring }})
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
sh -n /usr/local/bin/dind; \
chmod +x /usr/local/bin/dind

Expand Down
4 changes: 3 additions & 1 deletion containerd/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
}
},
"dind": {
"version": "65cfcc28ab37cb75e1560e4b4738719c07c6618e"
"version": "65cfcc28ab37cb75e1560e4b4738719c07c6618e",
"date": "2023-11-27T14:48:51.000+01:00",
"unix": 1701092931
}
}
2 changes: 1 addition & 1 deletion containerd/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ runc="$(
git-tags 'https://github.com/opencontainers/runc.git'
)"

dind="$(github-file-commit 'moby/moby' 'HEAD' 'hack/dind')"
dind="$(github-file-commit 'docker/docker' 'HEAD' 'hack/dind')"

jq <<<"$json" --argjson runc "$runc" --argjson dind "$dind" '
.runc = $runc
Expand Down
5 changes: 3 additions & 2 deletions infosiftr-moby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ RUN set -eux; \
echo 'dockremap:165536:65536' >> /etc/subuid; \
echo 'dockremap:165536:65536' >> /etc/subgid

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT 65cfcc28ab37cb75e1560e4b4738719c07c6618e
# https://github.com/docker/docker/commit/65cfcc28ab37cb75e1560e4b4738719c07c6618e -- 2023-11-27T14:48:51.000+01:00 (@1701092931)
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind

COPY dockerd-entrypoint.sh /usr/local/bin/
Expand Down
5 changes: 3 additions & 2 deletions infosiftr-moby/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ RUN set -eux; \
echo 'dockremap:165536:65536' >> /etc/subuid; \
echo 'dockremap:165536:65536' >> /etc/subgid

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT {{ .dind.version }}
# https://github.com/docker/docker/commit/{{ .dind.version }} -- {{ .dind.date }} (@{{ .dind.unix | tostring }})
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind

COPY dockerd-entrypoint.sh /usr/local/bin/
Expand Down
5 changes: 3 additions & 2 deletions infosiftr-moby/Dockerfile.unstable
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ RUN set -eux; \
echo 'dockremap:165536:65536' >> /etc/subuid; \
echo 'dockremap:165536:65536' >> /etc/subgid

# https://github.com/docker/docker/tree/master/hack/dind
# https://github.com/docker/docker/tree/HEAD/hack/dind
ENV DIND_COMMIT 65cfcc28ab37cb75e1560e4b4738719c07c6618e
# https://github.com/docker/docker/commit/65cfcc28ab37cb75e1560e4b4738719c07c6618e -- 2023-11-27T14:48:51.000+01:00 (@1701092931)
RUN set -eux; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
wget -O /usr/local/bin/dind "https://github.com/docker/docker/raw/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind

COPY dockerd-entrypoint.sh /usr/local/bin/
Expand Down
4 changes: 3 additions & 1 deletion infosiftr-moby/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
}
},
"dind": {
"version": "65cfcc28ab37cb75e1560e4b4738719c07c6618e"
"version": "65cfcc28ab37cb75e1560e4b4738719c07c6618e",
"date": "2023-11-27T14:48:51.000+01:00",
"unix": 1701092931
},
"version": "23.0.15",
"variants": [
Expand Down
2 changes: 1 addition & 1 deletion infosiftr-moby/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for suite in \
done
done

dind="$(github-file-commit 'moby/moby' 'HEAD' 'hack/dind')"
dind="$(github-file-commit 'docker/docker' 'HEAD' 'hack/dind')"

jq <<<"$json" --argjson dind "$dind" '
def upstream_version:
Expand Down

0 comments on commit c6deafb

Please sign in to comment.