Artifact download not working

I have tried to learn how to configure this with online searches (including this forum). None of what I found has solved my problem. If only there was clear, step by step dociumentation.

Anyway.

I have a build job that retrieves source from a Git repository, builds using MsBuild, and attempts to download the output artifact for later use by Deployment.

Compile is successful, the output exists but the job fails on artifact download with, "directory does not exist". But, the directory does exist only it is empty.

Here is what I hope is enough information to get started:

Git Repository: MbcsCentral
Directory Structure:
C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\bin\debug

Project: MbcsCentral
Build Job: Dev

Artifact Definition
Name: MbcsCentral Artifact
Copy Pattern: /target/MbcsCentral/bin/debug/MbcsCentral.exe
Shared: yes

Default Stage -> Default Job
Step: MsBuild
Executable: MsBuild 4.0
Project File: MbcsCentral/MbcsCentral.csproj

Step: Artifact Download
Artifact Name: MbcsCentral Artifact
Destination Path: /target/MbcsCentral/bin/debug/

At completion of job the directory, C:\Users\Administrator\bamboo-home\artifacts\MBCSCEN-BETA\shared\build-00014\MbcsCentral-Artifact, exists but is empty

Build Log:

build 05-Jan-2014 13:23:02 "C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\MbcsCentral.csproj" (default target) (1) ->
build 05-Jan-2014 13:23:02 "C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\lbo5cxlm.tmp_proj" (_CompileTemporaryAssembly target) (2) ->
build 05-Jan-2014 13:23:02 (CoreCompile target) ->
build 05-Jan-2014 13:23:02 DataMigration\frmProgress.xaml.cs(424,13): warning CS1522: Empty switch block [C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\lbo5cxlm.tmp_proj]
build 05-Jan-2014 13:23:02
build 05-Jan-2014 13:23:02
build 05-Jan-2014 13:23:02 "C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\MbcsCentral.csproj" (default target) (1) ->
build 05-Jan-2014 13:23:02 DataMigration\frmProgress.xaml.cs(424,13): warning CS1522: Empty switch block [C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\MbcsCentral.csproj]
build 05-Jan-2014 13:23:02
build 05-Jan-2014 13:23:02 9 Warning(s)
build 05-Jan-2014 13:23:02 0 Error(s)
build 05-Jan-2014 13:23:02
build 05-Jan-2014 13:23:02 Time Elapsed 00:00:20.11
simple 05-Jan-2014 13:23:02 Finished task 'MSBuild'
simple 05-Jan-2014 13:23:02 Starting task 'MbcsCentral Output' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'
simple 05-Jan-2014 13:23:02 Preparing to download plan result MBCSCEN-BETA-14 artifact: Shared artifact: [MbcsCentral Artifact], pattern: [/target/MbcsCentral/bin/debug/MbcsCentral.exe]
error 05-Jan-2014 13:23:02 C:\Users\Administrator\bamboo-home\artifacts\MBCSCEN-BETA\shared\build-00014\MbcsCentral-Artifact is not a directory
error 05-Jan-2014 13:23:02 Unable to download artifact Shared artifact: [MbcsCentral Artifact], pattern: [/target/MbcsCentral/bin/debug/MbcsCentral.exe]
simple 05-Jan-2014 13:23:02 Task configuration:
simple 05-Jan-2014 13:23:02 sourcePlanKey -> [MBCSCEN-BETA]
simple 05-Jan-2014 13:23:02 artifactName_0 -> [MbcsCentral Artifact]
simple 05-Jan-2014 13:23:02 artifactId_0 -> [1146881]
simple 05-Jan-2014 13:23:02 localPath_0 -> [/target/MbcsCentral/bin/debug/]
simple 05-Jan-2014 13:23:02 Task runtime configuration:
simple 05-Jan-2014 13:23:02 resultKey -> [MBCSCEN-BETA-14]
simple 05-Jan-2014 13:23:02 securityToken -> [23d0bea6ce339440164496d7b89ea1f976f2a249]
simple 05-Jan-2014 13:23:02 artifactName_0 -> [MbcsCentral Artifact]
simple 05-Jan-2014 13:23:02 artifactPattern_0 -> [/target/MbcsCentral/bin/debug/MbcsCentral.exe]
simple 05-Jan-2014 13:23:02 runtimeArtifactIds_0 -> [0]
simple 05-Jan-2014 13:23:02 artifactId_0 -> [1146881]
simple 05-Jan-2014 13:23:02 localPath_0 -> [/target/MbcsCentral/bin/debug/]
simple 05-Jan-2014 13:23:02 artifactLocation_0 -> []
simple 05-Jan-2014 13:23:02 Finished task 'MbcsCentral Output'
simple 05-Jan-2014 13:23:02 Running post build plugin 'NCover Results Collector'
simple 05-Jan-2014 13:23:02 Running post build plugin 'Clover Results Collector'
simple 05-Jan-2014 13:23:02 Running post build plugin 'Artifact Copier'
simple 05-Jan-2014 13:23:03 Publishing an artifact: MbcsCentral Artifact
error 05-Jan-2014 13:23:03 Unable to publish artifact [MbcsCentral Artifact]:
simple 05-Jan-2014 13:23:03 Finished publishing of artifact Shared artifact: [MbcsCentral Artifact], pattern: [/target/MbcsCentral/bin/debug/MbcsCentral.exe] in 0s
simple 05-Jan-2014 13:23:03 Finalising the build...
simple 05-Jan-2014 13:23:03 Stopping timer.
simple 05-Jan-2014 13:23:03 Build MBCSCEN-BETA-JOB1-14 completed.
simple 05-Jan-2014 13:23:03 Running on server: post build plugin 'NCover Results Collector'
simple 05-Jan-2014 13:23:03 Running on server: post build plugin 'Clover Delta Calculator'
simple 05-Jan-2014 13:23:03 Running on server: post build plugin 'Build Hanging Detection Configuration'
simple 05-Jan-2014 13:23:03 Running on server: post build plugin 'Maven Dependencies Postprocessor'
simple 05-Jan-2014 13:23:03 All post build plugins have finished
simple 05-Jan-2014 13:23:03 Generating build results summary...
simple 05-Jan-2014 13:23:03 Saving build results to disk...
simple 05-Jan-2014 13:23:03 Indexing build results...
simple 05-Jan-2014 13:23:03 Finished building MBCSCEN-BETA-JOB1-14.

5 answers

If someone is having trouble with sharing artifacts bewteen a build plan and a deployment environment I found out that you cannot add a new artifact after you have created the deployment environment. SO if your deployment environment cannot download the shared artifact you'll have to create a new deployment enviroment for it to work. 

Same problem here. Thanks for the workaround.

same problem here also. Weird how it just "started working" after I re-added the test deployment environment. 

Same problem here.

You can also work around it by selecting a different build plan for the deployment project, save it and then switch back to the original build plan.

I think it forces Bamboo to re-evaluates which artifacts the build plan produces.

I would start by navigating to the path on the build server C:\Users\Administrator\bamboo-home\artifacts\MBCSCEN-BETA\ and search for the rest of your path. You're looking for /target/MbcsCentral/bin/ which might be better represented as **/target/MbcsCentral/bin/ I worry about starting a pattern with a / since that tends to anchor to unwanted locations. You might also try your copy pattern **/**/MbcsCentral.exe which would give you a little more leeway in locating your executable. Play around with the copy pattern and see if the target exists in your build directories somewhere so you can figure out exactly where it is being put.

Gretchen,

Thanks for the reply. But I am as confused as ever. The "artifact" seems to be a moving target: I tried as you suggested but find that the output moves from one directory to another and is still not found at the end of the job.

I am afraid that I do not grasp the concept of "artifact".

A clear explanation of what an artifact is, how it relates to the job steps and how to define it on each step would be very much appreciated.

The artifact is the exe that you are trying to create on the artifacts tab. MbcsCentral.exe.

In your build you should be outputting it to the location specified in your copy pattern (or change your copy pattern to get the file from where it is actually being built this is probably an obj, bin, or debug/obj debug/bin directory or some other location specified in your build as the output location for the exe to land).

It looks like bamboo can't find it in the location you've specified in your copy pattern. It looks like this is your defined copy pattern: /target/MbcsCentral/bin/debug/MbcsCentral.exe but the MbcsCentral.exe isn't located there on the bamboo file system.

The error:

C:\Users\Administrator\bamboo-home\artifacts\MBCSCEN-BETA\shared\build-00014\MbcsCentral-Artifact is not a directory

points to the problem. It should probably be in the build directory somewhere. Start with a search for MbcsCentral.exe in this directory: C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1

Once you find that executable select the path under the JOB1 directory where the exe is located. That is what should be in your artifact definition copy pattern starting with the foldername under JOB1 (not with a /) .

Still confused. I tried following your rather general suggestions but they are not helping me fill in the relevant task fields properly. Still getting the exact same error message no matter how I change the task definitions. How can that be? If I change copy patterns why should the error be the same?

No where in my tasks do I use, C:\Users\Administrator\bamboo-home\artifacts\MBCSCEN-BETA\shared\build-00014\MbcsCentral-Artifact, so I have no idea how that relates to anything.

Questions:

1) Where does the build task place the output (MbcsCentral.exe)? It looks like it ends up in, C:\Users\Administrator\bamboo-home\xml-data\build-dir\MBCSCEN-BETA-JOB1\MbcsCentral\bin\Debug

2) Given that, exactly what should the Artifact Definition show as copy pattern?

3) Then what should the Artifact Download task use as Destination Path?

A2:The Artifact Definition should be configured with MbcsCentral\bin\Debug\MbcsCentral.exe (or **\bin\Debug\M*.exe and variations should work) as the copy pattern.

A3: wherever you want it. Usually I leave that blank and the executable will be saved to the root directory of the workspace (the JOB1 directory assuming you only have one stage).

Sometimes I do put a ./deploy/ folder in that path to isolate the exe but try leaving it blank first.

I still have no idea what "downloading an artifact" is or how it fits into the Bamboo process. I attempted to follow all of your suggestions without success.

I have to ask one more time for a simple explanation of what artifact downloading is, if it is even needed, and how does it fit into the build/deployment cycle.

Why does this explanation not exist in the available documentation and why is it so obtuse?

I have been programming for over thirty years and can still learn new concepts. This one escapes me and the explanations to date have not helped.

Artifact download refers to moving the executable file that is the output of your build job to a defined location making it available to other plans (build or deployment) to use.

I think at this point you should probably put in a support ticket. They can take a closer look at your data. Hopefully they can help you.


Hi All,

Even I was facing the same issue as Michael.I tried as suggested by Gretchen and could see exe/jar/war under artifact/JOB/shared/build-00007/Testartifact/POCSample/target. One thing I couldn't understand is, the error exists in my log and getting build result in red color still. why this happens? Am I missing anything? 

My configuration in Maven3.x goal is "clean package"

Thanks.

According to your issue I figure out bamboo is trying to search in wrong directory path for artifact. please take a look at below command which is used by bamboo to grab artifact.

goto build directory and execute this command, change underlined areas according to your artifact definitions. if this doesn't grab any artifacts you need to change artifact definitions.

dir /s \path\given\target **\*.war

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,066 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot