Skip to content

UnsupportedOperationException when using Snippet Generator #72

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

Closed
wants to merge 4 commits into from

Conversation

guyv
Copy link

@guyv guyv commented Apr 8, 2019

When using the Jenkins snippet generator for your pipeline job (http://my-jenkins:8080/job/my-pipeline-job/pipeline-syntax/), you can configure the Stash Pull Requests Builder via the option 'properties: Set job properties' and then 'Build Triggers'.
When generating the script it will give you:
"properties([pipelineTriggers([<object of type stashpullrequestbuilder.stashpullrequestbuilder.StashBuildTrigger>])])"

Following stacktrace is found in the log:

java.lang.UnsupportedOperationException: no public field credentialsId (or getter method) found in class stashpullrequestbuilder.stashpullrequestbuilder.StashBuildTrigger
at org.jenkinsci.plugins.structs.describable.DescribableParameter.getValue(DescribableParameter.java:161)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.inspect(DescribableParameter.java:142)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:584)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:675)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.uncoerce(DescribableParameter.java:196)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.uncoerce(DescribableParameter.java:190)`

…tor of pipeline-syntax

java.lang.UnsupportedOperationException: no public field credentialsId (or getter method) found in class stashpullrequestbuilder.stashpullrequestbuilder.StashBuildTrigger
        at org.jenkinsci.plugins.structs.describable.DescribableParameter.getValue(DescribableParameter.java:161)
@jakub-bochenski
Copy link

Isn't this a duplicate of #69 ?

@guyv
Copy link
Author

guyv commented Apr 8, 2019

It is related. I first created a PR to be included in #69 (https://github.com/proski/stash-pullrequest-builder-plugin/pull/1), but the author saw it as a separate issue. @proski
This is not yet fixed in #69

@jakub-bochenski
Copy link

OK, so it's blocked by #69

@proski
Copy link

proski commented Apr 8, 2019

It's a completely separate PR. It can be merged without the pipeline support. Pipelines just expose some issues, but we don't need to wait for pipeline support to fix those issues.

I checked it with a freestyle project, the credentials still work, the configuration GUI looks good. I also checked other plugins (simple pull request job, Bitbucket pull request builder, Stash notifier and Git plugin), all of them use getCredentialId, not getcredentialId.

@jakub-bochenski
Copy link

OK, but what is the use of improving it while we don't support pipeline. I might be missing something.

Actually shouldn't the changes in #70 prevent snippet generator from displaying this at all?

@proski
Copy link

proski commented Apr 9, 2019

It's just a change to the getter name to conform with the camelCase convention. The conversion is documented:
https://wiki.jenkins.io/display/JENKINS/Basic+guide+to+Jelly+usage+in+Jenkins#BasicguidetoJellyusageinJenkins-Understandingtheitobject

The only pipeline dependency here is the commit description.

When I review code, I prefer small self-contained pull requests rather that a long branch that does everything. But I can add this commit to #70 to allow more meaningful testing of the pipelines.

@proski proski mentioned this pull request Apr 9, 2019
@jakub-bochenski
Copy link

When I review code, I prefer small self-contained pull requests rather that a long branch that does everything.

I also prefer to split the work into as small chunks as are still viable.
I dislike adding functionality that doesn't bring in value yet. In a more sophisticated setup one might use feature toggles, but I think using branches is good enough here.

I think we can apply both of those principles at the same time :)

@jakub-bochenski jakub-bochenski self-requested a review April 15, 2019 09:41
@proski
Copy link

proski commented Apr 24, 2019

@guyv, it turns out that another getter needs to be renamed. isCancelOutdatedJobsEnabled should be getCancelOutdatedJobsEnabled. Do you want to add that change to this PR?

@guyv
Copy link
Author

guyv commented Apr 25, 2019

@proski in a separate commit, I also renamed isIgnoreSsl to getIgnoreSsl

@jakub-bochenski
Copy link

@proski there's a bunch of conflicts in StashBuildTrigger now. Can you take a look or do we leave it as is until #69 is merged?

@proski
Copy link

proski commented Jul 2, 2019

I can resolve conflicts, but I don't have permissions to edit this PR. I would have to submit it separately. I can try adding unit tests using Descriptor#getPropertyType. This change doesn't need to wait for pipeline support, it is about following documented rules for descriptor methods.

@guyv
Copy link
Author

guyv commented Jul 2, 2019

@proski sure you can't edit? Allow edits from maintainers option is checked.

@jakub-bochenski
Copy link

I did some naive resolution, but some methods got moved to other files, so have to fix that

@proski sure you can't edit? Allow edits from maintainers option is checked.

Unfortunately he doesn't have maintainer permissions

@jakub-bochenski
Copy link

Closed in favour #112

@guyv thanks for doing the initial work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants