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

Can not detective parameter property of Pipeline Jenkins job #54

Open
Vicky000 opened this issue Dec 19, 2019 · 0 comments
Open

Can not detective parameter property of Pipeline Jenkins job #54

Vicky000 opened this issue Dec 19, 2019 · 0 comments

Comments

@Vicky000
Copy link

Hi there,
This should require an enhancement to jenkins.go.
When I request a pipeline jenkins job (with parameters), there's no any "actions" has ParameterDefinitions returned.
So when the process goes to below function, it always returns false.
// hasParams returns a boolean value indicating if the job is parameterized func hasParams(job Job) bool { for _, action := range job.Actions { if len(action.ParameterDefinitions) > 0 { return true } } return false }

I just found the difference of the way Jenkins API indicates parameter property of a job between freestyle project and pipeline:
with freestyle project,the parameter property is wrapped in "actions":
"actions": [ { "_class": "hudson.model.ParametersDefinitionProperty", "parameterDefinitions": [ { "_class": "hudson.model.ChoiceParameterDefinition", "defaultParameterValue": { "_class": "hudson.model.StringParameterValue", "value": "app" }, "description": "", "name": "app", "type": "ChoiceParameterDefinition", "choices": [ "print-app", "idm-app", "file-app" ] } ] }, {}, {}, {}, {}, {}, { "_class": "com.cloudbees.plugins.credentials.ViewCredentialsAction" } ],

with pipeline , the parameter property is wrapped in "property":
"property": [ { "_class": "hudson.model.ParametersDefinitionProperty", "parameterDefinitions": [ { "_class": "com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition", "defaultParameterValue": null, "description": "", "name": "Jar_to_Publish", "type": "PT_CHECKBOX" } ] } ],

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

1 participant