I have a Bamboo remote agent running a Job that basically:
-Checkout a PowerShell script in a sub-directory
- and Run the PowerShell script (This script,among others, build the code from the main directory)
This work perfectly fine when I run the remote agent manually in a terminal, but when the remote agent run as a service (installntservice), the task running the script is failing returning -1.
As I had problem with Git right to checkout the script, I have change the "bamboo-remote-agent" service "Log On As" option from " Local Service" to the windows account username. It solve the Git checkout error I had but not the script failing error.
I have added in /conf/wrapper.conf the following:
wrapper.java.additional.3=-Djava.io.tmpdir="C:\bamboo_agent\temp"
(On Windows, when the Bamboo remote agent is installed as a service under the Local System user account. The temporary folder created by the agent isn't accessible by any other application. To allow enable to that folder, configure the agent to use a commonly accessible temporary folder by defining a new Java property in the service wrapper.)
but I don't know how I can checkout my script into that temp directory and then run it from a Bamboo task.
Any help would be appreciated.
Thanks,
When Running Bamboo as a Windows service as the local user, make sure you have no User variable "PATH" in Environment Variables.
Hi @Jerome Durand I had been working with windows agents for a while and I never need access to temp folder on the agent.
All the code and the script must be on the working directory for example
agent-working-directory/ script-folder/ src/
files.*
All files that you need on the agent for made the build need store in this structure.
In my case the call to powershell script is lik this.
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Omar Herrera for your reply.
Ok I won't bother with temp file then, thanks.
This is pretty much what I am doing.
Basically I have 2 git repositories that are checkout in the first task of the job (Source Code Checkout).
The first repo contain the source code and some files, and the second one some scripts to be run:
So I get the same structure than your example before running my script:
agent-working-directory/
script-folder/
src/
files.*
I then call my Init script like this:
This work perfectly fine when I run the agent manually in a terminal but when it is run as a service then the script return -1 directly, the first line of the script isn't even run. I know that the script work as again it work fine when the agent is ran manually.
The only thing that I can think is that my init script interfere with tools and other scripts that are outside of the working directory. But why would that work manually?!
Thanks for your help.
Jerome
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jerome Durand can you try configured the service run with the same windows account that you are using in command line.
I'm agree with you about the interfere but with the right privilegies you will not problems.
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Omar Herrera,
As I said in my first post, I already did that. It solved another problem I had with Git but not the script error:
"As I had problem with Git right to checkout the script, I have change the "bamboo-remote-agent" service "Log On As" option from " Local Service" to the windows account username."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry @Jerome Durand my apologize for not being able to help you, my configuration is the same to you.
I'm still thinking that a issue with permission.
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Omar Herrera for your help, after spending some time debugging, I found out that normal Shell script were working fine, and that powershell itself wasn't recognized as an internal or external command even though it was in my System environment variable and recognized when the Bamboo remote was run manually.
And I found the solution on this page:
When Running Bamboo as a Windows service as the local user, make sure you have no User variable "PATH" in Environment Variables.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.