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

bad substitution on container of working-dir-initializer #2039

Closed
liangyuanpeng opened this issue Feb 12, 2020 · 5 comments
Closed

bad substitution on container of working-dir-initializer #2039

liangyuanpeng opened this issue Feb 12, 2020 · 5 comments

Comments

@liangyuanpeng
Copy link

Expected Behavior

Actual Behavior

sh: syntax error: bad substitution

container log

Controlled By:  TaskRun/ncsrun-sample
Init Containers:
  working-dir-initializer:
    Container ID:  docker://be524cfd2fe971fb7b219589dcd39647ac2809420b9c77fc08a9696fd2f3e27b
    Image:         busybox
    Image ID:      docker-pullable://busybox@sha256:6915be4043561d64e0ab0f8f098dc2ac48e077fe23f488ac24b665166898115a
    Port:          <none>
    Host Port:     <none>
    Command:
      sh
    Args:
      -c
      mkdir -p ${inputs.params.directory}
    State:          Terminated
      Reason:       Error
      Exit Code:    2
      Started:      Wed, 12 Feb 2020 10:38:51 +0800
      Finished:     Wed, 12 Feb 2020 10:38:51 +0800
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /tekton/home from tekton-internal-home (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-9h9j5 (ro)
      /workspace from tekton-internal-workspace (rw)
  place-tools:
    Container ID:  
    Image:         gcr.azk8s.cn/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.10.1@sha256:cf0e81477c45dca0df6253e3239f6f0603700641292bf207503a7b267dc4c916
    Image ID:      
    Port:          <none>
    Host Port:     <none>
    Command:
      cp
      /ko-app/entrypoint
      /tekton/tools/entrypoint
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /tekton/tools from tekton-internal-tools (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-9h9j5 (ro)

Steps to Reproduce the Problem

  1. kubectl apply -f git-pip.yaml
  2. kubectl apply -f task-sample.yaml
  3. kubectl apply -f taskRun-sample.yaml

Additional Info

git-pip.yaml

apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
  name: ncs-git-source
spec:
  type: git
  params:
    - name: url
      value: https://github.com/ethfoo/test.git
    - name: revision
      value: master

task-sample.yaml

apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: ncs-sample
spec:
  inputs:
    resources:
      - name: gitssh
        type: git
    params:
      # These may be overridden, but provide sensible defaults.
      - name: directory
        description: The directory containing the build context.
        default: /workspace/ncs-git-source
  steps:
    - name: maven-install
      image: maven:3.5.0-jdk-8-alpine
      workingDir: "${inputs.params.directory}"
      args:
        [
          "mvn",
          "clean",
          "install",
          "-D maven.test.skip=true",
        ]
      volumeMounts:
        - name: m2
          mountPath: /root/.m2
  volumes:
    - name: m2
      hostPath:
        path: /tmp/.m2

taskRun-sample.yaml

apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  name: ncsrun-sample
spec:
  inputs:
    resources:
      - name: gitssh
        resourceRef:
          name: ncs-git-source
  taskRef:
    name: ncs-sample

I have not idea what for it
thanks any help!!

@skaegi
Copy link
Contributor

skaegi commented Feb 12, 2020

For your workingDir instead of curly brackets use round brackets... e.g.
workingDir: "$(inputs.params.directory)"

@dibyom
Copy link
Member

dibyom commented Feb 13, 2020

Yeah, the param substitution syntax changed from ${} to $() a while back.
Feel free to re-open this issue if the suggested change does not resolve this isse

@dibyom
Copy link
Member

dibyom commented Feb 13, 2020

/close

@tekton-robot
Copy link
Collaborator

@dibyom: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@liangyuanpeng
Copy link
Author

liangyuanpeng commented Feb 20, 2020

Yes, It's solved my problem
Thank you :)

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

4 participants