GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add note to sanitize tags by crazy-max · Pull Request #426 · docker/build-push-action

Conversation

@crazy-max

@crazy-max crazy-max commented Aug 5, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Closes #424

Signed-off-by: CrazyMax [email protected]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@crazy-max
Add note to sanitize tags
c40e0ee
Signed-off-by: CrazyMax <[email protected]>
@crazy-max
crazy-max merged commit 6484a61 into docker:master Aug 5, 2021
@crazy-max
crazy-max deleted the doc-sanitize-ref branch August 5, 2021 06:12
@PromoFaux

PromoFaux commented Oct 2, 2021

Copy link
Copy Markdown

Just a note - and maybe I was doing it wrong somehow - but this didn't actually work for me. I kept getting:

image

I ended up using:

- name: lowercase repo name for tag
        uses: ASzc/change-string-case-action@v1
        id: reponame
        with:
          string: ghcr.io/${{ github.repository }}

and referencing as : ${{ steps.reponame.outputs.lowercase }}

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max

crazy-max commented Oct 2, 2021

Copy link
Copy Markdown
Member Author

@PromoFaux Looking at your workflow, I suggest to use the metadata action which will automatically sanitize tags:

name: Docker

on:
  push:
    branches: main

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

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

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

      - name: Cache Docker layers
        uses: actions/[email protected]
        with:
          path: /tmp/.docker-buildx-cache
          key: ${{ runner.os }}-docker-buildx-${{ github.sha }}
          restore-keys: ${{ runner.os }}-docker-buildx-

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

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: ghcr.io/${{ github.repository }}
          tags: |
            sha_${{ github.sha }}
            latest

      - name: Build
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=local,src=/tmp/.docker-buildx-cache
          cache-to: type=local,dest=/tmp/.docker-buildx-cache
PromoFaux reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PromoFaux

PromoFaux commented Oct 2, 2021

Copy link
Copy Markdown

Thanks for the tips, I'll take a look!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PromoFaux PromoFaux mentioned this pull request Oct 2, 2021
Prevent "Blocked host:" message syncforynab/fintech-to-ynab#336
Merged
@crazy-max

crazy-max commented Oct 2, 2021

Copy link
Copy Markdown
Member Author

@PromoFaux

but this didn't actually work for me.

And yes indeed there is an issue with the syntax. It should be: script: return '${{ github.repository }}'.toLowerCase(). Will fix that in a follow-up and also add a note about the metadata action to sanitize tags.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PromoFaux

PromoFaux commented Oct 2, 2021

Copy link
Copy Markdown

AH. I came really close to that solution myself! Rather I tried ${{ github.repository.toLowerCase() }}, which also didn't work - so I gave up and found another action. I'm not lazy, honest.

crazy-max reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PromoFaux

PromoFaux commented Oct 2, 2021

Copy link
Copy Markdown

Also, yeah, metadata action works well! I am already using it over on pi-hole/docker-pi-hole - I don't know why I didn't use it in this case.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max

crazy-max commented Oct 2, 2021

Copy link
Copy Markdown
Member Author

Yeah you can do a bunch of thing with the metadata-action. For example you could merge both nightly and release workflows and the metadata action will take care of tagging properly based on scheduled events, git tag and so on.

PromoFaux reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 2, 2021
docs: wrong syntax to sanitize repo slug #475
Merged
docs: example to sanitize tags with metadata-action #476
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Repository/image name should be lowercased automatically in cache parameters.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@crazy-max @PromoFaux
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.