Access to main branch cache form feature branch

Open
#1,103 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
docker, github-actions

Research direction

Start by reproducing the two workflow configurations shown in the issue with Docker Buildx and GitHub Actions cache scopes. Review how cache-from and cache-to handle access between feature and main branches, then compare the observed behavior with the linked GitHub cache documentation. Done means establishing whether the configuration should work and identifying the required action or documentation change.

Written by the indexing model from the issue text.

Description

Description

Hello,

I'm trying to speed up builds on feature branches, by pulling cache form main but I'm not able to achieve that. Following Github documentation it should be possible:

Access restrictions provide cache isolation and security by creating a logical boundary between different branches or tags. Workflow runs can restore caches created in either the current branch or the default branch (usually main).

I used something like this in my workflows:

feature branch:

- name: Build and export
  uses: docker/build-push-action@v5
  with:
    context: .
    cache-from:  |
      type=gha
      type=gha,scope=main
    cache-to: type=gha,mode=min,scope=main
    build-args: |
      VERSION=""
    load: true
    tags: app:latest
    outputs: type=docker,dest=build.tar

main branch:

- name: Build and export
  uses: docker/build-push-action@v5
  with:
    context: .
    cache-from: type=gha,scope=main
    cache-to: type=gha,mode=min,scope=main
    build-args: |
      VERSION=""
    load: true
    tags: app:latest
    outputs: type=docker,dest=build.tar

I was doing some variation of that solution, as setting only the same scope for both branches or removing scope form main branch, but nothing worked for me.

Do you have any suggestion? Thanks in advance.

Dominant language
TypeScript
Stars
5.4k
Forks
735
Avg merge
3d 9h
Merged PRs (30d)
14

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker/build-push-action

All issues in docker/build-push-action

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.