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 pipeline - parameters are not getting replaced recursively #1524

Closed
maheshwarishikha opened this issue Nov 5, 2019 · 11 comments
Closed
Labels
kind/question Issues or PRs that are questions around the project or a particular feature

Comments

@maheshwarishikha
Copy link

Expected Behavior

After running pipeline-run, parameters value provided in pipeline-run should substitute parameters in Pipeline, then in task and so on.

Actual Behavior

No value is being substituted, hence it is failing with message "$(input.params.pathToYamlFile): No such file or directory"

What could be the reason of this? Is there a way that I can check if there is any syntax error in yaml files.
Kindly help.
Thanks.

@vdemeester
Copy link
Member

Hi @maheshwarishikha, thanks for the issue. Can you share the yamls for your PipelineRun, Pipeline and Tasks ?

@maheshwarishikha
Copy link
Author

@vdemeester , Thanks for the prompt response.
Files are attached here.

files.zip

@maheshwarishikha
Copy link
Author

Hi @vdemeester , did you get a chance to look at files...? Please do check ...it is like blocker for me and I have tried many things...but no luck yet. Thanks in advance.

@vdemeester
Copy link
Member

@maheshwarishikha I took a look. This is by design "so far". You have to pass params explicitely to your Task when referencing it. From your file, you need to update your Pipeline to something like the following.

apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: create-pipeline
spec:
  resources:
    - name: git-source
      type: git
  params:
    - name: pathToYamlFile
      description: The path to the yaml file to deploy within the git source
      default: configuration.yaml
    - name: imageUrl
      description: Url of image repository
      default: deploy_target
    - name: imageTag
      description: Tag to apply to the built image
      default: latest
  tasks:
  - name: deploy-application
    taskRef:
      name: deploy-application
    params:
    - name: pathToYamlFile
      value: $(params.pathToYamlFile)
    - name: "imageUrl"
      value: $(params.imageUrl)
    - name: "imageTag"
      value: "$(params.imageTag)
    resources:
      inputs:
        - name: git-source
          resource: git-source

The issue #1484 is tracking discussion wether we should automatically pass parameters (and resources) from pipeline to task if the have the same name.

@vdemeester vdemeester added the kind/question Issues or PRs that are questions around the project or a particular feature label Nov 6, 2019
@maheshwarishikha
Copy link
Author

@vdemeester , ohh...my bad. I am doing this way only but the files I uploaded does not have that change.
It is not working in this way as well. Updated files are attached here.

Updated_files.zip

Very sorry for the confusion.

@vdemeester
Copy link
Member

@maheshwarishikha the updated files seems ok too. You are using the same value for the parameter as the default value deploy.yaml… What is the error you are seeing ? 🤔

@maheshwarishikha
Copy link
Author

@vdemeester , I get following error -
$ kubectl -n default logs application-pipeline-run-deploy-application-dxl7z-pod-ea1d58 -c step-update-yaml
sed: /workspace/git-source/$(params.pathToYamlFile): No such file or directory

Describing pipeline/task - it shows parameters as $(params.pathToYamlFile) not with their substituted value.

@vdemeester
Copy link
Member

@maheshwarishikha oh, I think I see what is the problems, params are under inputs in the Task, it should be "/workspace/git- source/$(inputs.params.pathToYamlFile)" instead of "/workspace/git-source/$(params.pathToYamlFile).

(Related issue on the params.Foo vs inputs.params.Foo: #1185)

@maheshwarishikha
Copy link
Author

@vdemeester , I have tried both...both fails.:(
sed: /workspace/git-source/$(input.params.pathToYamlFile): No such file or directory

@maheshwarishikha
Copy link
Author

It worked finally. Thanks.

@maciejs20
Copy link

try ${input.params.pathToYamlFile} instead if $(input.params.pathToYamlFile). It works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Issues or PRs that are questions around the project or a particular feature
Projects
None yet
Development

No branches or pull requests

3 participants