-
Notifications
You must be signed in to change notification settings - Fork 557
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
[Bug] buildx failed with: ERROR: failed to solve: failed to read dockerfile: failed to load cache key: repository does not contain ref #1222
Comments
Can you provide workflow logs and BuildKit logs please? |
I don't see them |
Looks like Earlier did not upload But i have done now. |
I'm not quite sure what that means. Does the PR got merged but workflow is still running? In that case it might be that the ref get removed when merged and therefore BuildKit is not able to fetch? Looking at the workflow logs, I see the checkout action uses another ref:
I wonder if we should do something similar. I'm taking a look. |
In the meantime you can use the path context: https://github.com/docker/build-push-action/?tab=readme-ov-file#path-context - name: Build
id: build
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
network: host
file: Dockerfile
provenance: false
github-token: ${{ inputs.TOKEN }}
secret-files: |
npmrc=${{ env.NPMRC_PATH }}
secrets: |
"TOKEN=${{ inputs.TOKEN }}"
build-args: |
"GHA_RUN_NUMBER=${{ inputs.GHA_RUN_NUMBER }}"
${{ inputs.DOCKER_ARGS }}
tags: |
"us-east4-docker.pkg.dev/${{ inputs.GCP_PROJECT_ID }}/${{ env.REPO_NAME }}/${{ inputs.IMAGE_NAME }}:latest" |
Yes correct. PR is getting merged immediately after opening the Pull request. When Pull Request is merged, Workflow for Pull request is still running . |
@crazy-max Can you please prioritize this as it impacting many users |
So after investigating it seems the
It uses a refspec In our case we are using the provided
I tried fetching directly from commit sha as well but didn't work: -
name: Build
id: build
uses: docker/build-push-action@master
with:
context: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.sha }}"
file: ./hello.Dockerfile
I'm not quite sure how we can handle that in Git source https://github.com/moby/buildkit/blob/master/source/git/source.go atm 🤔 Might require changes around https://github.com/moby/buildkit/blob/185751bdc010f1f8bf1192d6e9b4ec19552d5741/source/git/source.go#L368-L405
We only have a single report from you afaik but please share info if there are more people impacted. Do you have limitations using the path context vs git context in the meantime as shown in #1222 (comment)? |
Was testing on private repo my bad so here is other investigation with a public repo: https://github.com/crazy-max/buildx-buildkit-tests/actions/runs/11073531258 The It uses a refspec In our case we are using the provided I tried fetching directly from commit sha as well but unable to read tree: https://github.com/crazy-max/buildx-buildkit-tests/actions/runs/11073531258/job/30770257444#step:4:138 I'm not quite sure how we can handle that in Git source https://github.com/moby/buildkit/blob/master/source/git/source.go atm 🤔 Might require changes around https://github.com/moby/buildkit/blob/185751bdc010f1f8bf1192d6e9b4ec19552d5741/source/git/source.go#L368-L405 What seems to work is using the ref that points to the latest commit on the source branch of the pull request with Which is solved as https://github.com/crazy-max/buildx-buildkit-tests/actions/runs/11073531258/job/30770257072#step:5:145
And this commit
|
@chandanpg Should be fixed with latest release |
Contributing guidelines
I've found a bug, and:
Description
I noticed recently that we are getting error in CICD when we are calling this action. This error is coming when you raise a Pull request and you merge it immediately. You Docker Build Process(which is calling this action) during Pull Request would fail with below error.
Error: buildx failed with: ERROR: failed to solve: failed to read dockerfile: failed to load cache key: repository does not contain ref refs/pull/9/merge, output: ""
Expected behaviour
Job should go to success even when your Pull Request is merged/closed.
Actual behaviour
Job is failing when Pull Request is merged immediately
Repository URL
No response
Workflow run URL
No response
YAML workflow
Workflow logs
No response
BuildKit logs
No response
Additional info
No response
The text was updated successfully, but these errors were encountered: