Hi,
I would like to add a new Environment to an existing Deployment Project using Java Bamboo Specs.
When I pass the same bambooProjectKey, bambooPlanKey, and the same name to the PlanIdentifier, instead of creating a new environment, it overwrites the existing published one. That is not what I want. My goal is to keep the existing deployment project and only add a new environment to it.
Here is the code snippet I am using:
Environment preProdEnv = new Environment("PRE-PROD")
.description("Pre Production Environment")
.triggers(new AfterSuccessfulBuildPlanTrigger()) // trigger optional
.tasks(
new CleanWorkingDirectoryTask(),
new VcsCheckoutTask()
.description("Checkout Helm Repository")
.checkoutItems(new CheckoutItem().repository("nds-helm-repository")),
new ScriptTask()
.description("Deploy PRE-PROD")
.inlineBody("echo 'Deploying to PRE-PROD environment...'")
);
// update deployment project dengan env baru
return new Deployment(planId, DEPLOYMENT_PROJECT_NAME)
.releaseNaming(new com.atlassian.bamboo.specs.api.builders.deployment.ReleaseNaming("release-518").autoIncrement(true))
.updateEnvironment(preProdEnv); <<the method is undefined
The issue is that updateEnvironment does not exist in the API.
👉 Is there a way to add a new environment to an already published deployment project using Bamboo Specs, without overwriting the existing project?
This is quite urgent, so any guidance would be really appreciated.
Thank you,