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
Incorrect value for 'digest' output (same as 'imageid' for some reason) #579
Comments
@spinningarrow Can you give a link to your repo or post your workflow please? |
@crazy-max unfortunately the repo is private. Here's the workflow: name: pipeline
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
USER_NAME: spinningarrow
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
WORKING_DIR_GCP: infrastructure/gcp/
jobs:
build:
runs-on: ubuntu-20.04
outputs:
image_sha: ${{ steps.buildDocker.outputs.digest }}
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.43
- name: Test
run: go test -race -cover ./...
- name: Build binary
run: env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v ./cmd/...
- name: Log in to container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USER_NAME }}
password: ${{ secrets.USER_PAT }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: buildDocker
uses: docker/build-push-action@v2
with:
context: .
file: ./build/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ steps.meta.outputs.tags }}
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
terraform-staging:
needs: build
name: 'terraform'
runs-on: ubuntu-20.04
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
TF_WORKSPACE: staging
TF_VAR_ghcr_token_config: ${{ secrets.GHCR_TOKEN }}
TF_VAR_worker_image_sha: ${{ needs.build.outputs.image_sha }}
defaults:
run:
shell: bash
working-directory: ${{ env.WORKING_DIR_GCP }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Init
run: terraform init
- name: Terraform Format
run: terraform fmt -check
- name: Terraform Validate
run: terraform validate
- name: Terraform Plan
run: terraform plan
- name: Terraform Apply
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: terraform apply -auto-approve |
I created a public repo to demonstrate this bug: https://github.com/spinningarrow/docker-action-test You can see it in the workflow output here: https://github.com/spinningarrow/docker-action-test/runs/5758955970?check_suite_focus=true#step:5:239 Here's the excerpt from the log:
The ImageID is the same as the digest, which already indicates a problem. Doing a
When doing a
Above we have the actual digest of this image, which can be seen in further detail with
It looks like the action is somehow using the |
You can also see the correct digest on the GitHub packages page for this docker image: https://github.com/spinningarrow/docker-action-test/pkgs/container/docker-action-test/versions |
I can confirm we're seeing the same issue within one of our private repos. |
@spinningarrow imageid and digest are the same because your GitHub Runner is still on buildx 0.7.1: https://github.com/spinningarrow/docker-action-test/runs/5758955970?check_suite_focus=true#step:5:59. As you don't have the setup-buildx-action step in your workflow, it will use the Suggest to add the -
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.8.2 |
@crazy-max thanks, that did the trick! However, this is definitely not obvious from the documentation - can you add a note about that somewhere? Right now the usage section in the readme says that setup-buildx is "not required but recommended". If not having it causes these kinds of hard-to-debug issues then it should be always required imho. |
I encountered the same behavior where the |
Troubleshooting
Before submitting a bug report please read the Troubleshooting doc.
Behaviour
Steps to reproduce this issue
Expected behaviour
ImageID should be the ID of the docker image
Digest should be the digest of manifest
Actual behaviour
Digest is the same as the ImageID
Configuration
# paste your YAML workflow file here and remove sensitive data
Logs
The text was updated successfully, but these errors were encountered: