Repository navigation
Conversation
… NDK opt-in - sdk stage builds the Android SDK on a fixed JDK (SDK_JAVA_VERSION) and is copied in right on top of the base image, before the shared apt layer, the JDK and Node, so the SDK layer is the same for every JDK/Node tag - one apt layer for the tag-independent packages (iproute2, cmake, build-essential, swig, xxd, pigz) with the apt lists removed - ndk and cmake;3.22.1 move to the opt-in runner-ndk target; runner stays the last stage and is the default - COMPILE_SDK 36.1 -> 37.0 (stable) - COPY --chmod instead of a separate chmod layer Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… upstream sync Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
|
folded into the combined refactor PR |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Dockerfile-only restructure (workstream W1). Contract C2 holds: ARG names
VERSION,JAVA_VERSION,NODE_VERSION,COMPILE_SDK,BUILD_TOOLS,NDK_VERSION,RUNNER_IMAGE_TAG,RUNNER_IMAGE_REVISIONare unchanged;runneris the default and the last stage;runner-ndkis opt-in. Refs #17.sdkstage: cmdline-tools + sdkmanager (retry loop kept, now a smallsdk-installhelper shared with the ndk stage) on a fixed JDK (ARG SDK_JAVA_VERSION=21,eclipse-temurin:21-jdk-noble). It only seesCOMPILE_SDK,BUILD_TOOLS,SDK_TOOLS, so a JDK/Node bump does not touch it.COPY --from=sdkstraight onto the base image, then one apt layer for tag-independent packages (iproute2 cmake build-essential swig xxd pigz, lists removed), then the Temurin layer, then the NodeSource layer.xxd;pigzis 1 small package.runner-ndktarget:ndk;${NDK_VERSION}andcmake;3.22.1are installed in a separatesdk-ndkstage into their own sdk root, so only the delta (ndk/,cmake/) is copied ontocore(no second copy of the SDK). The aptcmakepackage stays in both.COPY --chmod=755for hooks/pruner/preflight replaces the extrachmodRUN layers. TAR_OPTIONS, MISE/HK env, hook ENVs, preflight ENTRYPOINT/CMD and the image-identity ARGs are unchanged and still last.JAVA_VERSION/NODE_VERSION/TARGETARCHare declared below the shared layers on purpose: a build arg is part of the cache key of every RUN after its ARG, and with them at the top the common apt layer was rebuilt and re-hashed per JDK (I saw this in the first iteration).Sizes (linux/amd64,
docker image inspect -f '{{.Size}}', uncompressed)mainDockerfile (SDK 36.1 + NDK + cmake 3.22.1, JDK 21)--target runner(JDK 21)--target runner(JDK 17)--target runner(JDK 27)--target runner-ndk(JDK 21)The SDK without NDK/cmake is only ~430 MB; the NDK + cmake delta is ~2.4 GB, and it is what #17 asked to stop shipping to everyone. A plain
docker build .givesrunner(same image id as--target runner).SDK layer is the same for every JDK
RootFS.Layers[9](theCOPY --from=sdklayer) and[10](shared apt layer) for JDK 17 / 21 / 27 (Node 24):Layers 0-10 are identical, only the JDK layer onwards differs.
runner-ndkhas the same 20 layers asrunner+ 2 (ndk, cmake); layers 0-17 matchrunner.Caveat for W2 (CI): that identity comes from one BuildKit cache. Two independent builds on different runners would re-run the
sdkstage and produce different bytes (sdkmanager writes build-time mtimes), so the SDK layer is only shared if the matrix builds share the cache (cache-from/cache-toon the registry or gha) or build/push thesdkstage once first. Clamping mtimes withSOURCE_DATE_EPOCH+rewrite-timestamp=trueshould make it reproducible without a shared cache, but I did not test that.Smoke tests (JDK 21, JDK 27 and runner-ndk)
All passed:
java -version(Temurin 21.0.12.1 / 27),javac,node -v(v24.22.0),JAVA_HOMEexists and$JAVA_HOME/bin/javais executable,xxd -v(2023-10-25),flock -V(util-linux 2.39.3),pigz 2.8,ip -V,cmake 3.28.3(apt),sdkmanager --list_installed:build-tools;37.0.0,platform-tools 37.0.1,platforms;android-37.0ndk;30.0.16248370+cmake;3.22.1Hooks are
-rwxr-xr-x,TAR_OPTIONS,MISE_*,HK_*,ACTIONS_RUNNER_HOOK_*andRUNNER_IMAGE_*env are present, workdir is/actions-runner, ENTRYPOINT/CMD unchanged. The embeddedsdk-installscript passesshellcheck -s sh, and I ran it against a fakesdkmanagerthat fails once: it retried and succeeded on attempt 2.Platform 37: stable, and why
check-sdk-updates.ymlnever proposed it (note for W2)From
repository2-3.xml(checked today):platforms;android-37.0(rev 2),android-37.1andandroid-37.2are all stable:channel-0,uses-license ref="android-sdk-license"(not the preview license), not obsolete, and the codename element is empty (<codename />). Only the-beta1/2/3packages carry a real codename (CinnamonBun/DEV). So I setCOMPILE_SDK=37.0(matches the consumers' compileSdk 37).37.1/37.2also exist if consumers later need the minor releases.Why the workflow skipped it:
is_preview()in the "Check for Android SDK updates" step returns True when any descendant element has the local tagcodename:It tests for the element's presence, not for non-empty text. Google writes an empty
<codename />on stable platforms from 37.0 on (older ones such as 36 / 36.1 have no such element at all), so 37.0, 37.1 and 37.2 are all classed as preview and dropped;latest()then settled on 36.1, which equals the current value, so no PR was ever opened. Fix for W2:if local(e.tag) == 'codename' and (e.text or '').strip(): return True. Also worth a check on thelatest()regex:platforms;android-(\d+(?:\.\d+)?)accepts37.2but ignores-extNN/-betaN, which is what we want.Heads-up: the stable platform dir is
platforms/android-37.0, notandroid-37. I did not run a Gradle build against it; consumers withcompileSdk = 37on a current AGP should resolve it, but the first real consumer build is the check. Also, once the workflow is fixed it will propose 37.2 next.Other notes
eclipse-temurin:21-jdk-noble(sdk stages only, never in the final image). Renovate can track it.--target runnernever buildssdk-ndk(BuildKit skips unreferenced stages).dl.google.com,packages.adoptium.net,deb.nodesource.comare unchanged.🤖 Generated with Claude Code