-
Notifications
You must be signed in to change notification settings - Fork 1
Develop macos arm docker #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+45
−19
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ae46665
Allow publish workflow to build from branch without a release tag
t0mdavid-m 323b3fe
Temporarily disable amd64 build and manifest for arm64-only test
t0mdavid-m 18617af
Fix multi-arch manifest creation and Redis ARM64 startup
t0mdavid-m 5451218
Temporarily disable amd64 and manifest for arm64-only test build
t0mdavid-m b1c6a43
Re-enable amd64 build and manifest creation
t0mdavid-m 84cf134
Fix Docker token leak, add CI disk cleanup, update PATH and actions
t0mdavid-m 15b03a4
Sanitize VERSION for valid Docker tags in publish workflow
t0mdavid-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ on: | |
| inputs: | ||
| tag: | ||
| description: 'Release tag to build (e.g., v0.9.15)' | ||
| required: true | ||
| required: false | ||
|
|
||
| jobs: | ||
|
|
||
|
|
@@ -31,15 +31,23 @@ jobs: | |
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| TAG="${{ github.event.inputs.tag }}" | ||
| SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.sha') | ||
| if [ -n "$TAG" ]; then | ||
| SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.sha') | ||
| VERSION="${TAG#v}" | ||
| else | ||
| # No tag — build from branch HEAD | ||
| SHA="${{ github.sha }}" | ||
| VERSION="${{ github.ref_name }}" | ||
| fi | ||
| else | ||
| # workflow_run: get the tag from the head branch (release events set head_branch to the tag) | ||
| TAG="${{ github.event.workflow_run.head_branch }}" | ||
| SHA="${{ github.event.workflow_run.head_sha }}" | ||
| VERSION="${TAG#v}" | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Strip leading 'v' for version | ||
| VERSION="${TAG#v}" | ||
| # Sanitize VERSION for valid Docker tags: replace / with -, strip invalid chars | ||
| VERSION=$(echo "$VERSION" | tr '/' '-' | tr -cd 'A-Za-z0-9_.-') | ||
|
Comment on lines
+49
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fail fast when sanitized After Line 50, 🔧 Proposed fix # Sanitize VERSION for valid Docker tags: replace / with -, strip invalid chars
VERSION=$(echo "$VERSION" | tr '/' '-' | tr -cd 'A-Za-z0-9_.-')
+ if [ -z "$VERSION" ]; then
+ echo "::error::Resolved VERSION is empty after sanitization"
+ exit 1
+ fi
+ if [ ${`#VERSION`} -gt 128 ]; then
+ echo "::error::Resolved VERSION exceeds 128 characters (${`#VERSION`})"
+ exit 1
+ fiAlso applies to: 52-54 🤖 Prompt for AI Agents |
||
|
|
||
| echo "Resolved tag=${TAG} version=${VERSION} sha=${SHA}" | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
|
|
@@ -82,6 +90,7 @@ jobs: | |
| file: Dockerfile | ||
| push: true | ||
| tags: ${{ env.IMAGE }}:${{ needs.resolve-tag.outputs.version }}-amd64 | ||
| provenance: false | ||
| build-args: | | ||
| GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | ||
| cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache-amd64 | ||
|
|
@@ -124,6 +133,7 @@ jobs: | |
| file: Dockerfile.arm | ||
| push: true | ||
| tags: ${{ env.IMAGE }}:${{ needs.resolve-tag.outputs.version }}-arm64 | ||
| provenance: false | ||
| build-args: | | ||
| GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | ||
| cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache-arm64 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: OpenMS/FLASHApp
Length of output: 208
🌐 Web query:
GitHub REST API git/ref/tags annotated tags object.type object.sha💡 Result:
In the GitHub REST API, git/refs/tags refer to references under refs/tags/, accessed via endpoints like GET /repos/{owner}/{repo}/git/refs/tags/{tag} or matching refs. For annotated tags (the only type supported by the Git tags API), the ref's object has type "tag" and sha pointing to the annotated tag object SHA. To create an annotated tag: 1. POST /repos/{owner}/{repo}/git/tags to create the tag object, providing "object" (SHA of the target commit/tree/blob) and "type" ("commit", "tree", or "blob"). The response includes the new tag object's sha. 2. POST /repos/{owner}/{repo}/git/refs with "ref": "refs/tags/{tagname}" and "sha": {tag_object_sha}. Example creation request: { "tag": "v0.0.1", "message": "initial version", "object": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", "type": "commit", ... } The tag object response includes its own "sha" (tag SHA), "object.sha" (target SHA), and "object.type". For a refs/tags/{tag} response: {"object": {"type": "tag", "sha": "{tag_sha}"}}. To get the tagged object's SHA/type, GET the tag object at /repos/{owner}/{repo}/git/tags/{tag_sha}, which has "object": {"type": "...", "sha": "..."}.
Citations:
Resolve annotated tags to commit SHA before exporting
sha.On Line 35,
.object.shafromgit/ref/tags/{tag}returns a tag object SHA for annotated tags, not a commit SHA. While the repository currently has no annotated tags, using a tag object SHA in the checkout at Line 74/117 viaref: needs.resolve-tag.outputs.shawill fail if annotated tags are created. The code should handle both annotated and lightweight tags.🔧 Proposed fix
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then TAG="${{ github.event.inputs.tag }}" if [ -n "$TAG" ]; then - SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.sha') + REF_TYPE=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.type') + REF_SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.sha') + if [ "$REF_TYPE" = "tag" ]; then + SHA=$(gh api repos/${{ github.repository }}/git/tags/${REF_SHA} --jq '.object.sha') + else + SHA="$REF_SHA" + fi VERSION="${TAG#v}"🤖 Prompt for AI Agents