youngmon/atlassian-qna huggingface dataset:
How to integrate PHPUnit in Bamboo?
Asked by forest wang:

I was trying to integrate PHPUnit from this article: <https://confluence.atlassian.com/display/BAMBOO/PHPUnit>

"reference the path to your PHP command-line interpreter" PHPUnit is not an executable...

Do I need ant then?

Can someone give me a step to step instruction?

Thanks


Answers:
author: Shaun Bramley
body: I personally use composer to manage all of my dependencies for my projects. This includes phpunit. So despite the fact that bamboo supports phpunit "out of the box" I use the following within my build.xml

\<target name="phpunit"\>  
\<exec executable="${basedir}/vendor/bin/phpunit" failonerror="true" description="Run unit app with PHPUnit "\>  
\<arg line="--verbose -c ${basedir}/phpunit.xml.dist" /\>   
\</exec\>  
\</target\>


author: Sultan Maiyaki
body: Hi Forest,

I guess the issue is due to the fact that the path to the PHPUnit executable you have added is pointing to something else. Check this page for the list of exceutables on your Bamboo server /admin/agent/configureSharedLocalCapabilities.action . If you have one listed for PHPUnit, then check against the one listed when you run the following commands on your server:

**which phpunit** if you are on unix

**where phpunit** if you are on windows

The idea is that Bamboo should be able to use the executable at build time


Tags: php

phpunit
High availability configurations?
Asked by Daryl Hutchings:

Hi Folks,

I've been tasked with preparing a Service Level Agreement for Bamboo (and Jira) here at Simba, and it looks like we need to buy new hardware to run it on to achieve any significant improvement. I'm looking at High-Availability Dell boxes (like these: <http://www.dell.com/downloads/global/solutions/2012_June_HA_Cluster_with_CMP_FC_Support_Matrix.pdf>) as a solution, but have heard a rumour that Bamboo doesn't work properly in failover mode.

Do you have a knowledgebase article about this, or a customer who's made it work and knows the pitfalls?

All wisdom welcome,

Daryl Hutchings,

Development Services Manager, Simba Technologies


Answers:
author: RianA
body: Hi Daryl,

As per Armen said it is not currently supported. But if you really need to do that, perhaps you could refer to this answer.  
\* [https://answers.atlassian.com/questions/184224/atlassian-bamboo-failover-recommendations](/questions/184224/atlassian-bamboo-failover-recommendations)


author: Daryl Hutchings
body: Thanks folks! The Failover Recommendations are clear and helpful. Sorry for the delay in responding ;-(


author: ArmenA
body: Hi Daryl,

You might want to have a look at [this page](https://confluence.atlassian.com/display/BAMBOO/Hardware+sizing+considerations) regarding the hardware. However, there is no proper support for Bamboo failover. If you want to, you can give that a try by manually arranging the failover, but you need to take care of all the remote agents and redirect them to connect to the failover instance.

Armen


Tags: jira-software
Bamboo logging location
Asked by Paul Ellis:

Our Linux Bamboo 4.3 server, on the System Information page is saying "Bamboo Logs - Could not find 'atlassian-bamboo.log' in current working directory". It appears that logging information is being writtent to \<bamboo install\>/logs/bamboo.log. This latter location is in bamboo.sh and conf/wrapper.conf. The log file is also huge, it hasn't been rolled round like other Atlassian apps do.

Has anyone else seen this? Where should the app be picking up the log location from? What is the 'current working directory'?

Thanks,

Paul


Answers:
author: Jan Swaelens
body: Hi,

That is indeed a 'known issue'. You can find more info here: [https://answers.atlassian.com/questions/47102/how-to-configure-the-log-file-under-bamboo_home-logs?page=1#49153](/questions/47102/how-to-configure-the-log-file-under-bamboo_home-logs?page=1#49153)

In theory, adding this to the wrapper configuration should do it: wrapper.logfile.rollmode=SIZE

Please also vote here to have a proper fix for this problem: <https://jira.atlassian.com/browse/BAM-11246>

We override the log4j log settings to log on error level, which helps to keep the size down at least.

comments: author: Paul Ellis
body: Thanks, I searched for bamboo.log and other things before raising a new question but didn't see yours


Tags: bamboo-administration
Bambo: Deploy multiple servers
Asked by wcms:

Hey guys :)

We're using Adobe CQ as our CMS system, and have a lot of customizing (internal and external).

In order to make building and deploying easier, we'd like to use Bamboo for our Release Management (and it looks great so far :) ).

I've created a project containing 2 stages for test and production (each of it contains 2 tasks SVN checkout and Maven which builds \& deploys the code).

We have to build \& check out the code 3 times, because we have 3 servers to be deployed (Maven directly uploads the newly builded code to the CQ server). Is there a way to check the code out only once, and then just build it 3 times with maven?

One other thing which I'm not quite sure of how it works: Does Bamboo cache the version of the SVN from when it started. For example:

Imagine that I submitted changes to the code, and then executed the test stage in Bamboo (which builds the code and deploys it to the 3 servers). At this point I would start testing my changes in the browser. In the meanwhile, my colleague makes some changes at another part of the code, and starts a new test stage build. What happens when I successfully tested my changes and would now like to deploy it into production (using the production stage in Bamboo). Will the changes of my colleague also deploy to the production or can I be sure that only my changes will find their way to production?

I hope I could describe my problem as good as possible. If you have trouble understanding what I'm trying to say, please tell me, I'll try to formulate more clearly.


Answers:
author: Marcin Gardias
body: The answer to the second question is: of course! :-) Bamboo resolves the repository revision before the first stage and ensures that all Jobs build the same codebase.

As for organizing the stages: key question is: are binaries you deploy to each server different? In other words: do you really need to rebuild before each deployment?

If they are not, then I think the best strategy is to use artifact passing. So in the first stage you build all the binaries and save them as Bamboo Artifacts. In the next stages you subscribe to those Artifacts, which allows you skip the checkout and build, you just need to deploy.

If you build different binaries in different stages (i.e. using different compiler switches or sth. like that) then I'm afraid there's not much to gain. Bamboo enforces working directory separation for different Jobs, so you need to get the source into your working dir *somehow.*While you could create an artifact containing source package I don't think that earns you a lot compared to simply checking out. (unless your SVN server is slow to respond for some reason)
Bamboo - Git Submodule with relative path
Asked by Skomialek:

Hi,

I have a problem with Bamboo build from Git. The repository I'm using has submodules that are specified as relative paths (say repo is in <http://stash/projA/repo.git> and the submodule path is ../../projB/repo.git). This configuration works ok with clients I've used so far (SmartGit, SourceTree), but once I try to execute the build with Bamboo it tries to check out submodule from local file system path (d:\\bamboohome\\xml-data\\projB\\repo.git) which obviously fails. We use relative paths because it's very convinient (if user prefers ssh access all submodules are resolved with ssh, if standard http, submodules work with http). During bamboo build I use ssh authentication (I wanted to use the same ssh key for all repositories). Any ideas ?

UPDATE : It's a build on remote agent, bamboo 4.4.4 build 3506

Regards,

Lukasz


Answers:
author: Sultan Maiyaki
body: This is an improvement request to the current bamboo-git plugin as relative paths are not yet supported. See <https://jira.atlassian.com/browse/BAM-13178>


Tags: git

submodule
accessing artifacts available at Ondemand Bamboo instance's maven repository
Asked by lucentmind:

I am having some doubts/queries about setting up Ondemand Bamboo instance. I am having cloud based Git repository. I want to checkout source code, build my project with Maven 3.x and access generated maven artifacts repository.

Q:do Ondemand Bamboo instance provide maven repository access ?

[Cloubees](http://cloudbees.com/) is providing this facility: it provides a maven central proxy that's nexus based and a private repository. So, in case of Cloudbees, developer has to point to repository hosted at CloudBees location <https://repository-myproject.forge.cloudbees.com/release>

Q: Is the similar facility available with Ondemand Bamboo setup?

-If Yes, to access maven repository, do I need to keep my Bamboo's Image-instance always in 'START' mode?

-If No, how can I transfer artifacts to locally hosted Nexus server? Is it possible to FTP/ upload from Bamboo instance to different server?

Any help/hint will be appreciated. Thanks


Answers:
author: Przemek Bruski
body: OnDemand does not offer hosting of Maven repositories.

You can upload artifacts to Nexus from your agents, just like you would with a regular build.


Tags: maven
Missing subtabs for tests
Asked by Brent Cerrato:

Using bambo 4.1, I'm looking for the longest running tests in a plan. I see in the documentation that there should be subtabs with some of this information...

However, no such subtabs are anywhere in my results pages.

Do I need to enable something to see these stats?


Answers:
author: Jan Swaelens
body: Ah yes, I actually found what you are talking abount -- never seen it before myself :-).

There must be a better way to get there but this is how I got there:

* Navigate to your plan and go to the tests tab (you will see a list of tests)
* Click on one of them, you will go to the details of that particular test
* Now click on this page's tests tab and you will get a summarized view of all tests of that job;
  * Top 10 Most broken
  * Top 10 Longest to fix
  * Top 10 Longest running
  * Number of Tests

The key is to get to the job's details in the general view, which is not directly navigateable as far as I can tell.

You can navigate to it by using this URL: /browse/PLAN_NAME-JOB_NAME/test


author: Jan Swaelens
body: They should be visible in the 'Tests' tab of the job which executes the tests as well as on the 'Tests' tab of the general build tab. But only if you indicated in the job configuration that it produces test results.

For example, if you run the tests with Ant you should check the 'The build will produce test results' checkbox on the Ant build task and indicate where the xml file is produced. Also see here: <https://confluence.atlassian.com/display/BAMBOO/Ant>

comments: author: Brent Cerrato
body: Nope. I'm using mvn, there are tests and the checkbox is checked. But all it shows is a list, none of the aggregate stats.
Download artifacts from OnDemand Bamboo
Asked by sudhakar:

We are using the On deman version of JIA+Bamboo+BitBucket

our URL is <https://sglemont.atlassian.net/>

And we would like to publish the our artifacts as mentioned on this URL

<http://blogs.atlassian.com/2012/02/artifact-sharing-build-automation-bamboo/>

But my query is how to download these artifacts into our local test enviornment (and which is behind firwaall/proxy). I know I can download it thru browser application without any issue but we want to have this automated so that this would get downloaded automatically. Could you suggest how I can do that.

Second question is their any way in Bamboo by which I can delete aged artifacts (older than 1 month)

Thanks


Answers:
author: Bob Swift (personal)
body: [Bamboo Command Line Interface](https://bobswift.atlassian.net/wiki/display/BCLI) has the [getArtifact](https://bobswift.atlassian.net/wiki/display/BCLI/Documentation#Documentation-getArtifact) action.

comments: author: sudhakar
body: Thanks Bob your suggested tool have good number of features thanks for suggetion.

I download this and trying to use this command but unfortunately I am getting error "Connection refused"

---------------------

C:\\Development\\bamboo-cli-3.4.0-SNAPSHOT\>bamboo --action getLatestBuildNumber --build PI-CIPLAN

Client error: Invalid request: java.net.ConnectException: Connection refused: connect

--------------------------

Our organization uses proxy server while connecting to internet, is it something to do with that? is their any way I need to configure the proxy in this tool


author: Bob Swift (personal)
body: Yes, proxy requires some addition stuff. Usually just add it to your bamboo.bat/sh or equivalent. See <https://answers.atlassian.com/questions/55443/how-to-instruct-rest-to-use-a-proxy?page=1#55470>
Bamboo plan configuration with time
Asked by JIRA Autobot:

Hi,

If i have a plan now with some artifacts but i want to build a build based on old revision then how does Bamboo help me if configuration of the Plan has changed ? I am guessing the plan will just fail because the configuration of it has changed and it's not inline with the old build, anyway to remedy this ?

donnib


Answers:
author: JIRA Autobot
body: Maybe i am not explaining myself correct since i can't image no one has thought about this.

Let's say that i build, build 100 today from svn revision 10000 winth plan A, in few months the plan A had some changes (paths changes or new tasks), now i want to run a custom build on revision 10000 with plan A. What happens ? If nobody keeps track of the changes made to the plan or if the plan is not versioned then the build will defiineatly fail.

comments: author: Przemek Bruski
body: You can have a look at plan audit log, but that's about the extent of it. The plan will be run with the current configuration (it's not versioned).
Unexpected end of ZLIB blocks agent start on Bamboo 4.4.2
Asked by Peter Kahn:

Does anyone know how to prevent the problem with bamboo server's inability to provide access to remote agent jar file? This blocks agent start up and installation of new agents. It appears to be a server side problem.  
I know restarting the server will resolve the problem but it will kill 20+ running builds so I'd like to find an alternative.  
**Symptoms**  
* Can't download remote agent jar usig web ui
* vmlbuild-16 agent fails to bootstrap with error "java.io.EOFException: Unexpected end of ZLIB input stream"

[https://confluence.atlassian.com/display/BAMKB/Installed+remote+agents+failing+to+start+due+to+corrupt+files?utm_source=SAC\&utm_medium=hercules-email\&utm_content=436642](https://confluence.atlassian.com/display/BAMKB/Installed+remote+agents+failing+to+start+due+to+corrupt+files?utm_source=SAC&utm_medium=hercules-email&utm_content=436642)


Answers:
author: Peter Kahn
body: We ran an agent and server/master on the same system. It is possible that the dual use to /tmp was the problem. At Armen's suggestion we added the following to our wrapper.conf

```
-Djava.io.tmpdir=SOMEPATH 

I can see that the two instances are using different directories
```


author: Przemek Bruski
body: Are you running cleanup cron jobs on the temp directory? If so, they've probably deleted the zip file sent to the agent. This issue will be fixed in Bamboo 5.0 - the jar file will be regenerated if deleted.

Until then you the only workaround is either to restart the server or reconfigure the /tmp cleanup.

comments: author: Peter Kahn
body: I believe I did add a cleanup step on my plan because the build stores items in tmp. I'll modify the plans to use a subdir of temp.


author: Peter Kahn
body: I checked our plans and we only clear specific files (xauth and xvfb files) from /tmp. I have no cronjobs running that could do this either and looked through all users and the cron log. So, I don't think there's an automated process running that would clear this file.

Also, if I copy the file to the agent's tmp all is good

```
scp build@vmbamboo-01:/opt/atlassian/bamboo-agent-home/atlassian-bamboo-agent-installer-4.4.2.jar /tmp/jarClassPath6603717285566365500.jar
```

and see zero impact when I copy the file to server/master's tmp dir.


Tags: bamboo-administration
Elastic agent "Pending" indefinitely for .NET
Asked by Mitchell Bradd:

I'm a bit stuck with having the elastic agent not executing my build plans on the Ec2 instance that I have set up. At the moment Bamboo reports the elastic agent on the instance as pending and doesn't transition from this state.

I have created a custom AMI for Windows Server 2012, this custom instance had the Ec2Config modified the regenerate the password -- meaning that I can RDP onto the instance that Bamboo starts.

I have SSH, RDP and some other port open that I can't identify on the elasticbamboo security group (Port 26224, presumably a Bamboo thing).

The \`Pending\` state also means that my build-request remains in the queue waiting for an instance.

Any ideas or suggestions? Can also provide more information upon request.

**More Info:**

I have setup the elastic agent on the windows server; added required rule in the firewall, created a bamboo user and had it own the agent.bat task.

It runs OK on the server AFAIK (scheduler says 'Running'). One oddity is that I can't seem to locate the .out file that I expected to be created in %USERPROFILE% for the bamboo user. This makes me think I'm still doing something wrong.


Answers:
author: Przemek Bruski
body: Did you follow this guide: <https://confluence.atlassian.com/display/BAMBOO/Creating+a+custom+elastic+image+-+Windows> ?

comments: author: Mitchell Bradd
body: Hey Przemek,

I hadn't followed that guide before, in fact it's the first time I've seen it so it was a huge help. I've followed the instructions and Bamboo is still not kicking off my build.

I've added some info to the original question.


author: Mitchell Bradd
body: I've just realised I somehow ended up with an instance that doesn't have the ant/maven dependencies on the server. Are these required to have the elastic agent behave as expected?


author: Przemek Bruski
body: You need to make sure the capabilities of that instance match requirements of your job. What does Administration/Agent Matrix show ?


author: Mitchell Bradd
body: The matrix shows the instance is capable of building. I found the issue, my JAVA_HOME path was not set correctly (copy/paste error). Utlimately the agent never started as a result. The previous link was helpful to getting me there in the end.

Thanks, Przemek!


author: Ofer Zelig
body: It's a fault in Bamboo's default Windows AMI creation.

I've provided a solution here: <http://fullstack.info/running-bamboo-ci-server-remote-agent-on-windows-server-cloud/>


Tags: cloud
Is there a way to download builds with jira?
Asked by Kathleen Jacobs:

We are currently swtiching over from OnDemand Jira to Hosted. Right now, we use use Jenkins to build our builds, and we upload them to Unfuddle. Is there a way we can do this in Jira?

I've been playing around with Bamboo, and while I can get bamboo to build, not sure where to send the builds to so we can access them.

We would like to get out of unfuddle.


Answers:
author: Harry Chan
body: Hi, what exactly are you trying to achieve? Is having a link to the builds from within JIRA not enough? Can they live inside Jenkins or Bamboo[?](https://www.cloudshards.com)

See if the JIRA Plugin for Jenkins solves your needs: <https://wiki.jenkins-ci.org/display/JENKINS/JIRA+Plugin>

There's also the JIRA Bamboo Plugins should you choose to move to Bamboo: <https://marketplace.atlassian.com/plugins/com.atlassian.jira.plugin.ext.bamboo>
Replace bamboo variable during Script
Asked by JIRA Autobot:

Hi,

I need to replace a variable {$bamboo.FILEVERSION} in a batch script, how can i accomplish that ?

I need the variable to stick. What i use it for is that i save the initial FILEVERSION in a Bamboo variable then i increment it with a script then i want to save it back to Bamboo so it can be used in the next build.

donnib


Answers:
author: Felipe Kraemer
body: Hi,

Looks like you're defining the variable correctly, so this shouldn't be a problem.

Maybe the scope of the variable is incorrect? According to [this document](https://confluence.atlassian.com/display/BAMBOO/Using+global,+plan+or+build-specific+variables), it looks like you need to define a Global variable.
Need to get lines of code in all repositories
Asked by Sahrudai Reddy:

Hi all,

We need an info of how many lines of code written in all repos and in all projects in total.

Is there any way, commands, etc., to get the total number of lines written in the whole bitbucket instance.

Thanks,

Sahrudai


Answers:
author: Sandesh Shetty
body: [@Sahrudai Reddy](/t5/user/viewprofilepage/user-id/3796305)

This may help you <https://stiltsoft.com/blog/2020/10/how-to-count-lines-of-code-in-bitbucket-to-decide-what-sonarqube-license-you-need/>

comments: author: Sahrudai Reddy
body: Hi Sandesh,

Thanks for the quick response.

I've tried that already and that is an external add-on to be installed in the instance.

Is there anyway to get the lines of code with installing that?.

Thanks,

Sahrudai


Tags: bitbucket-server

git

server
Multi-stage docker build support (using --target in build) does not appear to work
Asked by Jason Ryan:

```
docker build --target build_stage_target -t build_name .?
```

Running the above command in my pipelines does not produce the desired results. The --target flag is apparently ignored, and the build runs all stages before and after the specified stage.

Is this indeed not supported or could I be doing something wrong?


Answers:
author: Maxim Ugryumov
body: This is really an issue ?  
[@Jason Ryan](/t5/user/viewprofilepage/user-id/4639977)did you solve the problem?

comments: author: Jason Ryan
body: Sadly I did not :(


author: Maxim Ugryumov
body: Ok, thanks!


author: Maxim Ugryumov
body: Hi [@Jason Ryan](/t5/user/viewprofilepage/user-id/4639977) ?

In our team we found the answer. This is not a Bitbucket issue, but the Docker itself. BuildKit fixes this bug in multi-stage builds in the legacy docker build engine.

So, just enable the BuildKit by inserting the line

```
`- export DOCKER_BUILDKIT=1`
```

before the **docker build** command and the image will be built with the specified target.

So simple, bro))


author: Jason Ryan
body: Fascinating. Thank you for sharing!


Tags: bitbucket-pipelines
npm-client-login no longer working in BB pipelines
Asked by Max Elston:

I am trying to publish a package to NPM in BB pipelines. Everything was working fine however now it is failing due to 2FA errors. I have no 2FA set in NPM.  

I am using npm-client-login to login in my bitbucket-pipelines.yml


Answers:
author: Theodora Boudale
body: Hi [@Max Elston](/t5/user/viewprofilepage/user-id/4682051),

1. Just to confirm, are you using the following package?

<https://www.npmjs.com/package/npm-cli-login>

2. If so, is it the npm-cli-login command that is failing in your Pipelines build? If so, what is the output of the command? (Please make sure to sanitize any private/sensitive data from the output prior to sharing, if any)

3. Are you able to reproduce this error if you debug this locally with Docker, following the steps in the documentation below?

* <https://support.atlassian.com/bitbucket-cloud/docs/debug-pipelines-locally-with-docker/>

This is for testing purposes, to understand if the issue seems to be specific to Pipelines or not.

Kind regards,  
Theodora


Tags: bitbucket-pipelines

cloud