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 modify the spec of a PipelineRun when it is in the PipelineRunPending state #8150

Open
l-qing opened this issue Jul 24, 2024 · 0 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@l-qing
Copy link
Contributor

l-qing commented Jul 24, 2024

Feature request

Allow modify the spec of a PipelineRun when it is in the PipelineRunPending state.
(Feature flag control can be applied)

In this Issue #8148, I propose that once a TaskRun or PipelineRun is created, many fields in the spec should not be allowed to be modified.

The purpose is to avoid impacting tasks that are already in execution. In the vast majority of scenarios, the fields of the spec should not be modified.

However, there are some exceptions.

For instance, if the PipelineRun has not started executing any tasks and is still in the PipelineRunPending state, modifying the fields of the spec at this time will not result in unstable execution outcomes.

Use case

The existing webhook mechanism cannot complete the modifications.

  • Modifications are very time-consuming and may even require third-party components.
  • Multiple components need to be modified in sequence, with subsequent components referencing the modification results of the preceding components.
  1. I trigger a Pending PipelineRun in OpenShift using Pipeline-as-Code.
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: pr-pending
  annotations:
    pipelinesascode.tekton.dev/on-event: "[pull_request, push]"

    pipelinesascode.tekton.dev/on-target-branch: "[main, master]"

    pipelinesascode.tekton.dev/on-comment: "^/test-pr"

    # Declare some configurations that can affect the modify of the pipeline
    custom.tekton.dev/timeouts: "For example, dynamically adjusting timeouts based on rules, and implementing complex logic that is inconvenient in webhooks."

    custom.tekton.dev/tasks: "It is necessary to orderly modify and add tasks through multiple components."

  labels:
    # Specify who needs to start the pipeline. The spec can also be modified before starting if needed.
    custom.tekton.dev/started-by: "other-components"
spec:
  status: PipelineRunPending
  pipelineRef:
    name: pipeline
  1. I customized a controller to specifically watch for PipelineRuns with pipelineascode.tekton.dev/started-by: "other-components" in their labels and are in a Pending state.

  2. In my controller, I can modify the PipelineRun’s spec as needed. I can even request time-consuming third-party services to complete the modifications without worrying about webhook timeout issues.

  3. I can predefine multiple controllers to modify the PipelineRun’s spec in sequence orderly. This is something that webhooks cannot achieve.

@l-qing l-qing added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 24, 2024
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.
Projects
None yet
Development

No branches or pull requests

1 participant