mr-smithers-excellent / docker-build-push

Docker Build & Push GitHub Action
MIT License
287 stars 61 forks source link

Exit Code 1 after pushing latest tag #198

Closed CodeVachon closed 1 year ago

CodeVachon commented 1 year ago

Hello, last evening I found that this task in a job has started throwing an unknown error.

This occurs when the addLatest: true variable is set. When the value is not set, the task runs cleanly.

the latest image is built and deployed to the registry as expected, but reference tags are not.

Job Config

name: Production Build and Deploy Release

on:
  release:
    types: [published]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        app_name:
          - api

    steps:
      - uses: actions/checkout@v2
        name: Check out code

      - uses: mr-smithers-excellent/docker-build-push@v6.2
        name: Build & Push Docker Image
        with:
          image: anzen-${{ matrix.app_name }}
          registry: ghcr.io
          dockerfile: apps/${{ matrix.app_name }}/Dockerfile
          addLatest: true
          enableBuildKit: true
          username: ${{ secrets.GHCR_USERNAME }}
          password: ${{ secrets.GHCR_TOKEN }}

Debug Log

...
#40 exporting to image
#40 exporting layers
#40 exporting layers 24.1s done
#40 writing image sha256:4c08fec99314d8951e1aba986fd5f6ff5845b46dfcdab7a2bfd22eeb413a956d done
#40 naming to ghcr.io/***/anzen-api:latest done
#40 DONE 24.1s
Pushing tags latest for Docker image ghcr.io/***/anzen-api...
The push refers to repository [ghcr.io/***/anzen-api]
3c05a155d8c8: Preparing
...
cecf73c6c5a2: Pushed
c1e4bf9ddd44: Pushed
latest: digest: sha256:e5f474e27cdd76dda8971176fff41f9b02488e489e96066c2a7d4b71fb51e[464](https://github.com/useAnzen/application-mono-repo/actions/runs/6963504835/job/18949707439#step:3:465) size: 5752
##[debug]Node Action run completed with exit code 1
##[debug]Set output imageFullName = ghcr.io/***/anzen-api
##[debug]Set output imageName = anzen-api
##[debug]Set output tags = latest
##[debug]Finishing: Build & Push Docker Image

Expected

expected to find 1 image with 2 tags in the registry.

Actual

only the latest tag is received on the registry


my best guess would be that Actions has changed how git tag references resulting in ${{ github.ref }} being undefined, and that docker is throwing an error trying to set an empty tag as a result.

CodeVachon commented 1 year ago

Update that This evening this issue appears to have resolved itself. likely an update that Github themselves made.

It would would still be nice to have a more verbose error message when something does wrong however.