Skip to content

Commit 4b64616

Browse files
authored
Merge branch 'main' into lelia/v2-release
2 parents c6f0af3 + a49a699 commit 4b64616

4 files changed

Lines changed: 33 additions & 21 deletions

File tree

.github/workflows/_docker-pipeline.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- name: 🔨 Set up Docker Buildx
7171
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
7272

73-
# Logins and metadata are only needed in push mode
73+
# GHCR login runs before the build — needed to pull ghcr.io/astral-sh/uv.
7474
- name: Login to GHCR
7575
if: inputs.push
7676
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
@@ -79,12 +79,11 @@ jobs:
7979
username: ${{ github.actor }}
8080
password: ${{ github.token }}
8181

82-
- name: Login to Docker Hub
83-
if: inputs.push
84-
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
85-
with:
86-
username: ${{ secrets.DOCKERHUB_USERNAME }}
87-
password: ${{ secrets.DOCKERHUB_TOKEN }}
82+
# Docker Hub login is deferred until after the build and tests.
83+
# A repo-scoped Docker Hub token (socketdev/socket-basics only) would cause
84+
# 401s if active during the build, since BuildKit uses it for ALL Docker Hub
85+
# requests including pulling public base images (python, trivy, trufflehog).
86+
# Those public images pull fine without auth; only the push needs credentials.
8887

8988
- name: Extract image metadata
9089
if: inputs.push
@@ -124,6 +123,11 @@ jobs:
124123
BUILD_DATE=${{ github.event.repository.updated_at }}
125124
cache-from: type=gha,scope=${{ inputs.name }}
126125
cache-to: type=gha,mode=max,scope=${{ inputs.name }}
126+
# Disable attestations for the test build — provenance/SBOM cause BuildKit
127+
# to pull docker/buildkit-syft-scanner from Docker Hub, which fails with a
128+
# repo-scoped token. Attestations are enabled on the push step only.
129+
provenance: false
130+
sbom: false
127131

128132
# ── Step 2: Smoke test ─────────────────────────────────────────────────
129133
- name: 🧪 Smoke test
@@ -141,6 +145,16 @@ jobs:
141145
--image-tag ${{ inputs.name }}:pipeline-test
142146
143147
# ── Step 4: Push to registries (publish mode only) ─────────────────────
148+
# Docker Hub login happens here — after build and tests, immediately before
149+
# push. Keeping it here prevents the repo-scoped token from interfering
150+
# with public image pulls during the build step.
151+
- name: Login to Docker Hub
152+
if: inputs.push
153+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
154+
with:
155+
username: ${{ secrets.DOCKERHUB_USERNAME }}
156+
password: ${{ secrets.DOCKERHUB_TOKEN }}
157+
144158
# All layers are in the GHA cache from step 1 — this is just an upload.
145159
- name: 🚀 Push to registries
146160
if: inputs.push
@@ -157,8 +171,11 @@ jobs:
157171
VCS_REF=${{ github.sha }}
158172
BUILD_DATE=${{ github.event.repository.updated_at }}
159173
cache-from: type=gha,scope=${{ inputs.name }}
160-
provenance: true
161-
sbom: true
174+
# SBOM and provenance generation pull docker/buildkit-syft-scanner from
175+
# Docker Hub, which fails with a repo-scoped token. Disabled until a
176+
# token with broader Docker Hub read access is available.
177+
provenance: false
178+
sbom: false
162179

163180
# Floating major version tags (v2 → latest v2.x.y) have been intentionally
164181
# removed. Mutable tags are structurally equivalent to :latest and are

.github/workflows/publish-docker.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ name: publish-docker
55
# Flow: resolve-version → build-test-push → create-release
66
#
77
# Tag convention:
8-
# v2.0.0 — immutable exact release
9-
# v2 — floating, always points to latest v2.x.y
10-
# See docs/github-action.md → "Pinning strategies" for the tradeoff guide.
8+
# v2.0.0 — immutable exact release (floating major tags intentionally not published)
9+
# See docs/github-action.md → "Pinning strategies" for the full rationale.
1110
#
1211
# Required repository secrets:
1312
# DOCKERHUB_USERNAME — Docker Hub account name
@@ -20,7 +19,7 @@ on:
2019
workflow_dispatch:
2120
inputs:
2221
tag:
23-
description: "Version to publish without v prefix (e.g. 2.0.0). Must match an existing git tag."
22+
description: "Full git tag to publish (e.g. v2.0.0 for new releases, 1.1.3 for old). Must exist in the repo."
2423
required: true
2524

2625
# Default: deny everything. Each job below grants only what it needs.
@@ -42,17 +41,17 @@ jobs:
4241
steps:
4342
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4443
with:
45-
ref: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', inputs.tag) || github.ref }}
44+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
4645

4746
- name: 🏷️ Resolve version
4847
id: version
4948
run: |
5049
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
51-
CLEAN="${{ inputs.tag }}" # user provides without v prefix
50+
CLEAN="${{ inputs.tag }}" # full tag as provided (e.g. 1.1.3 or v2.0.0)
5251
else
5352
CLEAN="${{ github.ref_name }}" # e.g. v2.0.0
54-
CLEAN="${CLEAN#v}" # strip leading v → 2.0.0
5553
fi
54+
CLEAN="${CLEAN#v}" # strip leading v if present → 2.0.0 or 1.1.3
5655
echo "clean=$CLEAN" >> "$GITHUB_OUTPUT"
5756
5857
# ── Job 2: Build → test → push ─────────────────────────────────────────────
@@ -61,7 +60,7 @@ jobs:
6160
name: publish (socket-basics)
6261
needs: resolve-version
6362
permissions:
64-
contents: write # force-update the floating major version tag (e.g. v2)
63+
contents: read
6564
packages: write # push images to GHCR
6665
uses: ./.github/workflows/_docker-pipeline.yml
6766
with:

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# syntax=docker/dockerfile:1
2-
31
# ─── Global version pins (single source of truth) ────────────────────────────
42
# Dependabot tracks all ARGs below via the FROM lines that reference them.
53
# To override at build time: docker build --build-arg TRIVY_VERSION=0.70.0 .

app_tests/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# syntax=docker/dockerfile:1
2-
31
# ─── Global version pins (single source of truth) ────────────────────────────
42
# Dependabot tracks all ARGs below via the FROM lines that reference them.
53
# To override at build time: docker build --build-arg TRIVY_VERSION=0.70.0 .

0 commit comments

Comments
 (0)