Uploaded image for project: 'Machine Config Operator'
  1. Machine Config Operator
  2. MCO-1117

Make local MCO image builds faster

XMLWordPrintable

    • 3
    • False
    • None
    • False
    • 3
    • MCO Sprint 251, MCO Sprint 252
    • 0
    • 0.000

      During my work on Project Labrador, I learned that there are advanced caching directives that one can add to their Containerfiles. These do things such as allowing the package manager cache be kept out of the image build, but to remain after the build so that subsequent builds don't have to download the packages. Golang has a great incremental build story as well, provided that one leaves the caches intact.

      To begin with, my Red Hat-issued ThinkPad P16v takes approximately 2 minutes and 42 seconds to perform an MCO image build (assuming the builder and base images are already prefetched).

      A preliminary test shows that by using advanced caching directives, incremental builds can be reduced to as little as 45 seconds. Additionally, by moving the nmstate binary installation into a separate build stage and limiting what files are copied into that stage, we can achieve a cache hit under most conditions. This cache hit has the additional advantage of that stage not requiring VPN in order to reach the appropriate RPM repository.

       

      Done When:

      • The Dockerfile in the MCO repository root has been modified to take advantage of advanced caching directives.
      • The nmstate installation has been moved into a separate build stage within the MCO's Dockerfile to increase the likelihood of cache hits.
      • These speed improvements will not likely be observed within OpenShift CI because the build contexts and caches are thrown away after builds since these builds run in containers themselves.

              zzlotnik@redhat.com Zack Zlotnik
              zzlotnik@redhat.com Zack Zlotnik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: