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

prefix/suffix not working? #61

Closed
strophy opened this issue Apr 7, 2021 · 8 comments · Fixed by #62 or #63
Closed

prefix/suffix not working? #61

strophy opened this issue Apr 7, 2021 · 8 comments · Fixed by #62 or #63
Labels

Comments

@strophy
Copy link

strophy commented Apr 7, 2021

Behaviour

I am unable to add a prefix or suffix in v2 of this action, regardless if specified in the flavor or in the tag attributes.

Steps to reproduce this issue

  1. Specify suffix=-dev in flavor or individual tag
  2. Run action
  3. Suffix is not applied

Expected behaviour

The action should append the suffix to the tag

Actual behaviour

The suffix is not appended

Configuration

- name: Set -dev suffix
  id: release_type
  run: |
    if [[ ${{ contains(github.event.release.tag_name, '-dev') }} = true ]]
    then
      echo '::set-output name=dev-suffix::-dev'
    else
      echo '::set-output name=dev-suffix::'
    fi

- name: Docker meta
  id: docker_meta
  uses: crazy-max/ghaction-docker-meta@v2
  with:
    images: strophy/drive
    tags: |
      type=match,pattern=v(\d+),group=1
      type=match,pattern=v(\d+.\d+),group=1
      type=match,pattern=v(\d+.\d+.\d+),group=1
      type=match,pattern=v(.*),group=1,suffix=,enable=${{ contains(github.event.release.tag_name, '-dev') }}
    flavor: |
      latest=${{ !contains(github.event.release.tag_name, '-dev') }}
      suffix=${{ steps.release_type.outputs.dev-suffix }}

Logs

logs_396.zip

@crazy-max
Copy link
Member

@strophy Thanks for your feedback, yes that's a bug that affects match, semver and schedule types.

@crazy-max
Copy link
Member

@strophy Can you make a test with crazy-max/ghaction-docker-meta@fix-prefix-suffix please?

@strophy
Copy link
Author

strophy commented Apr 7, 2021

Thanks for the quick action on this @crazy-max I really appreciate it 🥇

The suffix is now being generated correctly. I realize this might be more of a feature request, but I would however prefer that an explicitly specified suffix in a tag attribute declaration would override the flavor argument. For example below (my output from running from your fix-prefix-suffix branch), the final tag should not have the -tag suffix because suffix= is explicitly specified in the tag attribute. Log output:

Run crazy-max/ghaction-docker-meta@fix-prefix-suffix
  with:
    images: strophy/drive
    tags: type=match,pattern=v(\d+),group=1
  type=match,pattern=v(\d+.\d+),group=1
  type=match,pattern=v(\d+.\d+.\d+),group=1
  type=match,pattern=v(.*),group=1,suffix=,enable=true
  
    flavor: latest=false
  suffix=-dev
  
    github-token: ***
Context info
  eventName: release
  sha: 0ce1f078b1fac7f85874a77a728cc689fda86336
  ref: refs/tags/v0.19.36-dev.4
  workflow: tests
  action: crazy-maxghaction-docker-meta
  actor: strophy
  runNumber: 117
  runId: 726888199
Processing tags input
  type=match,pattern=v(\d+),group=1,value=,enable=true,priority=800,prefix=,suffix=
  type=match,pattern=v(\d+.\d+),group=1,value=,enable=true,priority=800,prefix=,suffix=
  type=match,pattern=v(\d+.\d+.\d+),group=1,value=,enable=true,priority=800,prefix=,suffix=
  type=match,pattern=v(.*),group=1,suffix=,enable=true,value=,priority=800,prefix=
Processing flavor input
  latest=false
  prefix=
  suffix=-dev
Docker image version
  0-dev
Docker tags
  strophy/drive:0-dev
  strophy/drive:0.19-dev
  strophy/drive:0.19.36-dev
  strophy/drive:0.19.36-dev.4-dev          // should be: strophy/drive:0.19.36-dev.4

Does this make sense? Or is there another way to achieve this behavior? My workflow code is here, thanks for your help!

@crazy-max
Copy link
Member

@strophy

the final tag should not have the -tag suffix because suffix= is explicitly specified in the tag attribute.

Yes indeed. Let me check this.

@crazy-max
Copy link
Member

Ok I will create a new PR to allow to explicitly override a global suffix/prefix.

@crazy-max
Copy link
Member

@strophy Can you make a test with crazy-max/ghaction-docker-meta@override-flavor please?

@crazy-max crazy-max reopened this Apr 7, 2021
@strophy
Copy link
Author

strophy commented Apr 7, 2021

This looks perfect to me:

Run crazy-max/ghaction-docker-meta@override-flavor
  with:
    images: strophy/drive
    tags: type=match,pattern=v(\d+),group=1
  type=match,pattern=v(\d+.\d+),group=1
  type=match,pattern=v(\d+.\d+.\d+),group=1
  type=match,pattern=v(.*),group=1,suffix=,enable=true
  
    flavor: latest=false
  suffix=-dev
  
    github-token: ***
Context info
  eventName: release
  sha: aa00832302bf3aa17630e0190423597fcb37cb11
  ref: refs/tags/v0.19.38-dev.1
  workflow: tests
  action: crazy-maxghaction-docker-meta
  actor: strophy
  runNumber: 119
  runId: 727007388
Processing tags input
  type=match,pattern=v(\d+),group=1,value=,enable=true,priority=800
  type=match,pattern=v(\d+.\d+),group=1,value=,enable=true,priority=800
  type=match,pattern=v(\d+.\d+.\d+),group=1,value=,enable=true,priority=800
  type=match,pattern=v(.*),group=1,suffix=,enable=true,value=,priority=800
Processing flavor input
  latest=false
  prefix=
  suffix=-dev
Docker image version
  0-dev
Docker tags
  strophy/drive:0-dev
  strophy/drive:0.19-dev
  strophy/drive:0.19.38-dev
  strophy/drive:0.19.38-dev.1

@crazy-max
Copy link
Member

@strophy Ok great :)

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