Skip to content

Download apk.static from Alpine package repository - #17523

Merged
akoeplinger merged 4 commits into
mainfrom
dev/dkurepa/fix-apk-static-download
Sep 10, 2026
Merged

akoeplinger merged 4 commits into
mainfrom
dev/dkurepa/fix-apk-static-download

Conversation

@dkurepa

@dkurepa dkurepa commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replace the blocked gitlab.alpinelinux.org download of the standalone apk.static binary
  • download apk-tools-static 2.14.4-r1 from Alpine's official CDN and extract sbin/apk.static
  • verify architecture-specific SHA-512 hashes and fail for unsupported host architectures

Validation

Fixes the apk.static Network Isolation failure from prereqs Docker official build 3062691.

Preserve the existing verified download path while allowing callers to provide a pre-acquired apk.static executable.

Co-authored-by: Copilot <[email protected]>
Copilot AI lite review requested due to automatic review settings September 9, 2026 13:55

Copilot AI 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.

🟡 Changes recommended

The Alpine download path can still fail unexpectedly on unrecognized host architectures because it warns but then runs checksum validation with an unset hash.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the eng/common/cross/build-rootfs.sh Alpine rootfs flow to support using a locally provided apk.static binary, avoiding network downloads that can fail in restricted environments (e.g., official pipelines with blocked URIs).

Changes:

  • Add --apk-static <path> option to accept a local apk.static executable.
  • Update Alpine rootfs setup to copy apk.static from the provided path instead of downloading it when the option is used.
File summaries
File Description
eng/common/cross/build-rootfs.sh Adds --apk-static flag and updates Alpine apk.static acquisition logic to support local usage.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread eng/common/cross/build-rootfs.sh Resolved
@akoeplinger

Copy link
Copy Markdown
Member

if I understood the docker prereqs PR correctly you're just switching to a different URL right? why not just make that switch here too?

@dkurepa

dkurepa commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

if I understood the docker prereqs PR correctly you're just switching to a different URL right? why not just make that switch here too?

no, instead of getting the public key from the web, we'll just store it in the repo and pass the local path to it here. We do that for some other keys too

@akoeplinger

Copy link
Copy Markdown
Member

@dkurepa but apk.static is not a public key, it's a 3MB static executable?

@akoeplinger

akoeplinger commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

basically what I'm saying is that we should just fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/apk-tools-static-2.14.4-r1.apk here instead of the version from gitlab (and we could decide to mirror that in our blob storage even)

dkurepa and others added 2 commits September 10, 2026 14:17
Download and verify apk-tools-static from the configured Alpine repository, while retaining the pinned standalone GitLab binary as a download fallback.

Co-authored-by: Copilot <[email protected]>
Remove the legacy standalone download fallback and use the pinned official apk-tools-static package as the single source.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 12:19

Copilot AI 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.

🟡 Changes recommended

The updated Alpine bootstrap currently hard-codes an Alpine repo version, fails confusingly on unsupported host architectures, and the .apk extraction logic is likely incorrect for typical Alpine package structure.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

eng/common/cross/build-rootfs.sh:556

  • For host architectures other than x86_64/aarch64, the script only prints a warning but still runs sha512sum -c with an unset hash, which will fail under set -e anyway. Consider failing fast with a clear error (or skipping verification) to avoid a confusing checksum error.
    else
        echo "WARNING: add missing hash for your host architecture. To find the value, use: 'find /tmp -name apk-tools-static.apk -exec sha512sum {} \;'"
    fi
    echo "$__ApkToolsSHA512SUM $__ApkToolsDir/apk-tools-static.apk" | sha512sum -c

eng/common/cross/build-rootfs.sh:557

  • apk-tools-static-*.apk is an Alpine package; the apk.static binary is stored inside the package payload (data.tar.*), not as a top-level sbin/apk.static entry in the outer archive. Extracting sbin/apk.static directly from the .apk is likely to fail and stop the script (set -e).
    tar -xzf "$__ApkToolsDir/apk-tools-static.apk" -C "$__ApkToolsDir" --strip-components=1 sbin/apk.static
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread eng/common/cross/build-rootfs.sh Resolved
akoeplinger
akoeplinger previously approved these changes Sep 10, 2026
@dkurepa

dkurepa commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

basically what I'm saying is that we should just fetch dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/apk-tools-static-2.14.4-r1.apk here instead of the version from gitlab (and we could decide to mirror that in our blob storage even)

right, I got a bit confused with the changes because there are two issues. I'll push a fix that just changes where we get the apk-tools-static from and that's all we need to do in arcade.

Use the same pinned package acquisition and verification validated by the prereqs Docker pipeline.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 15:29
@dkurepa dkurepa changed the title Allow using a local apk.static for rootfs builds Download apk.static from Alpine package repository Sep 10, 2026

Copilot AI 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.

🟢 Approval recommended

The changes are narrowly scoped, include integrity verification, and the updated flow cleanly replaces the previously blocked download without introducing apparent behavioral regressions in the script logic.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@akoeplinger
akoeplinger merged commit 98c48eb into main Sep 10, 2026
13 checks passed
@akoeplinger
akoeplinger deleted the dev/dkurepa/fix-apk-static-download branch September 10, 2026 17:22
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 11, 2026
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.

3 participants