Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,995
Community Members
 
Community Events
176
Community Groups

Error “The working directory must exist before executing the process” when deploying with Bamboo

Edited

I have a Script task, in Bamboo, for deploying a C# console project to a web server. When run, the task fails with the following error:

com.atlassian.bamboo.task.TaskException: Failed to execute task
at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:84)
at com.atlassian.bamboo.plugins.script.task.ScriptBuildTask.execute(ScriptBuildTask.java:55)
at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$272(TaskExecutorImpl.java:317)
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:246)
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:317)
at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118)
at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:74)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:215)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:139)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:130)
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:221)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:129)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:137)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:51)
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: The working directory must exist before executing the process
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
at com.atlassian.bamboo.process.ProcessServiceImpl.createExternalProcess(ProcessServiceImpl.java:157)
at com.atlassian.bamboo.process.ProcessServiceImpl.executeExternalProcess(ProcessServiceImpl.java:206)
at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:61)

 

All the task does is copy the release folder of the project in question from a Bamboo build server to a given directory on another server. It's set as an inline task and its script body looks like this:

xcopy /s /y "${bamboo.build.working.directory}\Source\MyProject\bin\Release" "\\${bamboo.deploy.environment}.mycompany.com\c$\Applications\Stuff\TargetFolder"

 

Where "${bamboo.deploy.environment}" is equal to "development", and the "Working sub directory" property of the task looks like this:

location="\\development.mycompany.com\c$\Applications\Stuff\TargetFolder"

 

I've verified that the "Source\bin\release" folder on the Bamboo build server exists and all the release files for "MyProject" are present in it, and I've also verified that folder "c$\Applications\Stuff\TargetFolder" on sever "development.mycompany.com" exists and that it has proper permissions, but I am still getting the error.

The only useful information about this I've been able to find, in this question from two years ago,  alludes to a permission issue of some kind, and that the Bamboo agent performing the deploy might not have permissions to access directory "TargetFolder", but I have not been able to figure out where in Bamboo to change the permissions for the deployment agent.

Any idea why this exception is being thrown and how to change the permissions for a Bamboo deploy agent?

1 answer

1 accepted

1 vote
Answer accepted
Foong Atlassian Team May 15, 2018

the "Working sub directory" property of the task looks like this:

It seems that you are trying to use remote server file URL in the "Working subdirectory" setting.

Script task does not work with remote server file URL. If the Working subdirectory setting is "\Source\MyProject\bin\Release", it means that the script will be run in the directory "${bamboo.build.working.directory}\Source\MyProject\bin\Release".

If you would like to run the script in another machine, pease use the SSH Task.

Yes, that was the problem. I put the remote server file URL in the wrong place. It should be in Environment variables, not Working subdirectory. Once i put it in Environment variables, it started working.

 

Thanks.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events