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

Provide a mechanism to more easily access the "event" in a workspace in pipelines #1574

Open
skaegi opened this issue Apr 5, 2023 · 5 comments
Assignees

Comments

@skaegi
Copy link
Contributor

skaegi commented Apr 5, 2023

We run a slightly forked implementation of triggers that allows creation of the standard tekton resources as well as "configmaps". The "main" reason we need configmaps is because teams invariably want to package up the event (head and body). Typically done like so...

apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
  name: event-listener
spec:
  triggers:
    - bindings:
        - name: header
          value: $(header)
        - name: body
          value: $(body)
      template:
        ref: trigger-template
---
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
  name: trigger-template
spec:
  params:
    - name: header
    - name: body
  resourcetemplates:
    - apiVersion: v1
      kind: ConfigMap
      metadata:
        name: event-$(uid)
      data:
        header: $(tt.params.header)
        body: $(tt.params.body)
    - apiVersion: tekton.dev/v1beta1
      kind: PipelineRun
      metadata:
        generateName: pipelinerun-
      spec:
        pipelineRef:
          name: pipeline
        workspaces:
          - name: event
            configmap:
              name: event-$(uid)

This pattern is incredibly common -- near 100% of our pipelines use some variant of populating a workspace with the "event". Is there something we could do to make this somehow much easier and let us stop using a triggers "fork".

@skaegi skaegi changed the title Provide a mechanism to more easily access the "event" in pipelines Provide a mechanism to more easily access the "event" in a workspace in pipelines Apr 5, 2023
@savitaashture
Copy link
Contributor

Hey @skaegi It would be helpful if you provide the usecase of this request

@anasinnyk
Copy link

I have some use-case for that. We deploy our trigger by GitOps and we want to have a more declarative way. We want to build our container image by KPack. We expect to catch GitHub PR webhook and create KPack manifest without any pipeline in the cluster. It will be really helpful if trigger support different kubernets resources.

@skaegi
Copy link
Contributor Author

skaegi commented May 11, 2023

We have many users coming from different CIs that allowed users to write scripts against the event payload content for things like conditional logic and also for audit purposes. By moving the event into a well-known pipeline workspace name teams could access and parse the event payload themselves in their Tasks which in many cases is more flexible than doing this with bindings and having to add a ton of parameterization .

@tekton-robot
Copy link

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 7, 2023
@dibyom
Copy link
Member

dibyom commented Nov 15, 2023

I think we should allow creating configmaps.
For the specific use case of passing trigger data to pipelineruns, we also have a TEP which could provide an alternative implementation: tektoncd/community#1087

@dibyom dibyom removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 15, 2023
@khrm khrm modified the milestones: Triggers v0.27, Triggers v0.28 May 10, 2024
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

6 participants