# Build V2 - CF\_BRANCH\_TAG\_NORMALIZED Error

**URL:** <https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340>\
**Category:** Pipeline Steps\
**Created:** [April 6, 2020, 3:57pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340 "2020-04-06T15:57:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren\_Boon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/darren_boon/32/233_2.png) [@Darren\_Boon](https://community.codefresh.io/u/Darren_Boon)\
**Post date:** [April 6, 2020, 3:57pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/1 "2020-04-06T15:57:26Z")

</div>

I am trying out the new V2 build step with registry tagging support and following the examples in the docs ([Bootstrap · Content moved](https://codefresh.io/docs/docs/docker-registries/cfcr-deprecation/)). Example from docs:

```auto
    type: build
    stage: build
    image_name: my-docker-image
    tags:
      - latest
      - ${{CF_BRANCH_TAG_NORMALIZED}}
      - v1.1

```

Trying to use CF\_BRANCH\_TAG\_NORMALIZED to tag the image, but the value is the full NOT-normalized form, which is causing the following error:

`invalid argument "myimagename:feature/JIRA-1234_codefreshdeploys" for "-t, --tag" flag: invalid reference for mat`

That variable worked fine before with our separate image push steps.

---

<div class="post-metadata">

**Author:** ![Darren\_Boon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/darren_boon/32/233_2.png) [@Darren\_Boon](https://community.codefresh.io/u/Darren_Boon)\
**Post date:** [April 6, 2020, 4:10pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/2 "2020-04-06T16:10:34Z")

</div>

As a workaround, using `disable_push: true` in the build step and using a the push step with CF\_BRANCH\_TAG\_NORMALIZED works.

---

<div class="post-metadata">

**Author:** ![kristofer](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kristofer/32/19_2.png) [@kristofer](https://community.codefresh.io/u/kristofer)\
**Post date:** [April 6, 2020, 6:54pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/3 "2020-04-06T18:54:19Z")

</div>

Thanks! I’ve got a bug logged for this so we’ll let you know once it’s sorted out. 🙂

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [April 7, 2020, 3:30pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/4 "2020-04-07T15:30:53Z")

</div>

Hello

We have investigated this. Apparently there are some docker registries that accept tags with capital letters and some do not. Your registry seems to be the latter.

You can use instead the variable `CF_BRANCH_TAG_NORMALIZED_LOWER_CASE` to make sure that the final result is compliant with your registry.

Just to be on the safe side, I also updated the docs to use the lower case variable instead of the `CF_BRANCH_TAG_NORMALIZED` variable (which will not tamper with case)

---

<div class="post-metadata">

**Author:** ![Darren\_Boon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/darren_boon/32/233_2.png) [@Darren\_Boon](https://community.codefresh.io/u/Darren_Boon)\
**Post date:** [April 7, 2020, 4:11pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/5 "2020-04-07T16:11:14Z")

</div>

This has nothing to do with capitalization. The problem is that `CF_BRANCH_TAG_NORMALIZED` behavior has changed in the V2 of the build step. In other places the value of that variable removes any offending characters like /, which is the cause of my error. As it is right now, there is no difference between `CF_BRANCH_TAG_NORMALIZED` and `CF_BRANCH`.

I can use `CF_BRANCH_TAG_NORMALIZED` without error in push image steps and other places. It is only in the new v2 build step that it is not normalizing the branch name.

---

<div class="post-metadata">

**Author:** ![Itai\_Gendler](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/itai_gendler/32/237_2.png) [@Itai\_Gendler](https://community.codefresh.io/u/Itai_Gendler)\
**Post date:** [April 7, 2020, 6:03pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/6 "2020-04-07T18:03:52Z")

</div>

Hey there Darren.

Nothing was changed in the value of `CF_BRANCH_TAG_NORMALIZED ` env var when moving to build V2.

Can you please share link to the build/s that shows this behavior of both the build and the push steps so we can check and better understand the issue you are having?

Thanks.

---

<div class="post-metadata">

**Author:** ![Darren\_Boon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/darren_boon/32/233_2.png) [@Darren\_Boon](https://community.codefresh.io/u/Darren_Boon)\
**Post date:** [April 7, 2020, 9:46pm UTC](https://community.codefresh.io/t/build-v2-cf-branch-tag-normalized-error/340/7 "2020-04-07T21:46:27Z")

</div>

Here is a link to the broken build: [Codefresh | console](https://g.codefresh.io/build/5e8b4bba11962e6171b9b594)

Here is the relevant yaml snippet:

```auto
  build_dockerfile:
    title: Building Dockerfile
    stage: build
    type: build
    buildkit: true
    image_name: ${{PROJECT_NAME_LOWER}}
    working_directory: services/${{PROJECT_NAME}}
    dockerfile: Dockerfile
    target: production
    build_arguments:
      - PROJECT_NAME=${{PROJECT_NAME}}
    registry: gcr
    tags:
      - latest
# Invalid tag error triggered here (tag still includes / in branch name)
      - ${{CF_BRANCH_TAG_NORMALIZED}}
      - ${{CF_SHORT_REVISION}}
  push_docker_file:
    title: Pushing image to Google Docker registry
    stage: build
    type: push
    candidate: ${{build_dockerfile}}
# Correct tag here (tag has / in branch name removed)
    tag: '${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}'
    registry: gcr

```
