jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.43k stars 613 forks source link

Documentation refers to GitLab documentation but doesn't support all build state #1668

Open HeikoBoettger opened 2 months ago

HeikoBoettger commented 2 months ago

Jenkins and plugins versions report

java.lang.IllegalArgumentException: No enum constant com.dabsquared.gitlabjenkins.gitlab.api.model.BuildState.manual at java.base/java.lang.Enum.valueOf(Enum.java:240) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:476) at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:409) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:329) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:305) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:196) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:124) at jdk.internal.reflect.GeneratedMethodAccessor155140.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:180) at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:163) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:148) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:178) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:182) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17) Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: eaeb3e10-7815-4a83-a369-a88fb00c9b4f Caused: java.lang.IllegalArgumentException: Could not instantiate {name=jenkins, state=manual} for com.dabsquared.gitlabjenkins.workflow.UpdateGitLabCommitStatusStep at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:334) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:305) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:196) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:124) at jdk.internal.reflect.GeneratedMethodAccessor155140.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

What Operating System are you using (both controller, and any agents involved in the problem)?

doesn't matter

Reproduction steps

Create a pipeline and try to pass "manual" as status when invoking gitlabUpdateCommitStatus.

Expected Results

Since the documentation tells to lookup the GitLab API documentation, I would expect that the status is just passed as it is to GitLab. Further I would assume that GitLab already give a http status code when there is bad status value so the plugin could just check for an error returned by gitlab.

Proposal: check whether it is really needed to have conversion to the enum

Actual Results

It fails due because the plugin wasn't updated to support the new values.

Anything else?

No response

Are you interested in contributing a fix?

Yes, as long as it's only adding the missing enum value and there are no test to update.