-
Notifications
You must be signed in to change notification settings - Fork 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
Create mobile Docker container #190
Conversation
9d7800f
to
f1e393d
Compare
|
||
set -e | ||
|
||
./build_container_ubuntu.sh |
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.
Do we want to just start the base image from the Ubuntu one? That saves time of running this script
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.
Would it actually save time though?
Because the build_container_linux mobile
and build_container_linux ubuntu
CI jobs run in parallel with the current setup, overall CI completes faster than if we waited for build_container_linux ubuntu
to complete and then ran build_container_linux mobile
pulling from what was just built.
In fact, the mobile job only builds for one architecture so it finishes faster than the ubuntu one (28 min vs 38 min), so currently this should really increase the CI wall time, assuming there's no increased queueing.
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.
If you use staged build (within same Dockerfile and mark it mobile) instead of spawning multiple CI jobs, it shouldn't add extra time to CI (max of amd64 ubuntu + mobile, arm64 ubuntu).
That way the images built would share layers so it saves storage and transfer.
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.
+1 re making use of docker layers
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.
Ah ok, got it! I’ll try that.
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.
The Dockerfile part seems pretty straightforward:
# envoy-build-ubuntu
FROM ubuntu:focal AS ubuntu
# Workaround for: https://issuetracker.google.com/issues/216325949
ENV CLOUDSDK_PYTHON=python3
COPY ./build_container_common.sh /
COPY ./build_container_ubuntu.sh /
RUN ./build_container_ubuntu.sh
ENV LANG en_US.utf8
# envoy-build-mobile
FROM ubuntu AS mobile
COPY ./build_container_mobile.sh /
ENV ANDROID_SDK_INSTALL_TARGET /.android
ENV ANDROID_HOME /.android/sdk
ENV ANDROID_SDK_ROOT /.android/sdk
ENV ANDROID_NDK_VERSION 21.4.7075529
ENV ANDROID_NDK_HOME /.android/sdk/ndk/21.4.7075529
RUN ./build_container_mobile.sh
And I can build the multiplatform ubuntu
image with --target ubuntu
and then another amd64-only build for mobile
with --target mobile
which will reuse the layers from the amd64 ubuntu image.
I'm struggling to find a nice way to update docker_build_linux.sh
though. Especially while trying to achieve what @lizan said in his comment, to build amd64 ubuntu + mobile
in parallel with arm64 ubuntu
in the same CI job.
In azure-pipelines.yml
I'm thinking I'd define some targets to build like this:
OS_DISTRO: ubuntu
PUSH_GCR_IMAGE: true
GCR_IMAGE_NAME: envoy-build
DOCKER_TARGETS: "ubuntu mobile"
But then I'm unclear on how I'd adjust the lines that build, tag and push in docker_build_linux.sh
:
ci_log_run docker buildx build . -f "Dockerfile-${OS_DISTRO}" -t "${IMAGE_NAME}:${CONTAINER_TAG}" --platform "${BUILD_TOOLS_PLATFORMS}"
for IMAGE_TAG in "${IMAGE_TAGS[@]}"; do
ci_log_run docker buildx build . -f "Dockerfile-${OS_DISTRO}" -t "${IMAGE_TAG}" --platform "${BUILD_TOOLS_PLATFORMS}" --push
done
@lizan could you please help me get this over the finish line? Envoy's macOS-based mobile CI jobs are pretty constrained right now because we only have 5 machines in the CI pool, so it'd be really nice to be able to migrate some of those jobs to Linux, but having the Android toolchain is a pre-requisite for that, so we can leverage RBE for building Envoy Mobile for Android. Personally I think the PR could be merged as-is, but if you think your comment here is a blocker, I'd like to work with you to achieve that. Thanks! |
@jpsim i can help with this - i think it would make quite a big difference using layers, so worth the effort - certainly it should simplify things once set up the issue i think to doing that atm is the way that the before we do anything i think we need to add some capability for this array to carry information about build targets in the Dockerfile. Once that is done i think it will be pretty straightforward |
Installs Java 8, Android command line tools and SDK. These are used for Envoy Mobile's CI and currently installed on every CI job run: https://github.com/envoyproxy/envoy/blob/main/mobile/ci/linux_ci_setup.sh Signed-off-by: JP Simard <[email protected]>
Co-authored-by: phlax <[email protected]> Signed-off-by: JP Simard <[email protected]>
Signed-off-by: JP Simard <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: JP Simard <[email protected]>
Signed-off-by: JP Simard <[email protected]>
6921776
to
a489868
Compare
Signed-off-by: JP Simard <[email protected]>
Signed-off-by: JP Simard <[email protected]>
Signed-off-by: JP Simard <[email protected]>
I can repro the build failure locally. Going to mark as draft until I get it building locally. |
Signed-off-by: JP Simard <[email protected]>
~should be easyfix i think - just ah - i see it wasnt using the |
It's going to take a while for me to confirm this builds locally, but optimistically flipping back to ready for review since I think I fixed the issue. |
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.
i think this shouldnt affect the main image - and if there is a problem we can revert/fix forward - so if ci passes lets land and publish
/retest |
Windows job failed |
kicked |
[skip ci] Create mobile Docker container (#190) Installs Java 8, Android command line tools and SDK as a Ubuntu image variant (`envoy-build-ubuntu-mobile`). These are used for Envoy Mobile's CI and currently installed on every CI job run: https://github.com/envoyproxy/envoy/blob/main/mobile/ci/linux_ci_setup.sh Signed-off-by: JP Simard <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
[skip ci] Regenerate linux toolchains from 86920c0 [skip ci] Create mobile Docker container (#190) Installs Java 8, Android command line tools and SDK as a Ubuntu image variant (`envoy-build-ubuntu-mobile`). These are used for Envoy Mobile's CI and currently installed on every CI job run: https://github.com/envoyproxy/envoy/blob/main/mobile/ci/linux_ci_setup.sh Signed-off-by: JP Simard <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
This allows us to move the `android_build` CI job from macOS to Linux, freeing up some CI capacity. It also allows us to remove the Java installation step from some other CI jobs since it's now available directly in the docker image the job runs on. Related PRs: * envoyproxy/envoy-build-tools#190 * envoyproxy/envoy-build-tools#197 * envoyproxy/envoy-build-tools#198 Signed-off-by: JP Simard <[email protected]>
Installs Java 8, Android command line tools and SDK.
These are used for Envoy Mobile's CI and currently installed on every CI job run: https://github.com/envoyproxy/envoy/blob/main/mobile/ci/linux_ci_setup.sh