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

Double quotes in repository description causes downstream build-push-action error #87

Closed
patrickkwang opened this issue May 18, 2021 · 4 comments · Fixed by docker/build-push-action#369

Comments

@patrickkwang
Copy link

Behaviour

Steps to reproduce this issue

  • In the repository description, use some double quotes.
  • Run docker/metadata-action@v3
  • ...followed by docker/build-push-action@v2 with labels: ${{ steps.meta.outputs.labels }}

Expected behaviour

I hoped that this would run without errors and push a docker image.

Actual behaviour

docker/build-push-action fails with
Error: Invalid Opening Quote: a quote is found inside a field at line 2

Configuration

name: 'release'

on:
    release:
        types: [published]

jobs:
    push_to_registry:
        name: Push Docker image to GitHub Packages tagged with "latest" and version number.
        runs-on: ubuntu-latest
        permissions: 
            contents: read
            packages: write
        steps:
            - name: Checkout
              uses: actions/checkout@v2

            - name: Docker meta
              id: meta
              uses: docker/metadata-action@v3
              with:
                # list of Docker images to use as base name for tags
                images: |
                  ghcr.io/TranslatorSRI/filter_results_top_n
                # add latest tag when appropriate
                flavor: |
                  latest=auto
                # generate Docker tags based on the following events/attributes
                tags: |
                  type=semver,pattern={{version}}
                  type=semver,pattern={{major}}.{{minor}}
                  type=semver,pattern={{major}}
                  type=sha

            - name: Set up QEMU
              uses: docker/setup-qemu-action@v1

            - name: Set up Docker Buildx
              uses: docker/setup-buildx-action@v1

            - name: Login to GHCR
              uses: docker/login-action@v1
              with:
                registry: ghcr.io
                username: ${{ github.repository_owner }}
                password: ${{ secrets.GITHUB_TOKEN }}

            - name: Build and push
              uses: docker/build-push-action@v2
              with:
                context: .
                push: true
                tags: ${{ steps.meta.outputs.tags }}
                labels: ${{ steps.meta.outputs.labels }}

Logs

logs_7.zip

Notes

A workaround is simply to avoid double quotes in the repository description.

A potential solution is to escape the quotes in the labels by doubling them: docker/build-push-action#245 (comment), but this may not be kind to other uses of the metadata output.

@crazy-max

This comment has been minimized.

@crazy-max
Copy link
Member

crazy-max commented May 23, 2021

@patrickkwang Preserving quotes inside unquoted field seems to be the best approach in this case.

@crazy-max
Copy link
Member

@patrickkwang Can you try with docker/build-push-action@master?

@patrickkwang
Copy link
Author

Looks good! Thanks, @crazy-max!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants