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

Tekton's Results don't get trimmed #2936

Closed
soharaki opened this issue Jul 14, 2020 · 1 comment · Fixed by #2942
Closed

Tekton's Results don't get trimmed #2936

soharaki opened this issue Jul 14, 2020 · 1 comment · Fixed by #2942
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@soharaki
Copy link

soharaki commented Jul 14, 2020

Expected Behavior

Tekton's Results have the line feeds.
Some error occurs when we want to pass parameters directly from the results, for example Kaniko.

Actual Behavior

Tekton's Results have no line feeds.

Example Test Codes

apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: openshift-handson-line-feed-results
  namespace: handson-example
spec:
  tasks:
    - name: get-result
      taskSpec:
        steps:
          - name: set-results
            image: goreleaser/goreleaser # any images which have the shell
            script: |
              echo "123" > /tekton/results/pre
              echo "abc" > /tekton/results/post
        results:
        - name: pre
        - name: post
    - name: checkresults
      runAfter: ["get-result"]
      taskSpec:
        params:
          - name: IMAGETAG
        steps:
          - name: check-params
            image: goreleaser/goreleaser 
            script: |
              echo $(params.IMAGETAG)
      params:
        - name: IMAGETAG
          value: "$(tasks.get-result.results.pre):v$(tasks.get-result.results.post)-1.0"

and the console displays the follow:

$tkn pipelinerun logs openshift-handson-line-feed-results-run-7tsxl -f -n handson-example
[get-result : set-results] + echo 123
[get-result : set-results] + echo abc

[checkresults : check-params] + echo 123
[checkresults : check-params] + :vabc
[checkresults : check-params] 123
[checkresults : check-params] /tekton/scripts/script-0-q89sn: line 4: :vabc: not found

Example Usage Codes

    - name: push-container
      taskRef:
        name: kaniko
      workspaces:
        - name: source
          workspace: local-source
      runAfter: ["int-test", "gen-report"]
      params:
        - name: DOCKERFILE
          value: src/main/docker/Dockerfile.jvm
        - name: IMAGE
          value: "$(params.image-registry):v$(tasks.get-versions.results.version2)hhh" #this

and the console displays the follow:

[build-and-push] 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`: v2
[build-and-push] hhh

Additional Info

  • OpenShift version:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0-4-g38212b5", GitCommit:"4a4cd759b616cdba344dd73386727c10d3d2dde1", GitTreeState:"clean", BuildDate:"2020-05-25T22:39:54Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.1+f63db30", GitCommit:"f63db30", GitTreeState:"clean", BuildDate:"2020-05-25T22:57:30Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

$ oc version
Client Version: 4.4.6
Server Version: 4.4.6
Kubernetes Version: v1.17.1+f63db30
  • Tekton Pipeline version:
$ tkn version
Client version: 0.10.0
Pipeline version: v0.11.3
Triggers version: v0.4.0
@soharaki soharaki added the kind/bug Categorizes issue or PR as related to a bug. label Jul 14, 2020
@ghost
Copy link

ghost commented Jul 14, 2020

Thanks for the issue report! It's true that Tekton doesn't perform any kind of string trimming for results. This has been intentional since we didn't want to make assumptions related to the content that task authors can put into results. But we should document this.

If you're writing a bash script then to prevent a newline being inserted into a result when using echo you can use echo -n. Other tool and shell behaviours will vary but you can typically omit a newline in some way from the content you're writing to result files.

@soharaki soharaki changed the title Tekton's Results have the line feeds. Tekton's Results don't get trimmed Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant