Pipeline: Kaniko do not want to work with results

Created on 30 Jun 2020  Â·  4Comments  Â·  Source: tektoncd/pipeline

Expected Behavior

Kaniko will create image

Actual Behavior

error:
"error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: getting tag for destination: tag can only contain the runes abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ: 0.0.1-562e93a0"

Steps to Reproduce the Problem

Create such task with such script:


        reg=registry.myadomain.com/stack/frontend
        version=$(grep "<version>" pom.xml|head -1|cut -d">" -f2|cut -d"<" -f1)
        rev=$(git rev-parse --short HEAD)

        echo "~~~~~~~~~~~~~${reg}:${version}-${rev}~~~~~~~~~~~~~~~~~"
        echo ${reg}:${version}-${rev} > $(results.frontendImage.path)

Then push it to another task parameter:

- name: imageName
          value: $(tasks.prepare-frontend.results.frontendImage)

and when i try to use it in another task to build with kaniko:

- name: build-and-push
      image: gcr.io/kaniko-project/executor:v0.17.1
      # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential
      env:
        - name: "DOCKER_CONFIG"
          value: "/tekton/home/.docker/"
      # script: |
      # #!/bin/bash
      # set -e

      # echo $(params.profiles)
      command:
        - /kaniko/executor
      args:
        - --cache=true
        # - --skip-tls-verify
        - --build-arg=profiles=$(params.profiles)
        - --cache-dir=$(workspace.cache.path)/kaniko-cache
        - --dockerfile=$(workspaces.construction-space.path)/$(params.name)/$(params.pathToContext)/Dockerfile
        - --destination=$(params.imageName)
        - --context=$(workspaces.construction-space.path)/$(params.name)/$(params.pathToContext)

Im getting error mentioned at beggining. When i will use same image and tag (eg. registry.mydomain.com/stack/frontend:0.0.1-562e93a0) directly there is no problem.

Additional Info

I created additional step to show parameter before kaniko step and parameter is 1:1 like it should be and like i put it directly. Why kaniko see some unsupported signs when i use parameter?

/kind bug
/kind question

kinbug kinquestion

Most helpful comment

Hi @holoGDM, echo adds a newline after echoing the text.

Can you try to change your line to

echo -n ${reg}:${version}-${rev} > $(results.frontendImage.path)

The -n flag will tell it not to add a newline at the end, for example see the git-clone task.

Hello, yes it was it. Thank You for helping :)

All 4 comments

Hi @holoGDM, echo adds a newline after echoing the text.

Can you try to change your line to

echo -n ${reg}:${version}-${rev} > $(results.frontendImage.path)

The -n flag will tell it not to add a newline at the end, for example see the git-clone task.

"error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: getting tag for destination: tag can only contain the runes abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ: 0.0.1-562e93a0"

Looking at the error, it seems, the tag generated by the previous task (and put into imageName ?) is invalid : 0.0.1-562e93a0. It seems it should be valid (looking at the allowed "runes" but it doesn't seem to be. This might be a kaniko issue though.

From docker tag reference, "A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.". It seems dot (.) is not allowed as a tag, so it's kinda weird that the allowed runes seems to contain one for kaniko.

Hi @holoGDM, echo adds a newline after echoing the text.

Can you try to change your line to

echo -n ${reg}:${version}-${rev} > $(results.frontendImage.path)

The -n flag will tell it not to add a newline at the end, for example see the git-clone task.

Hello, yes it was it. Thank You for helping :)

Solved by @ljupchokotev

Was this page helpful?
0 / 5 - 0 ratings