Problem
This is reproducible on Data Center:
Whilst running an Artifact Download task over a Conditional task, it is being evaluated and having its resources tested during runtime even when the condition is not a match. Whenever a condition is not matched, Bamboo should ignore that task completely and not try to build any context.
By attempting to create the runtime context of an Artifact Download task, another bug could be triggered (BAM-20606) and cause unexpected results.
2022-09-14 13:35:04,830 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-36] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.event.BuildFinishedEvent[source=com.atlassian.bamboo.build.DefaultBuildExecutionManager@2d0da374] job=BFMS-RT-SSD #24] from the invoker [com.atlassian.event.internal.ComparableListenerInvoker@6c7a3ab2] java.lang.RuntimeException: java.lang.IllegalArgumentException: Unable to find at least one successful result for plan: BFMS-BFMSCI. Listener: com.atlassian.bamboo.chains.ChainExecutionManagerImpl event: com.atlassian.bamboo.event.BuildFinishedEvent at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:53) at com.atlassian.event.internal.ComparableListenerInvoker.invoke(ComparableListenerInvoker.java:48) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Unable to find at least one successful result for plan: BFMS-BFMSCI at com.atlassian.bamboo.chains.ChainPluginSupportHelper.lambda$prepareRuntimeTaskData$0(ChainPluginSupportHelper.java:50) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) at com.atlassian.bamboo.chains.ChainPluginSupportHelper.prepareRuntimeTaskData(ChainPluginSupportHelper.java:31) at com.atlassian.bamboo.chains.ChainPluginSupportImpl.lambda$buildStarted$9(ChainPluginSupportImpl.java:213) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:107) at com.atlassian.bamboo.variable.CustomVariableContextRunnerImpl.execute(CustomVariableContextRunnerImpl.java:31) at com.atlassian.bamboo.chains.ChainPluginSupportImpl.buildStarted(ChainPluginSupportImpl.java:211) at jdk.internal.reflect.GeneratedMethodAccessor2075.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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.orm.hibernate5.support.OpenSessionInterceptor.invoke(OpenSessionInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy297.buildStarted(Unknown Source) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.dispatchBuildsInCurrentStage(ChainExecutionManagerImpl.java:939) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.access$2000(ChainExecutionManagerImpl.java:140) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$3.run(ChainExecutionManagerImpl.java:687) at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:302) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.execute(ChainExecutionManagerImpl.java:618) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.access$1300(ChainExecutionManagerImpl.java:140) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2$1.run(ChainExecutionManagerImpl.java:472) at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:302) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.run(ChainExecutionManagerImpl.java:457) at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:302) at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.onBuildFinished(ChainExecutionManagerImpl.java:443) at jdk.internal.reflect.GeneratedMethodAccessor2126.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 com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:42) ... 9 more Caused by: java.lang.IllegalArgumentException: Unable to find at least one successful result for plan: BFMS-BFMSCI at com.atlassian.bamboo.plugins.artifact.ArtifactDownloaderRuntimeDataProvider.populateRuntimeTaskData(ArtifactDownloaderRuntimeDataProvider.java:110) at com.atlassian.bamboo.chains.ChainPluginSupportHelper.lambda$prepareRuntimeTaskData$0(ChainPluginSupportHelper.java:37) ... 50 more
Environment
Bamboo 7.2, 8.0, 8.1, 8.2, 9.0
Steps to Reproduce
Add a conditional artifact downloader task that WILL NOT MATCH and point to a Plan that hasn't had any successful builds.
Expected Results
The Artifact Download task should be skipped entirely and the subsequent Tasks/Jobs should continue
Actual Results
Bamboo will still try to evaluate the Artifact objects during runtime and will fail with "Unable to find at least one successful result for plan: ABC-XYZ" message in case the "producer" Plan that has the artifact referenced from doesn't contain a valid build. Further stages on the consumer Plan also get lost in queueing, making the Plan run indefinitely.
This is better described on BAM-20606
Workaround
Currently, there is no known workaround for this behaviour. A workaround will be added here when available