tabeyti / jenkins-jack

Jack into your Jenkins to execute Pipeline scripts, provide Pipeline step autocompletions, pull Shared Library step documenation, run console groovy scripts across multiple nodes, and more! Honestly, not that much more.
Other
97 stars 32 forks source link

[Feature Request] pipeline build with parameters interactive select #10

Closed yuechuanx closed 3 years ago

yuechuanx commented 4 years ago

hi, i wrote pipeline with git parameter filter like this gitParameter branchFilter: '.*kernel.*', defaultValue: 'master', name: 'GIT_KERNEL_BRANCH', type: 'PT_BRANCH', useRepository: '.xxx.git', sortMode: 'DESCENDING_SMART' and when i execute this pipeline, normally i will select my specific branch in build with paramter tab. so i hope we can just select my params use jenkins-jack

tabeyti commented 4 years ago

Hey @yuechuanx ,

You can definitely use parameters with your .groovy pipeline file. The extension creates and uses a config file when you run a .groovy file as a pipeline, where parameter values can be edited.

See the bottom of Execute.

For instance, if your file was named mypipeline.groovy and you ran it with the Pipeline Jack, the extension would create a .mypipeline.config.json file right next to your mypipeline.groovy file that has parameters you can edit.

Please let me know if this answers your issue.

yuechuanx commented 4 years ago

hi, @tabeyti

Thanks for getting back to me.

The condition when i execute my pipeline the param filter will return a param list to select. like:

image

Now the jenkins-jack way is to find the.config.json file get the params then execute.

But is it possible jenkins-jack could like that, when i execute my pipeline will return a param's list to let me chose which version, so i don't need to change the params in .config.json every time when execute same pipeline but different params. it's pretty annoying...

Please let me know what you think.

tabeyti commented 4 years ago

I have good news and some not-so-good news.

Good News!

I think that this is a great feature request: allow interactive build parameter input.

Personally, I normally stub out my build parameters in the script while i'm developing with the extension, then remove the stubs when i'm ready to check in.

You have a different dev flow in your case, which is informative, so thanks!

I plan on puting this feature in on the next release 1.0.2

Not So Good News

Based on your screenshot, you are using build parameter plugins (e.g. Extended Choice) for your parameters. From my research, these plugins don't expose their choices via any Jenkins api (legacy, wfapi, blueocean, etc.), so currently there is no way for the extension to get that information :(

Until that info is exposed, Jenkins Jack will only be able to support the built in build parameter types, most which are also supported by blueocean: boolean, string, choice, credentials

Maybe Some Better News?

For parameters the extension is unable to get choice information from (e.g. Extended Choice), I could expose an override in the .config.json that would allow a user to put in choices for specific parameter keys. The interactive input could then provide these to the user as selections.

Example:

    "params": {
        "GIT_APP_BRANCH": "origin/ham_0.0.37",
    },
    "interactiveInputOverride": {
        "GIT_APP_BRANCH": [
            "origin/ham_0.0.37",
            "origin/ham_0.0.35",
            "origin/ham_0.0.33",
            "origin/ham_0.0.31",
            "origin/ham_",
        ]
    }

How helpful this would be for you depends on your development flow. If you are always adding entries into those parameters on the Jenkins side, that means you are always having to update your .config.json to contains the same information.

Let me know what you think.

yuechuanx commented 4 years ago

Wow, thanks for bring that good news. @tabeyti

I think it will work if i write a scripts or some hooks that could auto update my branches in .config.json file, based on my work flow.

jenkins-jack can do more things with the feature, that is a great thing.

tabeyti commented 3 years ago

Hey @yuechuanx , apologies for the super late follow up on this. Version 1.10 now supports this feature.

yuechuanx commented 3 years ago

wow @tabeyti Read these release features, that's so coooool~. the views are very helpful for managing nodes and pipelines.

I think the plugin is more powerful and gonna be more polular. yep!

THANK YOU!!!