Skip to content

Possible to export cache in a separate command? #1938

@praveenperera

Description

@praveenperera

Since exporting the cache can take a little while, (around 90-120 seconds in my testing). I was wondering if I could do it in a separate command.

The reasoning for this is I would like to notify my deployment that a new image is available as soon as the registry push of the build image is complete.

Currently if I do this, my new build is deployed after the cache is exported and pushed.

buildctl build ... \
  --output type=image,name=localhost:5000/myrepo:image,push=true \
  --export-cache type=registry,ref=localhost:5000/myrepo:buildcache \
  --import-cache type=registry,ref=localhost:5000/myrepo:buildcache \

# command for k8s deployment to use new build
kubectl rollout restart deployment $APP_NAME -n=$NAMESPACE

Ideally I'd like to do something like this:

buildctl build ... \
  --output type=image,name=localhost:5000/myrepo:image,push=true \
  --import-cache type=registry,ref=localhost:5000/myrepo:buildcache \

# command for k8s deployment to use new build
kubectl rollout restart deployment $APP_NAME -n=$NAMESPACE

# export cache after
buildctl export-cache ... \
  --export-cache type=registry,ref=localhost:5000/myrepo:buildcache \

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions