Artifacts not being passed on nor deployed
Asked by heisajoeri:

Hi all,

I've been struggling with this all day.  

This is my pipeline:

```
pipelines:

custom: 

Build & Deploy to staging:

 - step:

name: Build yarn

image: node:14.16.0

caches:

 - node

script:

# Go to theme directory

 - cd "wp-content/themes/$THEMENAME" 

# Install npm dependencies

 - yarn

# Compile assets for production

 - yarn build:production

artifacts: # only accepts relative paths to $BITBUCKET_CLONE_DIR

 - /dist/**

 - step:

name: Install Composer dependencies

image: thesoul/php-composer-phpunit:8.0

caches:

 - composer

script:

# Go to theme directory

 - cd "wp-content/themes/$THEMENAME" 

 - composer install --ignore-platform-reqs

artifacts: # only accepts relative paths to $BITBUCKET_CLONE_DIR

 - /vendor/**

 - step:

name: Deploy

deployment: Staging

image: instrumentisto/rsync-ssh

script:

 - pipe: atlassian/rsync-deploy:0.4.4

variables:

USER: '$STAG_USER'

SERVER: '$STAG_SERV'

REMOTE_PATH: '$STAG_REM_PATH'

LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/'

EXTRA_ARGS: '-zrSlhic --stats --files-from=deployment-include-list.txt --exclude-from=deployment-exclude-list.txt'

# SSH_KEY: '<string>' # Optional.

# SSH_PORT: '<string>' # Optional.

# EXTRA_ARGS: '<string>' # Optional.

# DEBUG: '<boolean>' # Optional.

# DELETE_FLAG: '<boolean>' # Optional.

# https://explainshell.com/explain?cmd=rsync+-zrSlh+--exclude-from%3Ddeployment-exclude-list.txt+.%2F.+%7B%7B+%24remote+%7D%7D
```

<br />

<br />

<br />

What it's supposed to do:  

Go to the theme folder, build yarn and save the artifacts for the next steps  
Then run composer, and save the artifacts for the next step  
Then take the artifacts plus the rest of the repo and rsync this to our server.  
I can't get the artifacts to pass on, nor even get the vendor directory uploaded.


Answers:
author: Norbert C
body: Hi Joeri,

Thanks for reaching out to Atlassian Community, my name is Norbert and I'm a Bitbucket Cloud Support Engineer, it's nice to meet with you!

Based on my observation, you're having issues passing artifacts from one step to another. Can I request some further information from you so that it'll help me troubleshoot this issue?

\* Can you let me know if you provided the relative path to the artifacts in the bitbucket-pipelines.yml file?  
\* Can you run the "ls -lthra $BITBUCKET_CLONE_DIR" as a last command in each step to verify if the artifacts gets created?  
\* Can you see it in the build teardown section that an artifact has been passed?  
\* If you can see it, can you check the build setup part at the next step to see if it's downloading the artifact?

Please let me know. I'm here to help.

Best Regards,  
Norbert  
Atlassian Bitbucket Cloud Support

comments: author: heisajoeri
body: Hi Norbert, thanks for the reply.

```
+ ls ./dist/
assets.json
images
scripts
styles
vendor
```

```
+ ls -lthra $BITBUCKET_CLONE_DIR
total 36K
drwxr-xr-x 8 root root 4.0K Jun 15 14:29 ..
-rw-rw-rw- 1 root root 99 Jun 15 14:29 deployment-include-list.txt
-rw-rw-rw- 1 root root 1.1K Jun 15 14:29 deployment-exclude-list.txt
-rw-rw-rw- 1 root root 2.1K Jun 15 14:29 bitbucket-pipelines.yml
-rw-rw-rw- 1 root root 2.4K Jun 15 14:29 .gitignore
drwxrwxrwx 4 root root 4.0K Jun 15 14:29 wp-content
drwxrwxrwx 8 root root 4.0K Jun 15 14:29 .git
drwxr-xr-x 2 root root 4.0K Jun 15 14:29 node_modules
drwxrwxrwx 5 root root 4.0K Jun 15 14:29 .
2022-06-15T14:30:58.348565254Z stderr P                                                                                                                                                                         15% building modules 49/49 modules 0 active                                                                                                             71% sealing             72% optimizing                73% basic module optimization                                           74% module optimization                         75% advanced module optimization                                          76% basic chunk optimization                                          77% chunk optimization                        78% advanced chunk optimization                                 79% module and chunk tree optimization                                                        80% chunk modules optimization                                81% advanced chunk modules optimization                                                                                 82% module reviving                     83% module order optimization                                     84% module id optimization                                            85% chunk reviving                    86% chunk order optimization                                    87% chunk id optimization                                                       88% hashing             89% module assets processing                                90% chunk assets processing                             91% additional chunk assets processing                                                                                          92% recording               91% additional asset processing                                       92% chunk asset optimization                                          94% asset optimization                                            95% emitting                                       
```

```
Build teardown
1s
Assembling contents of new cache 'node'
Searching for files matching artifact pattern /dist/**?
```

The artifacts tab doesnt show any artifacts, and the next step also doesnt download anything when building.


author: Norbert C
body: Hi Joeri,

Thank you for the output.

Based on my observation the artifacts are not getting packed as the dist directory is not in the $BITBUCKET_CLONE_DIR directory.

```
+ ls -lthra $BITBUCKET_CLONE_DIR
total 36K
drwxr-xr-x 8 root root 4.0K Jun 15 14:29 ..
-rw-rw-rw- 1 root root 99 Jun 15 14:29 deployment-include-list.txt
-rw-rw-rw- 1 root root 1.1K Jun 15 14:29 deployment-exclude-list.txt
-rw-rw-rw- 1 root root 2.1K Jun 15 14:29 bitbucket-pipelines.yml
-rw-rw-rw- 1 root root 2.4K Jun 15 14:29 .gitignore
drwxrwxrwx 4 root root 4.0K Jun 15 14:29 wp-content
drwxrwxrwx 8 root root 4.0K Jun 15 14:29 .git
drwxr-xr-x 2 root root 4.0K Jun 15 14:29 node_modules
drwxrwxrwx 5 root root 4.0K Jun 15 14:29 .
```

To make this work, can I ask you for the artifacts to provide the relative path from the $BITBUCKET_CLONE_DIR ?

Please let me know if that helped.

Best Regards,  
Norbert  
Atlassian Bitbucket Cloud Support


Tags: bitbucket-cloud

cloud