Skip to content

ci: prepare release workflow for Docker Hub OIDC - #1101

Merged
ilopezluna merged 2 commits into
mainfrom
chore/model-runner-dockerhub-oidc
Nov 5, 2026
Merged

ilopezluna merged 2 commits into
mainfrom
chore/model-runner-dockerhub-oidc

Conversation

@ilopezluna

@ilopezluna ilopezluna commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace the static Docker Hub organization access token in the release build with the Docker Hub OIDC connection created for docker/model-runner.
  • Reject release dispatches outside main before creating a tag, matching the OIDC trust policy.
  • Refresh the short-lived Docker Hub login before the later image pushes in this long-running job.
  • Remove the Docker Hub login from the Desktop module idempotency check. Query the public tag API and distinguish a missing tag from a Hub error.

Validation

  • make validate-all
  • actionlint -ignore SC2129 .github/workflows/release.yml (SC2129 is an existing style warning in unrelated inline scripts)
  • Confirmed the public Docker Hub tag endpoint returns 200 for an existing tag and 404 for a missing tag.

OIDC setup

  • Vincent provided Docker Hub connection 441d17e7-3a5b-4783-8d04-f3c072ac96e3 for this workflow.
  • Repository variable DOCKERHUB_OIDC_CONNECTION_ID is set to that ID.

Before merge

  • Verify the connection ruleset grants Image Push on docker/model-runner and Cloud Connect on docker/make-product-smarter for repo:docker/model-runner:ref:refs/heads/main.
  • Verify the OIDC login and Cloud Build access on a release run before deleting ORG_ACCESS_TOKEN.

@ilopezluna
ilopezluna force-pushed the chore/model-runner-dockerhub-oidc branch from d3af0ab to e74f735 Compare November 5, 2026 13:35
@ilopezluna
ilopezluna marked this pull request as ready for review November 5, 2026 13:48

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 4 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/release.yml" line_range="348" />
<code_context>
-          password: ${{ secrets.ORG_ACCESS_TOKEN }}
+        env:
+          DOCKERHUB_OIDC_CONNECTIONID: ${{ vars.DOCKERHUB_OIDC_CONNECTION_ID }}
+          DOCKERHUB_OIDC_EXPIREIN: 3600

       - name: Set up Buildx
</code_context>
<issue_to_address>
**Image pushes lose credentials**

When builds and pushes after a Docker Hub login take more than 3,600 seconds, `docker/login-action`'s token expires before later image pushes, so Docker Hub rejects them and the release leaves only some image variants published.

Refresh the Docker Hub login before its token expires during the build-and-push sequence.

Also at `.github/workflows/release.yml:418-424`.
</issue_to_address>

### Comment 2
<location path=".github/workflows/release.yml" line_range="347" />
<code_context>
           username: "docker"
-          password: ${{ secrets.ORG_ACCESS_TOKEN }}
+        env:
+          DOCKERHUB_OIDC_CONNECTIONID: ${{ vars.DOCKERHUB_OIDC_CONNECTION_ID }}
+          DOCKERHUB_OIDC_EXPIREIN: 3600

</code_context>
<issue_to_address>
**Image publishing stops on non-main refs**

When the workflow is dispatched from a ref other than `refs/heads/main`, `docker/login-action` rejects the OIDC token because the Docker Hub ruleset allows only `repo:docker/model-runner:ref:refs/heads/main`; the `prepare` job has already pushed the release tag, so the run stops before publishing images and leaves an incomplete release.

Restrict this workflow to the allowed main ref or update the Docker Hub ruleset to allow the dispatched ref.
</issue_to_address>

### Comment 3
<location path=".github/workflows/release.yml" line_range="519" />
<code_context>
+              echo "already=true" >> "$GITHUB_OUTPUT"
+              echo "✅ desktop-module:$RELEASE_TAG already exists — skipping trigger"
+              ;;
+            404)
+              echo "already=false" >> "$GITHUB_OUTPUT"
+              ;;
</code_context>
<issue_to_address>
**Concurrent releases duplicate desktop trigger**

When two release runs for the same tag check the public endpoint before either downstream run publishes the module tag, both runs write `already=false`, so both pass the `published` guard and dispatch `release-cli-dd.yml`. The downstream workflows race to re-push the same module tag, and one release fails with Docker Hub's 403.

Serialize release runs for a tag or use an atomic deduplication mechanism before dispatching the downstream release.
</issue_to_address>

### Comment 4
<location path=".github/workflows/release.yml" line_range="511-525" />
<code_context>
-          else
-            echo "already=false" >> "$GITHUB_OUTPUT"
-          fi
+          status=$(curl --silent --show-error --retry 3 --connect-timeout 10 \
+            --max-time 30 --output /dev/null --write-out '%{http_code}' \
+            "https://hub.docker.com/v2/repositories/docker/docker-model-cli-desktop-module/tags/$RELEASE_TAG")
+          case "$status" in
+            200)
+              echo "already=true" >> "$GITHUB_OUTPUT"
+              echo "✅ desktop-module:$RELEASE_TAG already exists — skipping trigger"
+              ;;
+            404)
+              echo "already=false" >> "$GITHUB_OUTPUT"
</code_context>
<issue_to_address>
**Workflow shell escapes ShellCheck**

When the new public-tag lookup is part of the release workflow, an invalid shell construct in this inline `run` block would pass the repository's ShellCheck validation, so CI does not enforce its all-shell-scripts check for this added code.

Extract the lookup into a `.sh` file covered by `make validate`, or add validation for inline workflow shell blocks.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
@ilopezluna
ilopezluna merged commit 5f44daa into main Nov 5, 2026
14 checks passed
@ilopezluna
ilopezluna deleted the chore/model-runner-dockerhub-oidc branch November 5, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants