-
Suggestion
-
Resolution: Unresolved
-
None
-
None
-
3
-
Problem Definition
When an artifact definition is deleted from a plan, the artifact download task consuming that artifact inside a plan and/or deployment environment defaults to the option of downloading "All artifacts" from the UI. However, it is still pointing to that artifact – the one that was removed – in the database. Trying to view the plan and/or deployment project as Java Specs or YAML results in an error because Bamboo is no longer capable of locating the artifact.
View deployment project as Java Specs or YAML
- For deployment projects, the following message is displayed when the artifact definition is no longer available inside the source build plan:
No shared artifacts found for related plan. Configure the build plan to publish shared artifacts.
- Upon trying to view the deployment project as Java Specs or YAML the following error is shown:
An unexpected error has occurred
Export to Bamboo Specs failed: Cannot find artifact with id: #########
- The following error is thrown in the atlassian-bamboo.log file:
2020-08-10 10:55:19,558 ERROR [http-nio-8085-exec-23] [ViewDeploymentProjectSpecs] Cannot find artifact with id: 3080193 java.lang.IllegalStateException: Cannot find artifact with id: 3080193 at com.atlassian.bamboo.plugins.artifact.export.ArtifactDownloaderTaskExporter.addDownloadItemsToSpec(ArtifactDownloaderTaskExporter.java:250) at com.atlassian.bamboo.plugins.artifact.export.ArtifactDownloaderTaskExporter.toSpecsEntity(ArtifactDownloaderTaskExporter.java:230) at com.atlassian.bamboo.plugins.artifact.export.ArtifactDownloaderTaskExporter.toSpecsEntity(ArtifactDownloaderTaskExporter.java:72) at com.atlassian.bamboo.configuration.external.helpers.TaskDefinitionExportHelper.toSpecsEntity(TaskDefinitionExportHelper.java:65) at com.atlassian.bamboo.configuration.external.DeploymentExportServiceImpl.lambda$generateEnvironment$3(DeploymentExportServiceImpl.java:145) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) at com.atlassian.bamboo.configuration.external.DeploymentExportServiceImpl.generateEnvironment(DeploymentExportServiceImpl.java:146) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) at com.atlassian.bamboo.configuration.external.DeploymentExportServiceImpl.generateDeployment(DeploymentExportServiceImpl.java:132) at com.atlassian.bamboo.configuration.external.DeploymentExportServiceImpl.exportDeploymentToSpecs(DeploymentExportServiceImpl.java:112) at com.atlassian.bamboo.deployments.projects.actions.ViewDeploymentProjectSpecs.yaml(ViewDeploymentProjectSpecs.java:81) 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 ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899) at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544) at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) ...
View plan as Java Specs or YAML
- Upon trying to view a plan as Java Specs or YAML the following error is thrown in the atlassian-bamboo.log file:
2020-08-10 10:57:30,299 ERROR [http-nio-8085-exec-9] [FiveOhOh] 500 Exception was thrown. java.lang.IllegalStateException: Cannot find artifact with id: 3080193 at com.atlassian.bamboo.plugins.artifact.export.ArtifactDownloaderTaskExporter.addDownloadItemsToSpec(ArtifactDownloaderTaskExporter.java:250) at com.atlassian.bamboo.plugins.artifact.export.ArtifactDownloaderTaskExporter.toSpecsEntity(ArtifactDownloaderTaskExporter.java:230) at com.atlassian.bamboo.plugins.artifact.export.ArtifactDownloaderTaskExporter.toSpecsEntity(ArtifactDownloaderTaskExporter.java:72) at com.atlassian.bamboo.configuration.external.helpers.TaskDefinitionExportHelper.toSpecsEntity(TaskDefinitionExportHelper.java:65) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.lambda$null$15(PlanConfigExportServiceImpl.java:307) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.lambda$generateJobs$24(PlanConfigExportServiceImpl.java:308) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.generateJobs(PlanConfigExportServiceImpl.java:351) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.lambda$generateStages$13(PlanConfigExportServiceImpl.java:287) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Collections$2.tryAdvance(Collections.java:4719) at java.util.Collections$2.forEachRemaining(Collections.java:4727) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.generateStages(PlanConfigExportServiceImpl.java:291) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.generateTopLevelPlanProperties(PlanConfigExportServiceImpl.java:250) at com.atlassian.bamboo.configuration.external.PlanConfigExportServiceImpl.exportPlanToSpecs(PlanConfigExportServiceImpl.java:142) at com.atlassian.bamboo.ww2.actions.build.admin.config.ViewPlanSpecs.yamlCode(ViewPlanSpecs.java:99) at com.atlassian.bamboo.ww2.actions.build.admin.config.ViewPlanSpecs.yaml(ViewPlanSpecs.java:48) ...
Suggested Solution
- Once the artifact definition is deleted from a plan, the artifact download task pointing to that artifact definition should be removed from the plan and/or deployment environment.
- Another suggestion would be to add a warning message to the logs saying that the artifact download task was not exported/skipped because its configuration is invalid and needs to be fixed – and allow the export to happen.
- Add an audit log event with information on the artifact deletion as described in BAM-17199.
Why this is important
- Need to know who deleted the artifact definition.
- Allow the Specs or YAML export without the artifact download task.
- links to