Error while using Octopus metadata plugin in Bamboo

reliability
(Owen Manske) #1

Getting an error in Bamboo with the Octopus plug-in, from the Octopus Deploy: Octopus Metadata Deploy step.

This step is running on a remote agent.

I saw the other issue with same name and updated my Bamboo version to the latest version and still getting the error.

06-Sep-2019 13:35:24 Starting task ‘Octopus Metadata’ of type ‘com.octopus.bamboo:task.octopusmetadata’
06-Sep-2019 13:35:24 Error processing comment messages
06-Sep-2019 13:35:24 java.lang.ClassCastException: com.atlassian.bamboo.task.DeploymentTaskContextImpl cannot be cast to com.atlassian.bamboo.task.TaskContext
06-Sep-2019 13:35:24 at com.octopus.bamboo.plugins.task.octopusmetadata.OctopusMetadataTask.execute(OctopusMetadataTask.java:126)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:319)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:319)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:203)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:175)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:129)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:123)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
06-Sep-2019 13:35:24 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
06-Sep-2019 13:35:24 at java.lang.Thread.run(Thread.java:748)
06-Sep-2019 13:35:24 Finished task ‘Octopus Metadata’ without any result…
(Owen Manske) #2

I get this same error message on a build that runs on the primary Bamboo server also.

(Shannon Lewis) #4

Hi Owen,

Thanks for getting in touch and my apologies for the delay in responding. You mentioned you updated “Bamboo version to the latest version”, just checking you meant the plugin version?

Could I check which version of Bamboo and which version of the plugin you have? I’ve tested and can’t reproduce any issue, but maybe I’m using a different Bamboo version.

Also, are you running Bamboo on Windows or Linux? And which version of Java etc do you have?

Regards
Shannon

(Owen Manske) #5

Thanks Shannon.

I meant “latest plugin version.” Bamboo version is: 6.7.2 build 60706 - 10 Dec 18

Our Primary bamboo server is Windows 2012. We do have 1 remote that is linux (rhel).

(Shannon Lewis) #6

I think I’ve found the answer, I wasn’t aware that you could add our steps to a Deployment project. Is that where you have your steps?

We designed the plugin for use in the Build projects, especially the Metadata step as it requires access to the commit details and that isn’t available in a Deployment project, at least not that we can find.

I tested it this morning and got the same exception you are seeing. The DeploymentTaskContextImpl is what gets passed to us in this case and it doesn’t have the method to get the commit details, which causes the exception.

Regards
Shannon

(Owen Manske) #7

Shannon- yes we are using it in a deployment step. We run all the Octo steps there. The reason is that we like to use automatic branch building and we put all of our deployment steps in deployment projects. That way- automatic branch builds will ONLY build (if you add deployment steps in the build plan- EVERY step is always executed even if you don’t want them to be - say like you don’t want to deploy a feature branch, but you do want it automatically built).

However, according to Bamboo documentation, the commit information IS available to deployments via releases. I haven’t checked the API, but I can see it in the UI here:

Can you check out the API and see how they are getting it? We REALLY want to keep our deployments (to Artifactory and Octopus) in Bamboo deployment steps, but we also REALLY want that metadata in Octo so we can do automated release approvals and notifications from Jira.

(Shannon Lewis) #8

I’ve checked and the APIs we have access to inside the plugin framework do not expose the build or commit details anywhere we can get to them. I think what the UI has access to there is a much richer world.

We agree that the Octopus deployment steps (Deploy Release and Promote Release) make sense in a Deployment project, and they should actually work fine there as well as in a Build project. The Package Metadata step though is very much concerned with the 1 time build of the binaries in a Build project, just like Pack, Push, and Create Release.

I’m in the process of updating the plugin to detect when it’s being run in a Deployment project and report a better error message.

Regards
Shannon