Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jan 27, 2023

Use the local podman or docker image cache to skip the slow apt step

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 27, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK jamesob

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label Jan 27, 2023
@maflcko maflcko force-pushed the 2301-ci-cache-apt- branch 4 times, most recently from dc9a369 to 48e05b4 Compare January 27, 2023 12:20
@maflcko
Copy link
Member Author

maflcko commented Jan 27, 2023

This isn't used by Cirrus, because I want to test/settle this a bit more.

However, by the one task that runs on my infra, it gives a ~1min speedup: https://cirrus-ci.com/task/5552889800687616

Also, locally it seems to work:

podman image ls --all | grep localhost
localhost/ci_native_fuzz_valgrind              latest        5867fa661f2d  About an hour ago  1.08 GB
localhost/ci_native_tidy                       latest        2196c8dd7b51  2 hours ago        2.03 GB
localhost/ci_native_fuzz_msan                  latest        01047aa4c1ba  7 hours ago        818 MB
localhost/ci_win64                             latest        a21797b76dc0  7 hours ago        2.11 GB
localhost/ci_native_msan                       latest        621b2eb71e9c  8 hours ago        818 MB
localhost/ci_native_qt5                        latest        e8b0920ad207  9 hours ago        910 MB
localhost/ci_native_nowallet_libbitcoinkernel  latest        2af70303446f  10 hours ago       693 MB
localhost/ci_native_fuzz                       latest        31668cc3f135  12 hours ago       989 MB
localhost/ci_macos_cross                       latest        8bf17e6b9640  12 hours ago       526 MB
localhost/ci_i686_centos                       latest        f200c770cd17  13 hours ago       913 MB
localhost/ci_arm_linux                         latest        e8f8098d02d7  14 hours ago       1.34 GB
localhost/ci_native_tsan                       latest        d85e2a3cecb5  15 hours ago       843 MB
localhost/ci_i686_multiprocess                 latest        18f976e245b7  16 hours ago       881 MB
localhost/ci_s390x                             latest        008df12fecb7  17 hours ago       939 MB

@maflcko maflcko force-pushed the 2301-ci-cache-apt- branch from 48e05b4 to fa486de Compare January 28, 2023 16:59
Copy link
Contributor

@jamesob jamesob left a comment

Choose a reason for hiding this comment

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

Concept ACK

COPY ./ci/retry/retry /usr/bin/retry
COPY ./ci/test/00_setup_env.sh ./${FILE_ENV} ./ci/test/01_base_install.sh /ci_base_install/ci/test/

RUN ["bash", "-c", "cd /ci_base_install/ && set -o errexit && source ./ci/test/00_setup_env.sh && ./ci/test/01_base_install.sh"]
Copy link
Contributor

Choose a reason for hiding this comment

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

To get even more of a speedup, wouldn't we want to move these steps into RUN commands earlier in the Dockerfile, and then just generate a few separate images on the basis of CI_IMAGE_NAME_TAG/FILE_ENV?

Copy link
Member Author

Choose a reason for hiding this comment

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

The packages are defined in FILE_ENV, so RUN needs to be after FILE_ENV

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry, shouldn't be reading this before the caffeine has hit; I misread RUN here for ENTRYPOINT.

@jamesob
Copy link
Contributor

jamesob commented Jan 31, 2023

(For what it's worth, I'm an ACK as-is because this PR represents a strict improvement over what we have now.)

--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
--build-arg "FILE_ENV=${FILE_ENV}" \
--tag="${CONTAINER_NAME}" \
"${BASE_ROOT_DIR}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have good confidence that in Cirrus environments, local build caches will persist? If not, we'll hit slowdowns because pulling from registries is about as fast as it gets.

Copy link
Member Author

Choose a reason for hiding this comment

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

Based on the docs, probably yes. Though, this can be investigated in the follow-up that actually switches over Cirrus. For now I've decided to postpone it to have this settle first.

Copy link
Contributor

@jamesob jamesob left a comment

Choose a reason for hiding this comment

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

ACK fa486de (jamesob/ackr/26976.1.MarcoFalke.ci_cache_package_manager)

Ran ./ci/test_run_all.sh, container built successfully. DOCKER_BUILDKIT=1 is cool.

@fanquake
Copy link
Member

fanquake commented Feb 2, 2023

Testing this locally, and it seems to be working as expected.
Building on the first run takes ~70s to build the container:

Creating ubuntu:22.04 container to run in
[+] Building 73.3s (9/9) FINISHED                                                                                                                                                                                   
 => [internal] load build definition from test_imagefile        

Subsequent runs take ~0s:

Creating ubuntu:22.04 container to run in
[+] Building 0.1s (9/9) FINISHED                                                                                                                                                                                    
 => [internal] load build definition from test_imagefile    

@maflcko maflcko merged commit b3ef329 into bitcoin:master Feb 2, 2023
@maflcko maflcko deleted the 2301-ci-cache-apt-🚴 branch February 2, 2023 15:11
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 3, 2023
fa486de ci: Cache package manager install step (MarcoFalke)

Pull request description:

  Use the local podman or docker image cache to skip the slow `apt` step

ACKs for top commit:
  jamesob:
    ACK fa486de ([`jamesob/ackr/26976.1.MarcoFalke.ci_cache_package_manager`](https://github.com/jamesob/bitcoin/tree/ackr/26976.1.MarcoFalke.ci_cache_package_manager))

Tree-SHA512: 3495346c6c862b63296d2691cc492bf52a0a99ee7fae798887c792609904546013eba788045cd508a5f669f2c52e3479c122c18a5275c87af38237a1b5c9da17
@bitcoin bitcoin locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants