Bamboo Specs: NullPointerException when trying to add CVS repository

I'm trying to write a simple Bamboo spec which will check out source code from a CVS repository. A slightly modified version of the plan I'm trying to create as a starter is shown below

 Plan createPlan()
Plan plan = new Plan(new Project().name("Spec Testing").key("SPEC"), "Spec Plan", "PLAN")
.description("Plan generated from spec");

AtlassianModule atlassianModuleCvs = new AtlassianModule("com.atlassian.bamboo.plugin.system.repository:cvs");

Map<String,Object> cvsConf = new HashMap<String,Object>();
cvsConf.put("cvsRoot", "/");
cvsConf.put("authType", "password");
cvsConf.put("password", "password123");
cvsConf.put("quietPeriod", 2);
cvsConf.put("module", "sw");
cvsConf.put("selectedVersionType", "branch");
cvsConf.put("branchName", "REL-1-0");

Map <String,Object> srvConf = new HashMap<String,Object>();
srvConf.put("repository.cvs", cvsConf);

plan.planRepositories(new AnyVcsRepository(atlassianModuleCvs)
.name("CVS Repository")

return plan;

When I run the spec initially, everything seems fine until I try to access the plan in Bamboo, at which point I get an internal server error with a NullPointerException. The full stack trace is here, but I think the key parts are the following lines where it tries to read the plan repository definition:

io.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
	at io.atlassian.util.concurrent.LazyReference.getInterruptibly(
	at io.atlassian.util.concurrent.LazyReference.get(
	at com.atlassian.bamboo.plan.cache.AbstractImmutableChain.getPlanRepositoryDefinitions(
	at com.atlassian.bamboo.plan.PlanHelper.getPlanRepositoryDefinitions(
	at com.atlassian.bamboo.plan.PlanHelper.getDefaultPlanRepositoryDefinition(
	at com.atlassian.bamboo.plan.branch.ChainBranchUtils.getANameFromBranch(
	at com.atlassian.bamboo.plan.branch.ChainBranchUtils.getSubstitutedVcsBranchDisplayNameWithoutContextChange(
	at com.atlassian.bamboo.plan.branch.ChainBranchUtils.getChainBranchNameWithoutContextChange(
	at com.atlassian.bamboo.plan.branch.ChainBranchUtils.lambda$getChainBranchNameInTemporaryContext$3(
	at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(
	at com.atlassian.bamboo.plan.branch.ChainBranchUtils.getChainBranchNameInTemporaryContext(
	at com.atlassian.bamboo.plan.branch.ChainBranchUtils.getChainBranchName(
	at com.atlassian.bamboo.ww2.beans.DecoratedNavObjectFactoryImpl.getSubstitutedBranchName(

Am I doing something wrong here? I know we should really move away from CVS, but that's not something we can easily do right now. I'm using Bamboo 6.1.1.

1 answer

0 votes

try to go other way around. create plan with CVS repository and then go to Plan configuration and choose "View plan as Bamboo Spec"Screen Shot 2017-09-11 at 21.24.13.png

I've just tried this, but I'm still getting the same problem. I've attached the generated code below, if it helps at all.

Also, I tried this with SVN and Mercurial to see if they worked, which they do. The only difference I can see is that branchConfiguration is called for SVN and Mercurial, but not for CVS. Is there some branch configuration I need to populate?

import com.atlassian.bamboo.specs.api.BambooSpec;
import com.atlassian.bamboo.specs.util.BambooServer;
import com.atlassian.bamboo.specs.util.MapBuilder;

public class PlanSpec {
public static void main(String... argv) {
//By default credentials are read from the '.credentials' file.
BambooServer bambooServer = new BambooServer("http://buildserver:8085");

Plan plan = new Plan(new Project()
.oid(new BambooOid("jfym841e38jn"))
.key(new BambooKey("SPEC"))
.name("Spec Testing"),
"Plan Name",
new BambooKey("PLAN"))
.oid(new BambooOid("jfox0io69gyd"))
.description("Plan created from (enter repository url of your plan)")
.pluginConfigurations(new ConcurrentBuilds()
.planRepositories(new AnyVcsRepository(new AtlassianModule("com.atlassian.bamboo.plugin.system.repository:cvs"))
.oid(new BambooOid("jft2oceerdpb"))
.serverConfiguration(new MapBuilder()
.put("repository.cvs", new MapBuilder()
.put("cvsRoot", "/path/to/cvs/server")
.put("password", "BAMSCRT@0@0@cD10yGZALomfb2AqsUj5lQ==")
.put("quietPeriod", 2)
.put("module", "sw")
.put("branchName", "REL-1-0")
.put("authType", "password")
.put("selectedVersionType", "branch")
.changeDetectionConfiguration(new VcsChangeDetection()))

.planBranchManagement(new PlanBranchManagement()
.delete(new BranchCleanup()));


PlanPermissions planPermission = new PlanPermissions(new PlanIdentifier("SPEC", "PLAN"))
.permissions(new Permissions()
.userPermissions("cfarr", PermissionType.ADMIN, PermissionType.CLONE, PermissionType.EDIT)
.groupPermissions("bamboo-admin", PermissionType.ADMIN)



Sorry for delay. Confirming it's a bug in Bamboo Specs import of AnyVcsRepository entity.

Please watch for updates and fix version.

Thanks for that, I'll keep an eye out!

The BAM-18682 has been fixed in Bamboo 6.2.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

73 views 0 1
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you