Skip to content

Tags for branch names containing "#" parsed incorrectly ignoring the "#" #199

@vajahath

Description

@vajahath

Behaviour

When I run metadata for on my branch banner-utils-test-#5 gives me a tag of: banner-utils-test--5. Is this expected?

JSON output
  {
    "tags": [
      "ghcr.io/xxx/xxx:banner-utils-test--5" 👈
    ],
    "labels": {
      "org.opencontainers.image.title": "xxx",
      "org.opencontainers.image.description": "Thing related to xxx",
      "org.opencontainers.image.url": "https://github.com/xxx/xxx",
      "org.opencontainers.image.source": "https://github.com/xxx/xxx",
      "org.opencontainers.image.version": "banner-utils-test--5",👈
      "org.opencontainers.image.created": "2022-04-29T09:30:00.228Z",
      "org.opencontainers.image.revision": "xxxx",
      "org.opencontainers.image.licenses": ""
    }
  }

Relevant actions/checkout logs for the branch info:

Checking out the ref
  /usr/bin/git checkout --progress --force -B banner-utils-test-#5 refs/remotes/origin/banner-utils-test-#5 👈
  Switched to a new branch 'banner-utils-test-#5'
  branch 'banner-utils-test-#5' set up to track 'origin/banner-utils-test-#5'. 👈
/usr/bin/git log -1 --format='%H'
'0f74d16753f11edb247f21e16e9be6d80ed3b387'

Steps to reproduce this issue

Try on a branch like xxxx-xx-#3

Expected behaviour

I don't know if this is the intended behaviour.
banner-utils-test-#5 should translate to it self instead of banner-utils-test--5

Configuration

name: build-test
on: [push]
jobs:
  Lint-Build-UnitTest:
    runs-on: ubuntu-latest
    env:
      REGISTRY: ghcr.io
      IMAGE_NAME: ${{ github.repository }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: "16"

      - name: npm ci (normal) on ./functions - fast
        run: npm ci --no-audit --progress=false
        working-directory: ./functions

      - name: prettier
        run: npm run prettier

      - name: lint
        run: npm run lint

      - name: build
        run: npm run build

      - name: unit-test
        run: npm run test:unit

      - name: Delete dev node_modules
        run: rm -rf node_modules
        working-directory: ./functions

      - name: npm ci --prod on ./functions - fast
        run: npm ci --production --no-audit --progress=false
        working-directory: ./functions

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

      - name: Log in to the Container registry
        uses: docker/login-action@v1
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract metadata (tags, labels) for Docker 👈
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

      - name: Build and push Docker image
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          tags: ${{ steps.meta.outputs.tags }} 👈
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=registry,ref=${{ steps.meta.outputs.tags }}
          cache-to: type=inline

  Integration-Test:
    runs-on: ubuntu-latest
    needs: Lint-Build-UnitTest
    container:
      image: node:16.13.2-slim
      env:
        GCLOUD_PROJECT: demo-friendly-octopus-u4st7gxr8
        FIRESTORE_EMULATOR_HOST: firebase_emulator:8080
        FIREBASE_STORAGE_EMULATOR_HOST: firebase_emulator:9199
        FIREBASE_AUTH_EMULATOR_HOST: firebase_emulator:9099
        MONGO_DB_URI: mongodb://mongodb:27017

    services:
      firebase_emulator:
        image: ghcr.io/xxxx/xxxx:${{ github.ref_name }}
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          AVOID_FUNCTIONS_EMULATION: "yes"
      
      mongodb:
        image: mongo
        env:
          MONGO_INITDB_DATABASE: Friendly

    steps:
      - uses: actions/checkout@v2

      - name: fresh npm ci
        run: npm ci --no-audit --progress=false
        working-directory: ./functions

      - name: build
        run: npm run build
        working-directory: ./functions

      - name: Integration Test
        run: npm run test:integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions