Open danielfm opened 6 years ago
What config do you have?
Hi.
I'm running Jenkins ver. 2.107.3 on AWS.
Taking one of the failing jobs as an example (which is a declarative multi-branch pipeline):
And this is the Pipeline code, with some strings redacted:
def subdir = 'some-dir/deploy'
pipeline {
agent {
dockerfile {
label 'linux'
dir subdir
}
}
options {
timeout(time: 5, unit: 'MINUTES')
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
AWS_ACCESS_KEY_ID = credentials('some-credential')
AWS_SECRET_ACCESS_KEY = credentials('some-credential')
// Store user-specific config in the current directory, instead of /
HOME = '.'
}
stages {
stage('Test') {
failFast true
parallel {
stage('Step') {
steps {
sh "cd $subdir ; ./make/test.sh"
}
}
stage('Lint') {
steps {
sh "cd $subdir ; ./make/lint.sh"
}
}
}
}
stage('Publish') {
when {
branch 'master'
}
steps {
sh "cd $subdir ; ./make/build.sh"
sh "cd $subdir ; ./make/publish.sh"
}
}
}
}
If by 'config' you meant other things, let me know so I can give you the correct data. :)
Could you try /0.2.0-rc-2 ?
Sure, I'll give it a shot in a few hours, when our CI activity slows down a little bit. I'll post an update here afterwards.
Thanks for your help!
Having the same problem. Still happening with 0.2.0-rc-2 (Jenkins ver. 2.126)
thanks for information
Also tested the 0.2.0-rc-2 release and the error still happens, as reported above.
did some debugging: one of our stages has
when {
anyOf { branch 'master'; branch 'develop' }
}
when I take those lines out it works
what structs-plugin version do you have?
1.14
Same here (the structs-plugin version, not removing the when
; I'll try that later).
@jglick why 'branch' symbol conflicts while it under other extension point tree?
I also confirm that the pipeline only fails when using the branch
condition in when
; I tried other conditions, such as equals
and changeset
, and they both work.
This has also started happening to me today after updating jenkins plugins via the update UI.
FYI for anyone having this trouble, I downgraded via the Jenkins plugin UI back to 0.1.0-rc29
from 0.2.0-rc-2
and my builds are all working again now.
when { anyOf { branch 'master'; branch 'develop' } }
is it declarative syntax?
Could somebody fill issue in jenkins JIRA against pipeline? I think their syntax conflicts with symbols (that i think correctly implemented on my side).
that didn't help
java.lang.IllegalArgumentException: Arguments to class com.github.kostyasha.github.integration.multibranch.handler.GitHubBranchHandler have to be explicitly named
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:276)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:87)
at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.instantiateDescribable(Utils.groovy:407)
at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$instantiateDescribable$6.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:188)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onStaticCall(GroovyInterceptor.java:35)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:158)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:186)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:190)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:97)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.instancesFromClosure(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:621)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateWhen(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:601)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:240)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:494)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:493)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:239)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:304)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:303)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:217)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:521)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:520)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:200)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
at sun.reflect.GeneratedMethodAccessor238.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
at sun.reflect.GeneratedMethodAccessor241.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Thanks @danielfm for your comment- wouldn't have thought to try alternative keywords. I can confirm it's only with branch
. FYI- here's a workaround for anyone else in this situation:
when {
expression {
env.BRANCH_NAME.toString().equals('master') || env.BRANCH_NAME.toString().equals('develop')
}
}
They really need to beef up the documentation on these. For more usage examples using when
/expression
, see here
@KostyaSha I dont have experience debugging jenkins plugins, but willing to help out with testing. Do I need to uninstall current plugin first or just upload that directly and it will overwrite?
yes, upload this hpi into your jenkins plugin manager, for rollback it will provide "downgrade" button new plugin version.
@KostyaSha Seems like that may have done the trick. I reverted my workarounds and re-introduced branch
on 2 repos. both seem to be building like normal again.
that mean that symbols has conflicts where they shouldn't @jglick CC
@KostyaSha props to you for debugging when not your fault! And yeah that would make sense since the issue only cropped up after updating other plugins. FYI this is jenkins 2.27
Also tested the new .hpi with one of my jobs, and it worked. 🎉
Hey there, thanks for the fix - does 0.2.1 include the workaround?
in latest version it is not fixed yet, still cant use branch and tag keywords inside the pipeline.
Sorry, I have no context for this. If you think there is a bug in structs
, please file it with steps to reproduce.
Sounds like declarative or whatever else doesn't keep ExtensionPoint scope. Because of it every plugin should use unique symbols. One more jenkins disaster design if i correctly understood. So now i can only break existing configurations and replace symbols with prefixes. This is especially funny because duplicated functionality was implemented in cb plugins after this functionality was here, but symbols were added earlier.
To whomever else stumbles upon this trying to figure how to get their when
condition working:
There is a way to work around it that worked for me at least. Instead of
when { tag "release-*" }
use
when { tag pattern: "release-\\d+", comparator: "REGEXP"}
If anyone has this problem again, after using the workaround provided by @dsiebel, I got this error:
java.lang.ClassCastException: org.jenkinsci.plugins.pipeline.modeldefinition.when.impl.AnyOfConditional.children
expects org.jenkinsci.plugins.pipeline.modeldefinition.when.DeclarativeStageConditional<? extends org.jenkinsci.plugins.pipeline.modeldefinition.when.DeclarativeStageConditional>
but received class com.github.kostyasha.github.integration.multibranch.handler.GitHubTagHandler
But this worked for me:
when { buildingTag() }
instead of:
when { tag '*' }
So symbols must be unique :(
To whomever else stumbles upon this trying to figure how to get their
when
condition working: There is a way to work around it that worked for me at least. Instead ofwhen { tag "release-*" }
use
when { tag pattern: "release-\\d+", comparator: "REGEXP"}
can confirm it works
Any update on this?
I understand that the REGEX
workaround is available, but is that the intended long-term solution?
@Symbols
doesn't follow domain like it's described in it's API, so it not a plugin bug
After updating to the latest version (0.2.0-rc-1) of this plugin a few hours ago, all pipeline executions failed at the very end with the following error:
Reverting to 0.1.0-rc29 fixed the problem. Maybe this is due to some bad interaction with other plugins (so far, this is the only plugin left to update in my Jenkins setup, so maybe some other plugin updated in such a way that causes problems with 0.2.0-rc-1).
Can anyone give some insights on why that happens? Also, feel free to ask me any relevant detail of my setup, if that helps uncover the underlying issue (and also forgive me if this is not the right repository, it's often hard to grasp the boundaries between plugins).