chore: Only check the bootstrap daemon checksum on release.

It's pure toil until then. It's only interesting as part of the release
checklist, not in regular PRs.
This commit is contained in:
iphydf 2024-01-31 18:08:56 +00:00
parent f70e588bc6
commit 8d29935b7a
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
3 changed files with 8 additions and 4 deletions

View File

@ -3,10 +3,11 @@
set -exu -o pipefail
LOCAL="${1:-}"
CHECK="${2:-}"
readarray -t FILES <<<"$(git ls-files)"
if ! tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node - 2>&1 | tee docker-build.log; then
if ! tar c "${FILES[@]}" | docker build --build-arg="CHECK=$CHECK" -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node - 2>&1 | tee docker-build.log; then
grep -o "::error.*::[a-f0-9]* /usr/local/bin/tox-bootstrapd" docker-build.log
false
fi

View File

@ -25,7 +25,9 @@ jobs:
with:
submodules: recursive
- name: Docker Build
run: .github/scripts/tox-bootstrapd-docker local
run: .github/scripts/tox-bootstrapd-docker local "$CHECK"
env:
CHECK: "${{ contains(github.event.pull_request.title, 'chore: Release ') && 'sha256sum' || 'echo' }}"
- name: Push latest image to DockerHub
if: ${{ github.event_name == 'push' }}
run: docker push toxchat/bootstrap-node:latest

View File

@ -48,8 +48,9 @@ RUN CC=clang cmake -B_build -H. \
# Verify checksum from dev-built binary, so we can be sure Docker Hub doesn't
# mess with your binaries.
COPY other/bootstrap_daemon/docker/tox-bootstrapd.sha256 other/bootstrap_daemon/docker/
RUN SHA256="$(sha256sum /usr/local/bin/tox-bootstrapd)" && \
(sha256sum -c other/bootstrap_daemon/docker/tox-bootstrapd.sha256 || \
ARG CHECK=sha256sum
RUN SHA256="$("$CHECK" /usr/local/bin/tox-bootstrapd)" && \
("$CHECK" -c other/bootstrap_daemon/docker/tox-bootstrapd.sha256 || \
(echo "::error file=other/bootstrap_daemon/docker/tox-bootstrapd.sha256,line=1::$SHA256" && \
false))