youngmon/atlassian-qna huggingface dataset:
Inject PlanExecutionManager does not work!
Asked by koudis:

Hello,

I have Bamboo task. Everything works fine untill I want to inject service or manager.

I want to inject PlanExecutionManager so I write

```
public class MyFirstTask implements TaskType {

private final PlanExecutionManager execution_manager

@Inject /** or Autowire */
public MyFirstTask(@ComponentImport PlanExecutionManager manager) {
    execution_manager = manager;
}

@Override
public TaskResult execute(final TaskContext context) {... }

}

```

But when I run the Task, the following errir is printed to the build log

```
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bimproject.bamboo.task.MyFirstTask': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.bamboo.plan.PlanExecutionManager]: : No qualifying bean of type [com.atlassian.bamboo.plan.PlanExecutionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.bamboo.plan.PlanExecutionManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
```

How Can I Inject PlanExecutionManager to the task?

Thanks for any advice

John


Answers:
author: koudis
body: Hello,

I found the solution

```
@Scanned /** <======= */
public class MyFirstTask implements TaskType {
    ...
}
```

Just add @Scanned to class definition.

But! The @Scanned is marked as deprecated by documentation

<https://bitbucket.org/atlassian/atlassian-spring-scanner/src/master/>

So - Is my solution right?

Thanks,

John

comments: author: Irek Archer
body: Depends on which scanner version you're using because for versions 2.0+:
> Remove use of `@Scanned` - this feature is removed. All classes are now scanned.
Bamboo Plugin Development Lack of Resource
Asked by Samuel Chow:

I'm new to developing plugins to Bamboo and I'm finding that there is a lack of resources, documentation, and examples to get something developed that is useful.

One example is that there doesn't seem to be a list "locations" available for the location attribute.   

Does anyone know any good blogs or detailed documentations? Note I've followed the task tutorial, and have gotten plugins imported and working on my bamboo...


Answers:
author: Irek Archer
body: Bamboo always had the worst documentation for developing plugins. I can only suggest "Use the force, read the source" :). Bamboo sources have all the standard plugins, and the fastest way to see how something can be coded in a plugin is to have a look at the sources.

comments: author: Samuel Chow
body: Can you link me the bamboo sources? I can't seem to find the source you're talking about.
How can I create Bamboo Specs in Java?
Asked by saranya22:

I have come across two methods of creating Bamboo specs in Java.

1)By Maven archetype generate command

2)By "View Plan as Bamboo Specs" option under the plan configuration

Which is the best way to do and why?

I am beginner to Bamboo and also would like to convert a Jenkinsfile to Bamboo Specs using Java. So which is the approach that I should follow?


Answers:
author: Robert W
body: Saranya,

Either method is valid, it's probably just comes down to a matter of preference.

If you already have plans defined, option 2 works best to migrate those plans to Specs definitions.

It can also provide you examples of how to do more complicated setups in Specs.

I would advise you to check out and review our Specs documentation.

<https://confluence.atlassian.com/bamboo/bamboo-specs-894743906.html>

Cheers, Robert Watson Dev Tools Support \| Atlassian


Tags: spec
How to configure a script for a task to run a Python project?
Asked by Santeri Niemel?:

Please do not direct me to Atlassian Documentation because the documentation is useless.

I'm trying to automate Python testing in Bamboo for a project. The project has dependencies to e.g. Anacondas modules (pandas, numpy etc.). I don't have the faintest idea how Bamboo works and how scripts are supposed to be written. I would very much appreciate simple instructions on how to set things up. For example:  
1) Create a virtual environment by doing this...  
2) Add venv python to PATH like so...  
3) Run your tests as such...  
4) Collect test results in a file like so..  
5) Report your test results by doing this..

Below is what I have tried (by guessing and testing):

I have set up the Source Code Checkout which works correctly.

I have included a virtual environment in the repository and I am able to activate it with the commands:  
WD=/${bamboo.build.working.directory}/  
source "$WD"//env//Scripts//activate

I have a python.exe located in:  
"$WD"//env//Scripts/python

If I try to run:  
"$WD"//env//Scripts/python "$WD"/test_library/my_test.py  
I get the following error:  
//app/atlassian/bamboo-agent/current/xml-data/build-dir/XXXXX///env//Scripts/python  
"No such file or directory"

If I instead do this simple test it works correctly:

<br />

/usr/bin/python \<\<EOF  
print "Hello, World!"  
EOF

Thank you in advance!


Answers:
author: Foong
body: > I have a python.exe located in:

Do you mean python executable file for Unix?
> //app/atlassian/bamboo-agent/current/xml-data/build-dir/XXXXX///env//Scripts/python  

Access the remote agent machine and confirm if the file **/app/atlassian/bamboo-agent/current/xml-data/build-dir/XXXXX/env/Scripts/python** exist.

If yes, try running the following command manually through Terminal in the machine hosting the agent:

```
/app/atlassian/bamboo-agent/current/xml-data/build-dir/XXXXX/env/Scripts/python?/app/atlassian/bamboo-agent/current/xml-data/build-dir/XXXXX/test_library/my_test.py?
```

comments: author: Amari
body: This doesn't answer the question. Bamboo does NOT provide a way to install packages or languages. For example, I need to install python on a Bamboo docker image, but apt isn't available and neither is root.

How can we conduct testing without the availability of languages or the ability to install packages. I agree with the post above. The documentation is unless.


Tags: python

script

task
Solved: Question about Bamboo version
Asked by ???:

I'm currently using bamboo 5.7 and I read the statement that only 6.0 or higher can be supported while trying to build JAVA. So I ask.

1. I wonder which version of the Bamboo supports the Android app and JAVA.

2. I want to know what kind of process is needed.

Thank you.


Answers:
author: Christian Glockner
body: Hi,

Bamboo 5.7 needs Java version 1.7 to **run** , but you can **build** Java projects of any version.

Cheers,

Christian

Premier Support Engineer

Atlassian

comments: author: ???
body: Oh, I am using Java version 1.8. Is that why it doesn't work?


author: Christian Glockner
body: Hi,

Yes indeed, you cannot use a newer version of Java to run Bamboo - for 5.7 you will need to use Java 1.7.

Cheers,

Christian

Premier Support Engineer

Atlassian


author: ???
body: Thank you for the information.

Then...If I use 5.8 or higher, can I run Java 1.8?


author: Christian Glockner
body: Hi,

Yes, Bamboo 5.8 is the first version of Bamboo that supports Java 1.8, see <https://confluence.atlassian.com/bamboo/bamboo-5-8-release-notes-705792391.html>

Cheers,

Christian

Premier Support Engineer

Atlassian


author: Alexey Chystoprudov
body: Not sure what do you ask. Bamboo 5.7 can build Java or Android build or whatever you need.
Trigger bamboo plan by JAVA API
Asked by koudis:

Hello,

I want to write a Bamboo Task (by JAVA API) which trigger another build plan by plan key.

I look at the bamboo JAVA doc and found

PlanManager and PlanExecutionManager

In PlanExecutionManager there is a function called startManualExecution which trigger plan (manual trigger). But the function accepts argument called ImmutableChain and I really do no known how I can obtain ImmutableChain if I have Plan (obtained from PlanManager).

So, How can I create ImmutableChain from Plan (obtained by key from PlanManager)?

Thanks for any advise

John


Answers:
author: Irek Archer
body: You can't do that from a task. Tasks are executed on the separate agent process, and they don't have the access to server resources.

But:

```
public interface ImmutableChain extends ImmutablePlan, Triggerable
```

So you should be able to cast Plan to ImmutableChain. And the default return of PlanManager.getPlanByKey(PlanKey key) is com.atlassian.bamboo.plan.cache.ImmutableChainImpl@23647b4e

Plan manager also has this function:

```
<T extends Plan> T getPlanByKeyIfOfType(@NotNull PlanKey planKey, @NotNull Class<T> planType)??
```


Tags: task
Updating spec plans across many build plans
Asked by Chris Johnston:

I currently have a number of repositories, each with a java bamboo-spec\\ build plan. These build plans use a shared set of utility classes to construct the build plan.

The problem I'm encountering, is when I need to update one of the helper classes in the utility. In order to push this change across the environment, I need to re-publish the specs in each repository.

Currently, I can do this by cloning each repository, one at a time, and then running a mvn -Ppublish-specs within the bamboo-spec directory. Right now, I have a bamboo plan that will do this (it takes the repository name as an variable -- to determine which repo to clone).

However, I'm looking for a way that this can be without having to iterate through every repository (there are a lot of them).

Is there any rest call or something else I can use to quickly automate this task?


Answers:
author: Gonchik Tsymzhitov
body: Hi!

I hope the latest version 6.8.0 will cover your request

<https://confluence.atlassian.com/bamboo/bamboo-releases-671089224.html>

I mean final step :)

Cheers,

Gonchik Tsymzhitov
Bamboo (Unlimited Local Agents, No Remote Agent, 10 Jobs): Starter License
Asked by IT Support:

Hi,  

We have recently renewed the aforementioned license, please advise where it needs to be applied.  

Thank you.


Answers:
author: Edwin Kyalangalilwa
body: Hi [@IT Support](/t5/user/viewprofilepage/user-id/76265),

The license is applied under

```
https://<your-bamboo-url>/admin/updateLicense!doDefault.action
```

comments: author: IT Support
body: Hi,  

We have already put there the **Bamboo Remote Agent** license, those are two different licenses no?  

Thank you.


author: Christian Glockner
body: Hi,

There is only one license for Bamboo - you only need to apply the license in Bamboo itself.

Cheers,

Christian

Premier Support Engineer

Atlassian


author: IT Support
body: Hi,  

Sure, I understand.  

Thank you.
Run builds concurrently on a single Remote Agent
Asked by Samuel Chow:

Correct me if I'm wrong, but it seems like only one build can be run on one remote agent at a time.

I'm aware that there is the option to run multiple remote agents on a single host to have concurrent builds run on a host. Is there any way to run builds concurrently on a remote host without having to purchase a license with more remote agents?


Answers:
author: Peter DeWitt
body: [@Samuel Chow](/t5/user/viewprofilepage/user-id/1601497), you are correct. Builds on an agent are sequential. If you need to run them parallel you will need additional agents.

-pjd
Bamboo bootstrap failed: Unable to Connect to Bamboo
Asked by yallamanda123:

Hi,

I have installed Bamboo on RHEL,When i am trying to connect bamboo server i am getting

"Bamboo bootstrap failed" issue,Could you please resolve this issue?

IP: <http://54.215.210.244:8085>

Thanks,

Yallamanda


Answers:
author: Foong
body: What is the error in **atlassian-bamboo.log** ?
Want to use latest gson library, but bamboo plugin defaults to atlassian-gson library
Asked by Nikita Bedmutha:

I want to use the latest gson-2.8.0 jar in my bamboo plugin, however bamboo defaults to using gson-2.2.2-atlassian-1.jar . I tried adding dependency in pom.xml to use :

\<dependency\>  
\<groupId\>com.google.code.gson\</groupId\>  
\<artifactId\>gson\</artifactId\>  
\<version\>2.8.0\</version\>\<scope\>compile\</scope\>  
\</dependency\>

But still didn't work. Please guide on how to achieve this?


Answers:
author: Guillermo Varela
body: I'm also facing this problem: <https://community.atlassian.com/t5/Bamboo-questions/How-to-use-a-Gson-version-that-is-bundled-with-a-Bamboo-plugin/qaq-p/1242644>

Currently the OSGi bundle with the custom plugin always uses the Gson implementation from Bamboo instead of the one inside the bundle itself.

To test this I had this on the plugin code:

```
Class klass = Gson.class;

URL location = klass.getResource('/' + klass.getName().replace('.', '/') + ".class");

log.warn("Gson: " + location);


Class klass2 = SerializedName.class;

URL location2 = klass2.getResource('/' + klass2.getName().replace('.', '/') + ".class");

log.warn("@SerializedName: " + location2);
```

And this on pom.xml:

```
<Import-Package>

? ...

  !com.google.gson*

</Import-Package>

<Private-Package>

  ...

  com.google.gson*

</Private-Package>
```

The expected result is that all code that uses classes from the Gson packages should come from the bundle itself, not the one provided by the environment (Bamboo).

But the result was:

```
Gson: jar:file:/opt/atlassian/bamboo/atlassian-bamboo/WEB-INF/lib/gson-2.2.2-atlassian-1.jar!/com/google/gson/Gson.class
```

```
@SerializedName: bundle://116.0:7/com/google/gson/annotations/SerializedName.class

```

This means, **Gson** class was loaded from Bamboo but the annotation **SerializedName** came from the bundle, which is a problem in our case because the annotation is being ignored when parsing a JSON file.

Having an import for all Gson packages from Bamboo is not an option to us because we use features that are only available after Gson 2.3.

Is there a way to use the Gson package that is bundled with the plugin itself?

Thanks.


author: Gabriel Ribeiro
body: Hi Nikita,

What error exactly you're seeing? Is Maven being able to pull the dependency?

thanks

comments: author: Nikita Bedmutha
body: There is no error as such.There is change in behaviour of the gson library which allows identifying that old library is getting used by plugin.
Is there a direct, CLI download link to the latest Bamboo build?
Asked by Joni:

Hi,

it's really a pain in the you-know-where to upgrade Bamboo server on a headless server in the cloud - everything must be done manually. To make it even more tedious, the latest version release bundle is provided through GUI only - the release archive does not contain direct link to the latest version. So, one has to use browser debugger in order to catch the link to the latest release to be able to wget it on the cloud server (it would take an hour to download it on the local machine and then upload it back to the cloud).

BR, Joni


Answers:
author: Jeyanthan I
body: Hi Joni,

If you are using Amazon EC2, there is an easy installer wizard that you can use to upgrade seamlessly like explained [in this page](https://confluence.atlassian.com/bamboo/running-bamboo-server-in-aws-858705568.html).

To run the wizard, execute:

    java -jar bamboo-server-ec2-wizard.jar

To upgrade,

    upgradeBamboo.sh latest

That said, we do provide access to direct download link to all the versions here - [New](https://www.atlassian.com/software/bamboo/download) and [old archives](https://www.atlassian.com/software/bamboo/download-archives). Just right click on the 'Download' button and hit 'Copy link address'. You can use cURL or wget to download accordingly.


author: Christian Glockner
body: Hi Joni,

If you right-click on the "Download" button and select "copy link address" (or similar) you get the URL the file directly without having to use the browser debugger.

Cheers,

Christian

Premier Support Engineer

Atlassian
Passing password environment variable to docker container
Asked by EndeJoli:

We use docker container to run the build and publish the artifacts on remote agent. One of the problems we are facing is while passing the password environment variables to the container. We are using shell/batch commands to fetch all the environment variables(grep with bamboo) and pass it to the container while starting the docker run. This works fine for all the variables except for passwords. For password variables when we read the environment variable all we get is \*\*\*\*\* and that is what gets passed to the container.

Is there any solution to pass the password variable to container correctly?

Thanks,

EndeJoli


Answers:
author: Jeremy Owen
body: Hey EndeJoli,

I haven't had any luck reproducing this yet. The password masking (\*\*\*\*\*) *should* only be applied at a logging level for Bamboo. What actually gets passed to the underlying command should be the actual value.

For example, say I set a Bamboo plan variable of *password* = *password123* and run the below Script task (I've used grep to be closer to your example, but you can also directly reference it with *${bamboo.password}*):

```
password="$(env | grep "bamboo_password" | awk -F'=' '{print $2}')"
docker run -itd -e PASSWORD=${password} ubuntu:xenial
```

At any point, if password123 is output to the console -- it will show up in the build logs as \*\*\*\*\*\* but the Docker container actually received the value *password123*.

I verified this on the host (outside of Bamboo) by attaching a shell to the container:

```
host$ docker exec -i -t container /bin/bash
container$ env
> PASSWORD=password123
```

Since Bamboo will mask any attempts to print that to the build log; have you tried verifying the value of the environment variable outside of a Bamboo build?


Tags: docker
Bamboo Remote Agent Log Disappears as no log history
Asked by A:

Hi everyone,

We are using a bamboo remote agent. When running deployment via the remote agent, the log shows for a while. But then our deployment usually takes longer than 1 hour.

After an hour (or so), the log history (live log) disappears and is shown as no log history, even if our deployment is still running.

Is there a configuration that I can apply to make the live log display the statuses, while the deployment is running? It seems there is a timeout in remote agent logs when it sees that it is idle.

Thanks in advance.

-Anthony


Answers:
author: Jeyanthan I
body: There isn't an option to display the agent logs from the agent in the UI. Did you get any hint in the agent logs?

* *\<bamboo-agent-home\>/logs/atlassian-bamboo.log*
* *\<bamboo-agent-log\>/atlassian-bamboo-agent.log*?

It should tell you what happened when the build logs stopped displaying in the build summary page.
Backup/restore requirements when upgrading from Bamboo 6.0 to Bamboo 6.6 running as AWS instanse
Asked by Lena:

Hello,

Our current production Bamboo server is version 6.0 running as AWS EC2 instance (with 2 volumes) integrated with Postgresql RDS DB and JIRA user management.

I'm working on Bamboo upgrade to 6.6 and my challenge is that there is no any testing environment where I can test the upgrade first. so I'm looking for the best approach for backup of current server so in the case something goes wrong I can roll back fast to minimize server downtime.

Is creating AWS snapshots for Bamboo server's volumes a good enough path to follow to make sure the upgrade is easy revertible? I did read the documentation here: <https://confluence.atlassian.com/bamboo/cloning-a-bamboo-instance-289277407.html>

and I'm obviously going to export data as advised, but I need to be on the safest side that I can also revert the change quickly.

Thanks


Answers:
author: Craig Castle-Mead
body: Hey Lena,

I suggest the following steps:

1. Stop the Bamboo application (to ensure the next few steps all happen with Bamboo in the same state
2. Copy all your customized configuration files from the application directory to a location outside the application directory
3. Snapshot your 2 x EBS volumes
4. Snapshot your RDS PSQL database
5. Run the Bamboo upgrade
6. Re-apply your customizations (step 2) - diff'ing the pre and post upgrade versions is a useful way of seeing what changes the upgrade caused Vs the customizations your made and need to be reapplied
7. Start Bamboo
8. Test, test, test
9. If everything passes, celebrate!
10. If not, redeploying the 3 snapshots (2 x EBS and 1 x RDS) should be a safe way to get you back up and running to the pre-upgrade version

The Bamboo upgrade path has been relatively smooth and reliable in our environment so hoping you won't have any issues! And according to <https://confluence.atlassian.com/bamboo/bamboo-upgrade-guide-720411366.html#Bambooupgradeguide-upgrade_pathDetermineyourupgradepath> 6.0 \> 6.6 looks like it should be a single upgrade - no need for an intermediary step.

CCM

comments: author: Lena
body: Hi Craig,

Sounds like a good plan.

Thanks a lot

Lena
Changing buildnumbers or reseting build numbers
Asked by lance_lyons:

Hi,

We have scenarios where with branching and moving to hotfix branches that we want to continue buildnumbers that where on a master branch (3.00.00.345) and when we move to a hotfix branch we want to continue down the same line of build numbers (3.00.00.346, 347) etc.

In the past we had to do this with direct db updates.

ie,

update dbo.BUILD set NEXT_BUILD_NUMBER=346 where FULL_KEY in  
(  
'SCM-OMHTS',  
'SCM-OMHTS-BMADMIN',  
'SCM-OMHTS-JOB1',  
'SCM-OMHTS-ODBM'  
)

This was easily done in Teamcity inside the buildserver UI. Bamboo was not able to do that.

Now that the dbo.BUILD table has changed, what is the recommended approach to changing the builds numbers?

Thanks

Lance


Answers:
author: lance_lyons
body: Yes that looks correct. I was able to figure this out on my own. The one suggestion is that the Bamboo db now uses case sensitive collation so table names and column names must match case wise.

update \[bamboo\].\[dbo\].\[BUILD_NUMBERS\] set NEXT_BUILD_NUMBER= 871  
where BUILD_ID in (  
SELECT \[BUILD_ID\]  
FROM \[bamboo\].\[dbo\].\[BUILD\] where FULL_KEY in (list of FULL_KEYs)


author: Gabriel Ribeiro
body: Hi Lance,

Could you please confirm if the instructions found in the "[Unable to change the current build number in Bamboo](https://confluence.atlassian.com/bamkb/unable-to-change-the-current-build-number-in-bamboo-759858218.html)" KB were useful? It will be helpful to have your confirmation publicly available here to help other community members.

thanks


Tags: bamboo-administration

bamboo-development