Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to main branch cache form feature branch #1103

Open
rrabenda opened this issue Apr 26, 2024 · 0 comments
Open

Access to main branch cache form feature branch #1103

rrabenda opened this issue Apr 26, 2024 · 0 comments
Labels
kind/enhancement New feature or request status/triage

Comments

@rrabenda
Copy link

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.

@rrabenda rrabenda added kind/enhancement New feature or request status/triage labels Apr 26, 2024
@rrabenda rrabenda changed the title Access to cache from main branch Access to main branch cache form feature branch Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request status/triage
Projects
None yet
Development

No branches or pull requests

1 participant