The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi there,
I'm starting right now to switch from manuelly clicked Build Plans and Deployment Projects to Bamboo Specs.
Especially for the Deployment Projects I have often:
Im wondering, if there is any best practise to make the "tasks" reusable because I don't expect that it is the right approach to code the same list of tasks for every environment.
Thanks for given me an hint.
Cheers
Joerg
Depending of your language of choice Java or YAML it will be different
If we talk about Java, put your tasks to some array and then reuse it
If you plan to use YAML, it has some limitation on repetitive elements usage, but look at https://docs.atlassian.com/bamboo-specs-docs/7.2.4/specs.html?yaml#includes
Hey Alexey,
thanks for you quick answer.
We plan to use Java to avoid any limitation.
Can you please provide a small nippet as an example?
Thanks
Joerg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
private static MavenTask maven3Task(String label) {
return new MavenTask()
.version3()
.executableLabel(label);
}
public Plan plan() {
return new Plan(new Project().key("Test")).stages(new Stage("Default stage")
.jobs(new Job("Default job", "JOB1").tasks(
maven3Task("Maven 3.0").goal("clean install"),
maven3Task("mvnvm").goal("test")
)));
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Alexey,
I'm very sorry, but I don't "understand" your solution snippet :/
As an example, the deployment has following tasks
These 5 tasks belong togehter and need to happen on each of the environments.
Please suggest, thanks.
Joerg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Deployment deployment = new Deployment(new PlanIdentifier("TEST", "TEST"), "My deployment");
Task[] tasks = new Task[] {
new ScriptTask().description("Stop Service").inlineBody("echo 'stop service'"),
new ScriptTask().description("Stop Website").inlineBody("echo 'stop Website'"),
new ScriptTask().description("Deploy Backend").inlineBody("echo 'Deploy Backend'"),
new ScriptTask().description("Start Service").inlineBody("echo 'Start Service'"),
new ScriptTask().description("Start Website").inlineBody("echo 'Start Website'"),
};
deployment.environments(
new Environment("Env 1").tasks(tasks),
new Environment("Env 3").tasks(tasks)
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to have
import com.atlassian.bamboo.specs.api.builders.task.Task;
at the top of your class, next to other imports like ScriptTask, Deployment, PlanIdentifier etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot, that worked now.
For any reason, the IntelliJ has stopped intellisense and import suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.