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

[Error] Using tz= in type=ref tag #255

Closed
ZaneH opened this issue Jan 10, 2023 · 1 comment
Closed

[Error] Using tz= in type=ref tag #255

ZaneH opened this issue Jan 10, 2023 · 1 comment

Comments

@ZaneH
Copy link

ZaneH commented Jan 10, 2023

Behaviour

[...]
tags: |
    type=ref,event=branch,priority=1001,suffix=.{{date 'YYYY-MM-DD' tz='America/New_York'}}
[...]

Produces an error when using tz=. Removing the option resolves the problem but uses UTC.

Error: Parse error on line 1:
...{{date 'YYYY-MM-DD' tz
-----------------------^
Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID'

Steps to reproduce this issue

  1. Use docker/metadata-action
  2. Add a tag of type ref, event=branch and add a {{date}} somewhere in the tag
  3. Add the tz= option to the {{date}} and watch for errors.

Expected behaviour

I wanted to be able to specify the timezone to be America/New_York explicitly.

Actual behaviour

Workflow fails because of the error above.

Configuration

  • Repository URL (if public): n/a
  • Build URL (if public): n/a
# ./.github/workflows/release.yml
name: Update Harbor Image

on:
    push:
        branches: [master, main, gha-testing]
    workflow_dispatch:

env:
    # For Harbor
    REGISTRY_URL: [snip]
    PROJECT_NAME: [snip]
    REPO_NAME: [snip]

jobs:
    update-harbor-image:
        name: Update Harbor Image
        runs-on: sat-hosted
        steps:
            - uses: actions/checkout@v3

            - uses: actions/checkout@v3
              with:
                  repository: my-org/org-actions
                  path: org-actions

            - name: Docker Login
              uses: ./org-actions/docker-login
              with:
                  username: ${{ secrets.HARBOR_USERNAME }}
                  password: ${{ secrets.HARBOR_PASSWORD }}
                  registry-url: ${{ env.REGISTRY_URL }}

            - name: Docker meta
              id: meta
              uses: docker/metadata-action@v4
              with:
                  images: |
                      ${{ env.REGISTRY_URL }}/${{ env.PROJECT_NAME }}/${{ env.REPO_NAME }}
                  tags: |
                      type=ref,event=branch,priority=1001,suffix=.{{date 'YYYY-MM-DD' tz='America/New_York'}}
                      type=schedule,pattern={{date 'YYYY-MM-DD' tz='America/New_York'}}
                      type=semver,pattern={{raw}}
                      type=sha

            - uses: ./org-actions/update-image
              name: Update [snip] Docker image
              with:
                  image-tag: ${{ steps.meta.outputs.tags }}

Logs

n/a

@ZaneH ZaneH changed the title Using tz= in type=ref tag [Error] Using tz= in type=ref tag Jan 10, 2023
@crazy-max
Copy link
Member

@ZaneH #251 has been merged but not yet released.

In the meantime you can use docker/metadata-action@master

@ZaneH ZaneH closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants