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

Allow resourceSpec within Pipeline definitions #2284

Closed
adrianriobo opened this issue Mar 25, 2020 · 7 comments
Closed

Allow resourceSpec within Pipeline definitions #2284

adrianriobo opened this issue Mar 25, 2020 · 7 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. kind/question Issues or PRs that are questions around the project or a particular feature lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@adrianriobo
Copy link

adrianriobo commented Mar 25, 2020

Expected Behavior

Allow using resourceSpec within pipeline definitions. The use case is related to runtime params, it is expected to use as a task input resource (git) with a parameter resulting from a previous task within the pipeline.

Example:

---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: pipeline-dev
spec:
  ...
  tasks:
    - name: get-servingrepository
      taskRef:
        name: get-servingrepository
      resources:
        inputs:
          - name: repository
            resource: source-repository
    - name: deploy-to-develop
      taskRef:
        name: kubectl-exec
      runAfter: ["get-servingrepository" , "build-and-push-image"]
      params:
        - name: kubectl-args
          value: ["apply", "-f", ".", "-n", "dev"]
      resources:
        inputs:
          - name: repository
            resourceSpec:
               type: git
               params:
                 - name: revision
                   value: develop
                 - name: url
                   value: $(tasks.get-servingrepository.results.serving-repository)

Actual Behavior

Get an error when creating the pipeline:

Error from server (InternalError): error when creating "pipeline/pipeline-dev_no_func.yaml": Internal error occurred: admission webhook "webhook.tekton.dev" denied the request: mutation failed: cannot decode incoming new object: json: unknown field "resourceSpec"

Additional Info

  • Kubernetes version:
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.9-eks-502bfb", GitCommit:"502bfb383169b124d87848f89e17a04b9fc1f6f0", GitTreeState:"clean", BuildDate:"2020-02-07T01:31:02Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
  • Tekton Pipeline version:
    0.10.1
@ghost
Copy link

ghost commented Mar 26, 2020

Just wanted to clarify :- you are able to use a resourceSpec directly in your PipelineRuns, and I believe you should be able to refer to task results in the param values that you feed to a Pipeline Task from the PipelineRun.

I'm not 100% clear on the use case for putting a resourceSpec directly into a Pipeline. Could you describe a bit more the problem you're trying to solve?

@ghost ghost added kind/feature Categorizes issue or PR as related to a new feature. kind/question Issues or PRs that are questions around the project or a particular feature labels Mar 26, 2020
@adrianriobo
Copy link
Author

Hi @sbwsg sorry for the late reply... just let me try to explain my use case;

First, just clarify I am using tekton triggers to integrate github + tekton, so pipelineruns are managed by triggers and I just can play with paremeters in the request. to template the pipeline...

Got 1 project with my source code for my app: https://github.com/org/app/source-code.git
Got 1 project with serving file for my app: https://github.com/org/app/serving.git

I configured the webhook at source code project, so it will be executed on every push there...

My pipeline just: build code, build the image, push the image and finally deploy... to deploy it is required to clone the serving project (which contains the manifests)....

Binding parameters with triggers does not support any kind of string manipulation...so I can not get the url of the serving project.

With my previous example I can use the source code project url ... do some manipulation (one task) and then use it as input in other task, specially convenient as git resource. But to do this approach I require this resourceSpec at Pipeline definition.

Hope this helps to understand, please let me know if you have any other suggestions.

@adrianriobo
Copy link
Author

Just found this and this issue regarding not promoting pipeline resources to beta so a task equivalence is released...

This will fit totally in my use case, so maybe there is no point to evolve pipeline resources

ad22 pushed a commit to ad22/pipeline that referenced this issue Apr 1, 2020
The git pipeline resource does not allow for any use case beyond
a basic "fetch",. There are also some hacks in place, including git
reset --hard when checkout fails directly on the master branch, etc,
which leads to inconsistent behavior (see tektoncd#2282). The end result is that
most users end up creating their own custom containers for fetching
and checking out what they need. This change makes the git resource
much more extensible, via an optional refspec parameter.

This change should be fully backward compatible w.r.t to revision parameter
EXCEPT the ability to fetch git commit short hashes (according
to the e2e tests)

- Adds ability to checkout older commit hashes on a particular ref
  chain (when fetch via commit SHA is not enabled on the server)
- Adds ability to fetch several other refs (for example, refs/tags)
  alongside the main revision
- Provides resolution for tektoncd#2282 - If the user needs to checkout a branch,
  they must specify the appropriate refspec and revision as the ref of the
  branch. There was no way to do this in the original implementation
- Fixes bug reported in tektoncd#2282 by ensuring the revision is always checked
  out on a detached HEAD when specified w/o refspec
- Fixes bug - depth parameter is not passed to git submodule update, leading to
  unnecessary data transfer
- Fixes bug --recurse-submodules is appended to the fetch command even when
  the user specified submodule: "false", leading to unnecessary data transfer

Fixes tektoncd#2284
@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 13, 2020
@tekton-robot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 13, 2020
@tekton-robot
Copy link
Collaborator

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. kind/question Issues or PRs that are questions around the project or a particular feature lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants