Created
June 20, 2014 06:28
-
-
Save jhiemer/15f8e4899038748bc7a4 to your computer and use it in GitHub Desktop.
Wrong handling of services in manifest.yml of CloudFoundry Bamboo Plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This is a minimal manifest | |
applications: | |
- name: broker | |
instances: 1 | |
memory: 1024M | |
path: target/broker.war | |
buildpack: https://github.com/cloudfoundry/java-buildpack.git | |
services: | |
- cs-mongodb | |
- cs-postgresql | |
- cs-rabbitmq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings({ "rawtypes", "unchecked" }) | |
private List<ServiceManifest> extractServices(Map app) { | |
List<ServiceManifest> services = Lists.newArrayList(); | |
if (app.get("services") instanceof List) { | |
List serviceList = (List) app.get("services"); | |
for (Object service : serviceList) { | |
ServiceManifest manifest = new ServiceManifest(); | |
String name = resolveSymbols(String.valueOf(service)); | |
manifest.setName(name); | |
services.add(manifest); | |
} | |
} else if (app.get("services") instanceof Map) { | |
Map map = (Map) app.get("services"); | |
for (Object service : map.keySet()) { | |
ServiceManifest manifest = new ServiceManifest(); | |
String name = resolveSymbols(String.valueOf(service)); | |
manifest.setName(name); | |
Map<Object, Object> serviceDetails = (Map<Object, Object>) map.get(service); | |
// These can be repeated if there are multiple services so it | |
// doesn't make sense to make them available for replacement | |
manifest.setProvider((String) serviceDetails.get("provider")); | |
manifest.setPlan((String) serviceDetails.get("plan")); | |
manifest.setLabel((String) serviceDetails.get("label")); | |
manifest.setVersion((String) serviceDetails.get("version")); | |
services.add(manifest); | |
} | |
} | |
return services; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19-Jun-2014 14:51:57 Error occurred while running Task 'deploy web(3)' of type org.gaptap.bamboo.cloudfoundry.cloudfoundry-plugin:task.deployment.cloudfoundry.push. | |
19-Jun-2014 14:51:57 java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map | |
19-Jun-2014 14:51:57 at org.gaptap.bamboo.cloudfoundry.tasks.utils.YamlToApplicationConfigurationMapper.extractServices(YamlToApplicationConfigurationMapper.java:217) | |
19-Jun-2014 14:51:57 at org.gaptap.bamboo.cloudfoundry.tasks.utils.YamlToApplicationConfigurationMapper.from(YamlToApplicationConfigurationMapper.java:91) | |
19-Jun-2014 14:51:57 at org.gaptap.bamboo.cloudfoundry.tasks.PushTask.extractAppConfigFromManifest(PushTask.java:120) | |
19-Jun-2014 14:51:57 at org.gaptap.bamboo.cloudfoundry.tasks.PushTask.execute(PushTask.java:80) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:220) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:98) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:75) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:186) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:102) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:108) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) | |
19-Jun-2014 14:51:57 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) | |
19-Jun-2014 14:51:57 at java.lang.Thread.run(Thread.java:745) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment