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

Edit and Run #2437

Closed
marniks7 opened this issue Sep 5, 2022 · 15 comments
Closed

Edit and Run #2437

marniks7 opened this issue Sep 5, 2022 · 15 comments
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@marniks7
Copy link
Contributor

marniks7 commented Sep 5, 2022

Is your feature request related to a problem ?

CI can be used not only for automated operations, but to run any task that user might need.

E.g. I would like to run E2E tests (pipeline) manually with some parameters. They can fail.
It is nice to be able to change one (few) parameters and rerun it once again.
Or another operation, e.g. download backup, upload backup or run deploy.

Tekton can be used as common purpose pipeline \ workflow engine, e.g. for Chaos Engineering, and to experiment we need to rerun with different parameters like "duration of chaos", "wait"

Describe the solution you'd like

I would like to see 'Rerun with Parameters' near 'Rerun' button for TaskRun\PipelineRun\Run

Jenkins analog: https://plugins.jenkins.io/rebuild/

Describe alternatives you've considered

kubectl apply -f with different parameters, no alternatives in UI

Additional context

  • The idea is to use the same form as for CreatePipelineRun and add parameter pipelinerun to url, this parameter can be used as template
    http://localhost:9097/#/pipelineruns/create?namespace=tekton-namespace&pipelinerun=my-previous-pipeline-run
  • New button
    image
  • One more problem I see that Rerun with Parameters for this approach will support only those parameters that are specified in CreatePipelineRun.js, in particular I am worried about absence of workspaces. This can be done in separate PR
  • I am willing to implement this functionality if no concerns
@marniks7 marniks7 added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 5, 2022
@AlanGreene
Copy link
Member

AlanGreene commented Sep 5, 2022

Thanks for the feature request @marniks7. I think this makes a lot of sense and would be great to add. However, as you mentioned I also have some concerns about missing support in the existing Create PipelineRun UI, particularly for workspaces, but also array params.

Adding a 'Rerun with parameters' (naming might need some work, 'parameters' is an overloaded term) makes it more likely that users will run into issues and could potentially end up with unexpected behaviour depending on how their pipelines are written. I think it's important that the user has full visibility into what they're creating, so not showing unsupported fields but having them passed in the background would not be good. Likewise, stripping unsupported fields wouldn't be great either as it's unlikely this would yield the desired outcome.

We're tracking the missing functionality for the Create UI in #1283 and #2171. Any contributions (design, investigation, code, …) on either of those would be very welcome and get us closer to being able to add this new feature safely.

@marniks7 marniks7 changed the title Rerun with Parameters Edit and Run Sep 12, 2022
@marniks7
Copy link
Contributor Author

marniks7 commented Sep 12, 2022

@AlanGreene , I was thinking about this feature and has another proposal:
Edit YAML and Run - this is reliable and advanced solution, which will allow to edit YAML, so user will achieve 'whatever floats user boat'.

Edit and Run (just renamed Rerun with Parameters)
To make it reliable it will require deep YAML analyze: backend vs UI: comparison for all supported fields by UI. In case if all fields supported by UI - show form Create PipelineRun with values, otherwise fallback to Edit YAML and Run.
However, I have no idea yet how to make such deep analyze :)

@AlanGreene
Copy link
Member

A YAML input to create a run or edit and rerun an existing one sounds good to me as an escape hatch for unsupported features in the UI or if someone just has a blob of YAML somewhere already that they want to execute.

To make it reliable it will require deep YAML analyze backend

Can you elaborate on what you mean by this?

@marniks7
Copy link
Contributor Author

marniks7 commented Sep 20, 2022

unsupported features in the UI are inevitable, we cannot keep up with all backend alpha features and different backend \ UI versions can be used.
Nevertheless, in order to support Edit and Run (without YAML as input), we need to be able to understand if ALL fields in current yaml are supported by current UI or not.
For example, list of supported fields can be described as those:

  • apiVersion
  • kind
  • spec.workspaces.[].name
  • spec.workspaces.[].configMap.name
  • spec.workspaces.[].secret.secretName
  • spec.pipelineRef.name
  • spec.serviceAccountName

If PipelineRun YAML contains any field except above - we fallback to direct YAML edit, otherwise Edit and Run.


Another idea:
We can take YAML schema, keep all fields supported by UI and validate that PipelineRun YAML corresponds to that schema.

@AlanGreene
Copy link
Member

I think a good starting point would be to always present the option to switch to 'YAML mode'. That would unblock users who want to use features not currently supported in the UI, and buy us time to figure out the best approach to handle this (new UI, comparison of supported features, detect when UI doesn't support a used feature, etc.).

@marniks7
Copy link
Contributor Author

marniks7 commented Oct 3, 2022

Hi @AlanGreene,

How do you want to handle this?

  1. Step1: Is it fine to implement "Switch to YAML" on CreatePipelineRun page first without switch back?
  2. Step2: Support "Edit and Run" as YAML option by default
  3. Step3: Refactor CreatePipelineRun.js to have the same format as PipelineRun in backend
  4. Step4: Allow switch back, all unsupported fields will NOT be removed, but stored
  5. Step5: Detect when UI doesn't support something and show warning(?)

Create as YAML

  1. Use Monaco-Editor and add React Monaco Editor
  2. On CreatePipelineRun page add toggle to switch to yaml. Could you please add your vision where this toggle (or maybe another element type) should be?
    Toggle:
    image
    Monaco-Editor:
    image
  3. In order to switch from model to yaml just convert to YAML
  4. Add support for yamlmode=true to the query params when yaml mode is turned on

Edit and Run

  1. Add pipelinerun to the URL query params for CreatePipelineRun
  2. Open CreatePipelineRun in yamlmode=true with pipelinerun=XXX

Important Notes

  1. Unfortunately, Content-Security-Policy will require downgrade because of
    Do not use inline styles! microsoft/monaco-editor#271
  2. Possible improvement. For yaml-schema suggestions & validations use monaco-yaml. Because monaco doesn't support it for yaml Feature request: support JSONSchema with YAML microsoft/monaco-editor#1470

Model Options and type-safe validations in runtime (for future)

  1. Generate models for Tekton Run(s) from CRDs or json schema
    1.1. Option to check2 https://github.com/bcherny/json-schema-to-typescript
    1.2. Option to check1 kubernetes-models-ts
    1.3. Drop fields NOT supported in UI (?)
  2. OR play with type safe

@tekton-robot
Copy link
Contributor

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 Jan 3, 2023
@AlanGreene
Copy link
Member

/remove-lifecycle stale
This is currently in progress. We already have a YAML mode for creating a PipelineRun, and there's a PR open adding the ability to edit YAML of an existing run as the basis for creating a new one.

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 3, 2023
@AlanGreene
Copy link
Member

We recently updated the Dashboard to display list and details pages for the new v1beta1 CustomRun (replacement for the deprecated v1alpha1 Run).

Now that we have the YAML mode for Create PipelineRun we should add the same (including this edit and rerun feature) for both TaskRun and CustomRun to ensure consistency.

@AlanGreene
Copy link
Member

/area roadmap

@tekton-robot tekton-robot added the area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) label Feb 15, 2023
@tekton-robot
Copy link
Contributor

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 May 16, 2023
@AlanGreene
Copy link
Member

/remove-lifecycle stale

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 16, 2023
@tekton-robot
Copy link
Contributor

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 Aug 14, 2023
@AlanGreene
Copy link
Member

/lifecycle frozen

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 14, 2023
@AlanGreene
Copy link
Member

Edit and run functionality is available for PipelineRun, TaskRun, and CustomRun resources via the YAML mode editor. There are no current plans to expand the form-based UI capabilities so closing for now. We may revisit this in future as part of broader changes to the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
Status: Done
Development

No branches or pull requests

3 participants