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

Make PipelineRun support parameterized trigger #187

Merged

Conversation

JohnNiang
Copy link
Contributor

@JohnNiang JohnNiang commented Aug 31, 2021

What this PR dose

Make PipelineRun support parameterized trigger.

Why we need it

For now, we can use this feature to test against kubesphere/ks-devops#210. In the future, we can trigger a parameterized Pipeline conveniently using this CLI.

How to use it

ks pip run -b -p demo-pipeline -n default -P name=johnniang,debug=true

@JohnNiang
Copy link
Contributor Author

/kind feature

@JohnNiang JohnNiang changed the title Make PipelineRun support parameterized trigger WIP: Make PipelineRun support parameterized trigger Aug 31, 2021
@JohnNiang JohnNiang changed the title WIP: Make PipelineRun support parameterized trigger Make PipelineRun support parameterized trigger Aug 31, 2021
@LinuxSuRen LinuxSuRen added the enhancement New feature or request label Aug 31, 2021
Copy link
Contributor

@LinuxSuRen LinuxSuRen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the following erorrs:

➜  bin git:(feat/pipelinerun-with-param) ./ks pip create
? Please select workspace name: test
? Please select project name: test
? Please select : simple
? Please input the Pipeline name ridgemoor
➜  bin git:(feat/pipelinerun-with-param) ./ks pip run
? Please select workspace name: test
? Please select project name: testlrjmw
? Please select pipeline name: ridgemoor
Usage:
  ks pipeline run [flags]

Flags:
  -b, --batch                       Run pipeline as batch mode
  -h, --help                        help for run
  -n, --namespace string            The namespace of target Pipeline
  -P, --parameters stringToString   The parameters that you want to pass, example of single parameter: name=value (default [])
  -p, --pipeline string             The Pipeline name that you want to run

failed create PipelineRun, error: PipelineRun.devops.kubesphere.io "ridgemoor6wpkt" is invalid: spec.parameters: Invalid value: "null": spec.parameters in body must be of type array: "null"

I guess that you forget to take care of those Pipelines which does not have parameters.

@JohnNiang
Copy link
Contributor Author

hi @LinuxSuRen , I've noticed the issue. If the problem is empty, there will be a problem. Refer to the BlueOcean RESTful API.

@LinuxSuRen
Copy link
Contributor

hi @LinuxSuRen , I've noticed the issue. If the problem is empty, there will be a problem. Refer to the BlueOcean RESTful API.

I didn't get your point.

@JohnNiang
Copy link
Contributor Author

My bad. Please see below:

I've noticed the issue. If the parameters are empty, there will be a problem. Refer to the BlueOcean RESTful API.

@LinuxSuRen
Copy link
Contributor

I've noticed the issue. If the parameters are empty, there will be a problem. Refer to the BlueOcean RESTful API.

So, how to fix that problem? Not intend to fix it?

@JohnNiang
Copy link
Contributor Author

So, how to fix that problem? Not intend to fix it?

Currently, we have to pass at least one parameters explicitly.

@LinuxSuRen
Copy link
Contributor

Currently, we have to pass at least one parameters explicitly.

Must pass a parameter even if there are no parameters in a Pipeline? I don't think this is acceptable. This is a breaking change.

@JohnNiang JohnNiang changed the title Make PipelineRun support parameterized trigger WIP: Make PipelineRun support parameterized trigger Sep 1, 2021
@JohnNiang JohnNiang changed the title WIP: Make PipelineRun support parameterized trigger Make PipelineRun support parameterized trigger Sep 1, 2021
@JohnNiang
Copy link
Contributor Author

Must pass a parameter even if there are no parameters in a Pipeline? I don't think this is acceptable. This is a breaking change.

Agree. I've resolved the breaking change. Please have a look at it.

@LinuxSuRen LinuxSuRen force-pushed the feat/pipelinerun-with-param branch from f2397fc to c47db95 Compare September 1, 2021 08:52
@JohnNiang JohnNiang force-pushed the feat/pipelinerun-with-param branch from c47db95 to f2397fc Compare September 1, 2021 08:55
Fix wrong format of PipelineRun template

Fix unquoted error of parameter value

Refine parameter flag

Remove unused parameter type

Add some tests against PipelineRun template parsing

Remove unused method
@JohnNiang JohnNiang force-pushed the feat/pipelinerun-with-param branch from f2397fc to 1c0c0bd Compare September 1, 2021 08:57
@codecov
Copy link

codecov bot commented Sep 1, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@25b55c3). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head f2397fc differs from pull request most recent head 1c0c0bd. Consider uploading reports for the commit 1c0c0bd to get more accurate results
Impacted file tree graph

@@           Coverage Diff            @@
##             master    #187   +/-   ##
========================================
  Coverage          ?   8.84%           
========================================
  Files             ?      32           
  Lines             ?    1311           
  Branches          ?       0           
========================================
  Hits              ?     116           
  Misses            ?    1185           
  Partials          ?      10           
Flag Coverage Δ
unittests 8.84% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25b55c3...1c0c0bd. Read the comment docs.

@LinuxSuRen LinuxSuRen merged commit aac855b into kubesphere-sigs:master Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants