buildah icon indicating copy to clipboard operation
buildah copied to clipboard

imagebuildah, `cache-from`: pull cache from remote repo after adding content summary

Open flouthoc opened this issue 3 years ago • 6 comments

For certain instruction actual history matching makes sense after content summary is processed and added, In such cases generated cacheKey for distributed cache is changed hence for such cases attempt to pull available cache from remote repo once cacheKey is generated again after adding content summary.

Example use case which works with --cache-from and --cache-to after this commit.

FROM alpine
ARG VAR=hello
RUN echo "Hello $VAR"

Closes: https://github.com/containers/buildah/issues/4315

flouthoc avatar Oct 10 '22 06:10 flouthoc

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Oct 10 '22 06:10 openshift-ci[bot]

@containers/buildah-maintainers @nalind PTAL

flouthoc avatar Oct 10 '22 12:10 flouthoc

LGTM

rhatdan avatar Oct 10 '22 12:10 rhatdan

@nalind PTAL

rhatdan avatar Oct 10 '22 17:10 rhatdan

@flouthoc you may need to rebase this one

TomSweeneyRedHat avatar Oct 11 '22 21:10 TomSweeneyRedHat

One possible nit, but definitely would like a head nod from @nalind

TomSweeneyRedHat avatar Oct 11 '22 21:10 TomSweeneyRedHat

Rebased following PR with main @containers/buildah-maintainers @nalind PTAL .

flouthoc avatar Oct 21 '22 08:10 flouthoc

LGTM

nalind avatar Oct 24 '22 18:10 nalind

/lgtm

rhatdan avatar Oct 24 '22 21:10 rhatdan

Heads-up to everyone involved, the buildah treadmill found that this is not working in podman-remote:

#|     FAIL: podman-remote build ....
#| expected: =~ 'STEP 2/3: ARG VAR=hello
   --> Cache pulled from remote'
#|   actual:    'STEP 1/3: FROM alpine'
#| ...
#|         >    'STEP 2/3: ARG VAR=hello'                                                                                                                    
#|         >    '--> Pushing cache localhost:39951/temp:73dcec7230efcfd8cd8e041d68f6c74b04f1242fc3c1e67c64b0c92abcaa2d28'                                   
#|         >    '--> 4e92a602438'

i.e., "Cache pulled from remote" does not appear in the output.

For now I've just added skip_if_remote to the treadmill; it will need to be addressed for real in the next buildah vendor.

edsantiago avatar Oct 25 '22 12:10 edsantiago

Heads-up to everyone involved, the buildah treadmill found that this is not working in podman-remote:

#|     FAIL: podman-remote build ....
#| expected: =~ 'STEP 2/3: ARG VAR=hello
   --> Cache pulled from remote'
#|   actual:    'STEP 1/3: FROM alpine'
#| ...
#|         >    'STEP 2/3: ARG VAR=hello'                                                                                                                    
#|         >    '--> Pushing cache localhost:39951/temp:73dcec7230efcfd8cd8e041d68f6c74b04f1242fc3c1e67c64b0c92abcaa2d28'                                   
#|         >    '--> 4e92a602438'

i.e., "Cache pulled from remote" does not appear in the output.

For now I've just added skip_if_remote to the treadmill; it will need to be addressed for real in the next buildah vendor.

@edsantiago I'll take a look at this thanks, could you share full log link here as well.

flouthoc avatar Oct 26 '22 08:10 flouthoc

@edsantiago Following PR should fix this https://github.com/containers/buildah/pull/4386

flouthoc avatar Oct 27 '22 19:10 flouthoc