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 variables in generateName field #4143

Closed
hokadiri opened this issue Aug 7, 2021 · 9 comments
Closed

Allow variables in generateName field #4143

hokadiri opened this issue Aug 7, 2021 · 9 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@hokadiri
Copy link

hokadiri commented Aug 7, 2021

Feature request

Allow variable names in generateName field of pipelinerun. Allows one to set useful variables so its more apparent at a tkn or dashboard level

Use case

Our pipelines are triggered from git events based off git sha. I want to know set git sha in the pipelinerun name

apiVersion: tekton.dev/v1beta1
    kind: PipelineRun
    metadata:
      generateName: pr-$(params.git-sha)-run-
    spec:
      pipelineRef:
        name: some-pipeline

it would be nice to be able to see what pipelineruns map to what git sha at the dashboard view of pipelineruns.

Screen Shot 2021-08-07 at 1 33 24 PM

Or from tkn

$ tkn pipelinerun list -n android
NAME                        STARTED        DURATION     STATUS
commit-verify-p-run-zb422   16 hours ago   16 minutes   Failed
commit-verify-p-run-4c5tl   17 hours ago   17 minutes   Failed
commit-verify-p-run-cqq5l   18 hours ago   16 minutes   Failed
commit-verify-p-run-gztrb   19 hours ago   18 minutes   Succeeded(Completed)
commit-verify-p-run-t67q6   19 hours ago   16 minutes   Failed
commit-verify-p-run-mq2d7   20 hours ago   13 minutes   Succeeded(Completed)
commit-verify-p-run-jdx69   20 hours ago   14 minutes   Succeeded(Completed)
commit-verify-p-run-bn55l   20 hours ago   13 minutes   Succeeded(Completed)
commit-verify-p-run-w6qbh   20 hours ago   25 minutes   Failed
commit-verify-p-run-cw4fs   20 hours ago   18 minutes   Succeeded(Completed)
commit-verify-p-run-m8phj   20 hours ago   5 minutes    Succeeded(Completed)
commit-verify-p-run-t22sv   21 hours ago   5 minutes    Succeeded(Completed)
commit-verify-p-run-rbrlx   21 hours ago   24 minutes   Failed
commit-verify-p-run-pdh2l   21 hours ago   27 minutes   Failed
commit-verify-p-run-4gd7d   21 hours ago   19 minutes   Succeeded(Completed)
commit-verify-p-run-twwmw   21 hours ago   5 minutes    Succeeded(Completed)
commit-verify-p-run-5wqm2   21 hours ago   8 minutes    Succeeded(Completed)
commit-verify-p-run-fcjx2   21 hours ago   18 minutes   Succeeded(Completed)
commit-verify-p-run-zdg9c   22 hours ago   8 minutes    Failed
commit-verify-p-run-nbvkb   22 hours ago   16 minutes   Failed
@hokadiri hokadiri added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 7, 2021
@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
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 with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

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 Nov 5, 2021
@hokadiri
Copy link
Author

hokadiri commented Nov 6, 2021

/remove-lifecycle stale
Still needed please !

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2021
@vdemeester
Copy link
Member

Hey @hokadiri,
I think this is possible if you use tektoncd/triggers and/or an external tool that would "generate" the generateName 😅 (cc @dibyom @savitaashture).

It is technically very difficult to impossible to have variable interpolation in the metadata part of our object as this is not something we control (it's the common part of all kubernetes objects). Variable interpolation is done at "runtime", aka once the object are already created (and stored) in kubernetes, and thus, we cannot mutate the name once it's already created.

@dibyom
Copy link
Member

dibyom commented Nov 9, 2021

You can do this in Triggers for sure in a triggerTemplate:

metadata:
  generateName: pr-$(tt.params.git-sha)-

@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
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 with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

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 Feb 7, 2022
@lbernick
Copy link
Member

lbernick commented Feb 7, 2022

/close

based on explanations from @vdemeester and @dibyom

@tekton-robot
Copy link
Collaborator

@lbernick: Closing this issue.

In response to this:

/close

based on explanations from @vdemeester and @dibyom

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.

@arturia-ci-service
Copy link

You can do this in Triggers for sure in a triggerTemplate:

metadata:
  generateName: pr-$(tt.params.git-sha)-

Have you tried this? For me it is not working...

Thanks

@elysian-gc
Copy link

You can do this in Triggers for sure in a triggerTemplate:

metadata:
  generateName: pr-$(tt.params.git-sha)-

Have you tried this? For me it is not working...

Thanks

I tryed,it`s working good

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. 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

7 participants