Unable to download artifact Shared artifact
Asked by TyMac711:

I have my first, very simple build and deployment flows I'm trying to produce. The build is successful but the deploy is not. It dies with:

Unable to download artifact Shared artifact: \[Script_art\], pattern: \[\*.\*\] anchored at: \[.\]

Looks like I basically have no idea how to configure my artifact correctly. If I go to my default job in my build project I defined an artifact with a location of "." and a copy pattern of "\***.**\*". The artifact is selected in the Artifact Download task in the Deploy project but always fails with the above message.

Since the "build" is really just a Bitbucket pull and a follow up powershell script to copy the files to a different location there should not be much to dig through to to fix... but I don't know what I'm doing here so any help would be appreciated!


Answers:
author: Oliver Friedrich
body: It seems like it depends on the order of the create/edit of artifacts and deployment plan. After any artifact configuration in a build plan has been changed, edit all of the tasks in your deployment plans using this artifacts and save them - no changes need to be made, just click the save button.

This solved it for me.

comments: author: Victorio Berra
body: yeah that is what solved it for me too.


author: Henry Noerdlinger
body: Rafael, there clearly is either a bug or an undocumented order of configuration.

My build plan did not have an artifact definition associated with its one job. I then went and created a deploy plan and realized I need to go back to build plan and add the artifact generation.

I did this, completed my deploy plan. I manually ran the build plan and verified the artifact had been published. I then ran the deploy plan and received error at top of this thread.

The only solution that worked was to delete my entire deploy plan and recreate it.

Clearly the build plan MUST have an artifact definition with at least one job BEFORE a deploy plan is created.

We are running Bamboo on an internal install version:

[Atlassian Bamboo](http://www.atlassian.com/software/bamboo/) version 6.2.9 build 60215 - 11 Jan 18

comments: author: rsperafico
body: Hi [@Henry Noerdlinger](/t5/user/viewprofilepage/user-id/1247539),

Thank you for your update.

I have attempted on replicating the issue you have reported by following the steps given and Bamboo was able to download the artifact published without having to delete and recreate deployment :(

Test was conducted against Bamboo v6.2.9

1. created a Project - Plan (e.g Community - Artifact, planKey COM-ART)
2. added Script task

   ```
   echo "foo" > foo.txt
   ```

3. finalized plan creation
4. created Deployment (e.g Community), consuming planKey COM-ART above created
5. added Environment (e.g Staging), by default two task are added 1) Clean working directory 2) Artifact download
6. added Script task to print artifact downloaded

   ```
   cat foo.txt
   ```

7. saved tasks, message is displayed.  
   No **shared** artifacts found for related plan. Please [configure the build plan](http://bamboo.rsperafico/browse/COM-ART/config) to publish shared artifacts.
8. go back to plan and create Artifact definition

   ```
   Name: TXT
   Location: 
   Copy pattern: *.txt
   ```

9. enable plan and run build, resulting on COM-ART-1

   ```
   simple?? ?17-Apr-2018 17:43:28?? ?Build Community - Artifact - Default Job #1 (COM-ART-JOB1-1) started building on agent Default Agent
   simple?? ?17-Apr-2018 17:43:28?? ?
   simple?? ?17-Apr-2018 17:43:28?? ?Build working directory is /opt/atlassian/product/bamboo/6.2.9/home-psql/xml-data/build-dir/COM-ART-JOB1
   simple?? ?17-Apr-2018 17:43:28?? ?Executing build Community - Artifact - Default Job #1 (COM-ART-JOB1-1)
   simple?? ?17-Apr-2018 17:43:28?? ?Running pre-build action: VCS Version Collector
   simple?? ?17-Apr-2018 17:43:28?? ?Starting task 'Script' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'
   command?? ?17-Apr-2018 17:43:28?? ?Beginning to execute external process for build 'Community - Artifact - Default Job #1 (COM-ART-JOB1-1)'...
   ...
   simple?? ?17-Apr-2018 17:43:29?? ?Finished task 'Script' with result: Success
   simple?? ?17-Apr-2018 17:43:29?? ?Running post build plugin 'NCover Results Collector'
   simple?? ?17-Apr-2018 17:43:29?? ?Running post build plugin 'Artifact Copier'
   simple?? ?17-Apr-2018 17:43:29?? ?Publishing an artifact: TXT
   simple?? ?17-Apr-2018 17:43:29?? ?Finished publishing of artifact Shared artifact: [TXT], pattern: [*.txt] in 55.88 ms
   simple?? ?17-Apr-2018 17:43:29?? ?Running post build plugin 'npm Cache Cleanup'
   simple?? ?17-Apr-2018 17:43:29?? ?Running post build plugin 'Clover Results Collector'
   simple?? ?17-Apr-2018 17:43:29?? ?Running post build plugin 'Docker Container Cleanup'
   simple?? ?17-Apr-2018 17:43:29?? ?Finalising the build...
   simple?? ?17-Apr-2018 17:43:29?? ?Stopping timer.
   simple?? ?17-Apr-2018 17:43:29?? ?Build COM-ART-JOB1-1 completed.
   simple?? ?17-Apr-2018 17:43:29?? ?Running on server: post build plugin 'NCover Results Collector'
   simple?? ?17-Apr-2018 17:43:29?? ?Running on server: post build plugin 'Build Hanging Detection Configuration'
   simple?? ?17-Apr-2018 17:43:29?? ?Running on server: post build plugin 'Clover Delta Calculator'
   simple?? ?17-Apr-2018 17:43:29?? ?Running on server: post build plugin 'Maven Dependencies Postprocessor'
   simple?? ?17-Apr-2018 17:43:29?? ?All post build plugins have finished
   simple?? ?17-Apr-2018 17:43:29?? ?Generating build results summary...
   simple?? ?17-Apr-2018 17:43:29?? ?Saving build results to disk...
   simple?? ?17-Apr-2018 17:43:29?? ?Logging substituted variables...
   simple?? ?17-Apr-2018 17:43:29?? ?Indexing build results...
   simple?? ?17-Apr-2018 17:43:29?? ?Finished building COM-ART-JOB1-1.
   ```

10. create release and deploy it, as a result, deploy displays foo

    ```
    simple?? ?17-Apr-2018 17:43:40?? ?Build Deployment of 'release-1' on 'Staging' started building on agent Default Agent
    simple?? ?17-Apr-2018 17:43:40?? ?
    simple?? ?17-Apr-2018 17:43:40?? ?Build working directory is /opt/atlassian/product/bamboo/6.2.9/home-psql/xml-data/build-dir/3080194-3145730
    simple?? ?17-Apr-2018 17:43:40?? ?Executing build Deployment of 'release-1' on 'Staging'
    simple?? ?17-Apr-2018 17:43:40?? ?Starting task 'Clean working directory task' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:cleanWorkingDirectoryTask'
    simple?? ?17-Apr-2018 17:43:40?? ?Cleaning working directory '/opt/atlassian/product/bamboo/6.2.9/home-psql/xml-data/build-dir/3080194-3145730'
    simple?? ?17-Apr-2018 17:43:40?? ?Finished task 'Clean working directory task' with result: Success
    simple?? ?17-Apr-2018 17:43:40?? ?Starting task 'Download release contents' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'
    simple?? ?17-Apr-2018 17:43:40?? ?Preparing to download plan result COM-ART-1 artifact: Shared artifact: [TXT], pattern: [*.txt]
    simple?? ?17-Apr-2018 17:43:40?? ?Artifact [TXT] downloaded successfully in 3.226 ms to working directory
    simple?? ?17-Apr-2018 17:43:40?? ?Finished task 'Download release contents' with result: Success
    simple?? ?17-Apr-2018 17:43:40?? ?Starting task 'Script' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'
    command?? ?17-Apr-2018 17:43:40?? ?Beginning to execute external process for build 'Deployment of 'release-1' on 'Staging''...
    ...
    build?? ?17-Apr-2018 17:43:40?? ?foo
    simple?? ?17-Apr-2018 17:43:40?? ?Finished task 'Script' with result: Success
    simple?? ?17-Apr-2018 17:43:40?? ?Finalising the build...
    simple?? ?17-Apr-2018 17:43:40?? ?Stopping timer.
    simple?? ?17-Apr-2018 17:43:40?? ?Build 3080194-3145730-3506178 completed.
    simple?? ?17-Apr-2018 17:43:40?? ?Finished processing deployment result Deployment of 'release-1' on 'Staging'
    ```

As previously mentioned, it is preferable raising a support case so specific data and further investigation can be provided.

Kind regards,

Rafael


author: Henry Noerdlinger
body: Thank you for attempting to recreate. I will raise a support case next time. I got my solution from other similar posts on the community forum. That is part of why I was beginning to feel there may be something else wrong.

All the best,

h


author: Robert Praetorius
body: I've tried some of the solutions posted here and none have worked (so far). Is there a place we can look for more detailed logs or some kind of diagnostic logging we can enable? One hopes that Bamboo is logging this stuff some place and not just swallowing the details of the errors.

Does the level of support imply that artifact support isn't taken very seriously in Bamboo? Or is this just a thread where people show up after they've had bad luck trying to use it? Are the a bunch of happy artifact customers out there? And, if so, what are they doing differently?

Finally. . .has anybody on this thread tried a full-blown binary repo manager, like Archiva, Artifactory or Nexus? I know that Artifactory has a Bamboo plugin, but I'm not in a position to install it in production where I work. And I wouldn't want to request it from the infrastructure people if it doesn't help.

\[later edit\] After no action on my part to change anything, the artifact download succeeded this morning, twice in a row. This thread has the air of an uninitialized variable about it.


author: rsperafico
body: Hello community,

When making use of Artifact Download task, you must pay attention to a few things:

* plan that published the artifact cannot be disabled
* Artifact Download task will get the latest shared artifact available
* Only shared artifacts can be consumed
* Shared artifacts are stored outside Build Working Directory, you can find the correct location by referring to *\<bamboo-home\>/bamboo.cfg.xml* :

  ```
  <property name="bamboo.artifacts.directory">${bambooHome}/artifacts</property>
  ```

* Make sure the build has published a shared artifact, for instance, if you have set up your deployment associating it with PROJ-PLAN and the shared artifact was published in one of its branches (e.g *PROJ-PLAN123*), if you do not explicitly deploy from this branch, Bamboo will try to consume the artifact from PROJ-PLAN, failing the deployment because of its inexistency in PROJ-PLAN

Perhaps this knowledge base article [Artifacts in Bamboo Server](https://confluence.atlassian.com/x/6lRqMQ "Artifacts in Bamboo Server") - <https://confluence.atlassian.com/x/6lRqMQ> will provide clarification to this matter.

Hope it helps :)

Kind regards,

Rafael

comments: author: Dan Rossiter
body: Refael,

At least for our issue, and likely for others here, all of the required steps were done. They just didn't work. This certainly appears to be a bug in Bamboo, not a config issue.

For example, if you take a look at my post from back on March 26, you'll see that nothing changed in how the artifact was generated/stored in order to fix the issue.

-Dan


author: rsperafico
body: Hi [@Dan Rossiter](/t5/user/viewprofilepage/user-id/1248009),

Thank you for your update.

Unfortunately, we cannot tell what happened in your case because you have not provided any information to the issue you were experiencing apart from saying that you were experiencing issue(s). If you have deleted the deployment and recreated it to fix the issue, it seems the artifact download task was not pointing to the correct artifact, and reviewing its configuration through a support case could have provide more information to the issue, potentially fixing it without involving deployment recreation.

We understand there were issues related to artifact sharing but it does not mean all all issues reported on this threads are referring to the same problem and the lack of information does not help us helping you.

In case you continue on experiencing issues, you are more than welcome to raise a support case on <https://support.atlassian.com> and we can review the issue requesting specific information.

Kind regards,

Rafael


author: Prem Chudzinski _extensi_
body: same here can't use Artifact Download task


author: John Adams
body: I have tried many of the solutions from this thread and they work, but only for a brief period and them I am back to the same issue. Usually it will work only a day or two...this is very frustrating.

comments: author: Victorio Berra
body: I may be able to provide another piece to the puzzle here.

I have a simple plan with two jobs, and one job (the default) is disabled.

It turns out, artifact download was trying to copy artifacts from the disabled default job. I was able to confirm this by renaming the artifact to something unique in my disabled job and I noticed in the publish logs it was trying to download that one! I fixed my issue by deleting my disabled job entirely.

Can anyone clarify why Bamboo Artifact Download takes the last job's artifact even if said job is disabled?


author: Tushar Kamdar
body: There definitely seems to be some bug when using "Artifact download" task with the "Build" plans. I have No issues if i'm using the exact same (i.e. exact same configuration) for the "Artifact download" task in the "Deployment" projects within Bamboo. I'm consistently seeing this, which results in the error reported in this thread. Not sure if anyone else have used this task ("Artifact download") in the "Build" section and has that working without issues OR were able to resolve the issue there. Any suggestions to resolve this, is much appreciated. Thank You.


author: Pawel Rein
body: Same here. Apparently it works only if I **change** the "**Destination path**" on the deployment end to anything but what was used before.


author: Tushar Kamdar
body: I was having similar issue, i cloned the existing plan having the issue and gave a different name to the new plan. That seemed to do the trick and the issue is fixed now. Though this does not answer the cause of the issue in the original plan, i'm able to move on and continue with my work. If you are still having issues, please note down the steps of the original plan and create a brand new plan (without using clone method) and use the steps noted down for original plan to create the new one. Another user Peter above suggested creating new plan as well. Cloning of the plan - IF works, saves time of not having to add the build steps manually for the new plan.


author: vaibhav
body: Try to save each artifact manually (open artifact definition, check/uncheck shared, click on save) - that helped me resolve the issue.


author: Shashank Singh
body: Me too facing similar issue.![Artifact_download_issue.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/8877i426612BA4A39A6B1/image-size/large?v=v2&px=999 "Artifact_download_issue.PNG")

comments: author: Eric Fossum
body: Have you tried recreating the plan like the others said? That worked for me.


author: jreim
body: did anyone ever solve this issue?

comments: author: Henry Noerdlinger
body: I was able to solve problem by deleting entire deployment project and recreating it.


author: kerry borden
body: Im seeing the same result. I have a build which produces the artifact, and I can see it in the Artifacts tab on the completed build. When I attempt to deploy this artifact using a deployment plan, I get

Unable to download artifact Shared artifact: \[buildPlanArtifact\], pattern: \[\*.tar.gz\] anchored at: \[target\]

Very frustrating. My only workaround was to do this on another identical agent, but now its happening there.

comments: author: plindroos
body: I had this too today, but just deleted the problematic Deployment plan and created a new, that worked.


author: Dan Rossiter
body: We just ran into this bug and [@plindroos](/t5/user/viewprofilepage/user-id/1145271) fix was the only thing we could get to work. Killing the environment in question was not sufficient -- had to be the full deployment plan.

I believe we entered the bad state when an artifact was renamed in the plan and deployment. One of the renamed artifacts was the one being barfed on.


author: fgabrieli
body: I also was able to fix it by deleting the entire deployment project and recreating it.


author: TyMac711
body: @Christian Glockner \[Atlassian\]

Still getting an error when I try using the \*\*/\* pattern. The files are not moved but copied to a second directory and I verified they are still there:

PS C:\\Users\\user001\\bamboo-agent-home\\xml-data\\build-dir\> ls

<br />

Directory: C:\\Users\\user001\\bamboo-agent-home\\xml-data\\build-dir

<br />

Mode LastWriteTime Length Name  
---- ------------- ------ ----  
d----- 4/24/2016 12:13 PM 786433-851969  
d----- 4/23/2016 6:09 PM DSC-SYS-JOB1  
d----- 4/24/2016 12:13 PM repositoryData

<br />

PS C:\\Users\\user001\\bamboo-agent-home\\xml-data\\build-dir\> cd .\\DSC-SYS-JOB1  
PS C:\\Users\\usr001\\bamboo-agent-home\\xml-data\\build-dir\\DSC-SYS-JOB1\> ls

<br />

Directory: C:\\Users\\user001\\bamboo-agent-home\\xml-data\\build-dir\\DSC-SYS-JOB1

<br />

Mode LastWriteTime Length Name  
---- ------------- ------ ----  
-a---- 4/23/2016 6:09 PM 522 dsc_pushover_alert.ps1  
-a---- 4/23/2016 6:09 PM 2031 Get-NewAesKey.psm1  
-a---- 4/23/2016 6:09 PM 151 [README.md](http://README.md)

Unable to download artifact Shared artifact: \[Script_art\], pattern: \[\*\*/\*\] anchored at: \[.\]


author: TyMac711
body: @Tim Crall - yes I see my artifact "Script_art" in the Artiifacts tab of my "Default Job" under my "Default Stage" in my build "Build projects / DSC / Sysconfig".

@Christian Glockner \[Atlassian\] This "build" is only the checkout of a bunch of powershell scripts and then a follow up task that copies them (via a powershell command) to a second directory. I am out of town for a few days so when I get back I will try this build.


author: Christian Glockner
body: Hi Claude,

With the configuration you have in place for your artifact, Bamboo would consider all files in the build's target directory for inclusion in the artifact. It will not consider subdirectories, because in this case the copy pattern should be "\*\*/\*".

You said you use Powershell to move files around - are they still in the "target" directory? If you're having trouble figuring this out, please feel free to open a ticket at support.atlassian.com.

-Christian


author: Tim Crall
body: Do you see the artifact listed on the "Artifacts" tab of the build result?


Tags: cloud