docker / docker/metadata-action
Flavor is ignored in output, despite being parsed properly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 160
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 12
Description
Behaviour
Even though I've specified a flavor which contains a prefix, and it is parsed properly, it doesn't result in a prefix on the docker tags which are produced. This prefix is being used in a matrix to allow two different packages to be built into images. Apologies if I'm missing something obvious (it feels like I must be?).
I'm using the following flavor:
flavor: |
latest=auto
prefix=${{ matrix.package }}-,onlatest=true
suffix=
I've tried this with a few different combinations, including both with tags specified and without, as well as messing with the onlatest, but none of this appears to change the behavior.
Thanks tons!
Steps to reproduce this issue
- Configure the workflow with a
flavorsdefined, which specifies a prefix - Run the action
- Observe incorrect output
Expected behaviour
Docker tags should be generated with a prefix; in the case of the above, it should be ghcr.io/fardog/primebot:twitter-pr-12.
Actual behaviour
Docker tags ignore the prefix; e.g. ghcr.io/fardog/primebot:pr-12
Configuration
- Repository URL (if public): https://github.com/fardog/primebot/pull/12
- Build URL (if public): https://github.com/fardog/primebot/actions/runs/4332624631/jobs/7565241206
The repository URL contains a few different attempts within that PR, none of the configs I attempted were successful however.
name: Docker Image
on:
push:
branches:
- master
tags:
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
strategy:
matrix:
package: ["twitter", "mastodon"]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
prefix=${{ matrix.package }}-,onlatest=true
suffix=
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-${{ matrix.package }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Logs
Attached; also here is a screenshot of relevant output.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported workflow configuration, including the matrix.package value, flavor block, tags, and Dockerfile-${{ matrix.package }} build input; compare the generated tags with the attached logs and linked Actions runs. Done means the configured prefix appears in the generated Docker tags, including the expected ghcr.io/fardog/primebot:twitter-pr-12 output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, github-actions, typescript
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100