Skip to content

Commit 4deb12d

Browse files
ci: address Copilot review on release workflow
- Use github.sha for checkout/build/cut-release refs instead of the invalid github.event.push.head.sha (empty on push events). - Enable flakes via NIX_CONFIG for the whole nix-cache step so the kup build and its internal builds don't depend on flakes being globally enabled on the runner. - check-cachix-pin.sh: tolerate transient pin-API errors (|| true + empty-response guard) so set -e no longer defeats the retry loop. - Dockerfile: --no-install-recommends + drop apt lists, COPY instead of ADD, and pip install --no-cache-dir --user to keep the image lean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a9cb12a commit 4deb12d

3 files changed

Lines changed: 32 additions & 17 deletions

File tree

.github/scripts/check-cachix-pin.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ PIN_VISIBILITY_TIMEOUT_SECONDS=120 # 2 minutes
4949
PIN_VISIBILITY_INTERVAL_SECONDS=5 # 5 seconds
5050
PIN_VISIBILITY_ATTEMPTS=$((PIN_VISIBILITY_TIMEOUT_SECONDS / PIN_VISIBILITY_INTERVAL_SECONDS))
5151
for i in $(seq 1 "$PIN_VISIBILITY_ATTEMPTS"); do
52-
PIN_JSON="$(curl -fsSL "${PIN_API_URL}?q=${REV}")"
52+
# `|| true` keeps `set -e` from aborting the whole script on a transient
53+
# network/API hiccup: an empty/failed response is treated as not-ready and
54+
# retried, rather than failing the release outright.
55+
PIN_JSON="$(curl -fsSL "${PIN_API_URL}?q=${REV}" || true)"
56+
if [ -z "$PIN_JSON" ]; then
57+
printf 'cachix-check-attempt-%s: pin-api-unreachable, retrying in %ss\n' "$i" "$PIN_VISIBILITY_INTERVAL_SECONDS" | summary_and_log
58+
sleep "$PIN_VISIBILITY_INTERVAL_SECONDS"
59+
continue
60+
fi
5361
ALL_OK=1
5462

5563
for PKG in "${CHECK_PACKAGES[@]}"; do

.github/workflows/release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: 'Check out code'
4040
uses: actions/checkout@v4
4141
with:
42-
ref: ${{ github.event.push.head.sha }}
42+
ref: ${{ github.sha }}
4343
fetch-depth: 0
4444

4545
# Build the komet-node derivation once, then push it to both the public
@@ -51,14 +51,18 @@ jobs:
5151
uses: workflow/nix-shell-action@v3
5252
env:
5353
GC_DONT_GC: '1'
54+
# Enable flakes for every nix invocation in this step (the initial
55+
# build, the kup build, and the builds kup runs internally) so the
56+
# job does not depend on flakes being globally enabled on the runner.
57+
NIX_CONFIG: 'extra-experimental-features = nix-command flakes'
5458
CACHIX_PUBLIC_TOKEN: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'
5559
CACHIX_PRIVATE_KFB_TOKEN: '${{ secrets.CACHIX_PRIVATE_KFB_TOKEN }}'
5660
OWNER_REPO: '${{ github.repository }}'
5761
REV: '${{ github.sha }}'
5862
with:
5963
packages: jq
6064
script: |
61-
KOMET_NODE=$(nix build --extra-experimental-features 'nix-command flakes' .#komet-node --json | jq -r '.[].outputs | to_entries[].value')
65+
KOMET_NODE=$(nix build .#komet-node --json | jq -r '.[].outputs | to_entries[].value')
6266
DRV=$(nix-store --query --deriver ${KOMET_NODE})
6367
6468
# Push the full build closure to the public k-framework cache.
@@ -93,7 +97,7 @@ jobs:
9397
- name: 'Check out code'
9498
uses: actions/checkout@v4
9599
with:
96-
ref: ${{ github.event.push.head.sha }}
100+
ref: ${{ github.sha }}
97101
fetch-depth: 0
98102

99103
- name: 'Set environment'
@@ -135,7 +139,7 @@ jobs:
135139
- name: 'Check out code'
136140
uses: actions/checkout@v4
137141
with:
138-
ref: ${{ github.event.push.head.sha }}
142+
ref: ${{ github.sha }}
139143
fetch-depth: 0
140144

141145
- name: 'Finalize Release'

Dockerfile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ FROM runtimeverificationinc/kframework-k:ubuntu-jammy-${K_VERSION}
1313

1414
ARG PYTHON_VERSION=3.10
1515

16-
RUN apt-get -y update \
17-
&& apt-get -y install \
18-
curl \
19-
git \
20-
graphviz \
21-
python${PYTHON_VERSION} \
22-
python${PYTHON_VERSION}-dev \
23-
python3-pip \
24-
wabt \
25-
&& apt-get -y clean
16+
RUN apt-get -y update \
17+
&& apt-get -y install --no-install-recommends \
18+
curl \
19+
git \
20+
graphviz \
21+
python${PYTHON_VERSION} \
22+
python${PYTHON_VERSION}-dev \
23+
python3-pip \
24+
wabt \
25+
&& apt-get -y clean \
26+
&& rm -rf /var/lib/apt/lists/*
2627

2728
ARG USER_ID=1010
2829
ARG GROUP_ID=1010
@@ -32,12 +33,14 @@ RUN groupadd -g ${GROUP_ID} user \
3233
USER user
3334
WORKDIR /home/user
3435

35-
ADD --chown=user:user . komet-node
36+
COPY --chown=user:user . komet-node
3637

3738
ENV PATH=/home/user/.local/bin:${PATH}
3839
# Installs komet-node together with its dependencies (the `komet` package, which
3940
# carries the Soroban K semantics source, and the matching `kframework` pyk).
40-
RUN pip install ./komet-node \
41+
# `--user` installs into ~/.local (already on PATH) and `--no-cache-dir` keeps
42+
# pip's download cache out of the image layer.
43+
RUN pip install --no-cache-dir --user ./komet-node \
4144
&& rm -rf komet-node
4245

4346
# Pre-kompile the K semantics so the container is ready to serve immediately.

0 commit comments

Comments
 (0)