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

How to avoid archiving a file uploaded to Artifacts?

JJ지우근 October 3, 2021

Hello,

I have been writing my bitbucket-pipelines.yml which includes artifacts in order to pass the generated war file during the building process for the next step(deployment)

However, the war is compressed as tar.gz.

Can I just upload admin.war to artifacts as it is?

The uploaded file is named as "artifact_2dfe02f9-78ba-4a44-9a33-b5bb96decd64.tar.gz"

My bitbucket-pipelines.yml is as follows.

image: gradle:6.6.0
pipelines
:
default:
- parallel:
- step:
name: Build and Test
caches:
- gradle
script:
- ./gradlew build
- ./gradlew war
- apt-get update -y
- apt-get install tree -y
- tree
- cp build-0.0.1.war ../../admin.war
- cd ../..
- pwd
- ls -al
artifacts:
- admin.war
- step:
name: Deploy to test
deployment: test
trigger: manual
script:
- pipe: atlassian/bitbucket-upload-file:0.3.2
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
FILENAME: 'admin.war'

 

Tree


├── admin.war
├── bitbucket-$BITBUCKET_USERNAME.yml

├── build
│   ├── classes
│   │  
│   ├── libs
│   │   ├── build-0.0.1.war
│   │   └── exploded
│   │   └── admin-0.0.1.war

 

ls -al

total 14664
drwxrwxrwx. 8 root root 4096 Oct 4 09:22 .
drwxr-xr-x. 8 root root 4096 Oct 4 09:21 ..
-rw-rw-rw-. 1 root root 14954308 Oct 4 09:22 admin.war
-rw-rw-rw-. 1 root root 1392 Oct 4 09:22 bitbucket-$BITBUCKET_USERNAME.yml
drwxrwxrwx. 6 root root 4096 Oct 4 09:22 build
-rw-rw-rw-. 1 root root 3844 Oct 4 09:22 build.gradle
drwxrwxrwx. 8 root root 4096 Oct 4 09:22 .git
-rw-rw-rw-. 1 root root 2619 Oct 4 09:22 .gitignore
drwxrwxrwx. 3 root root 4096 Oct 4 09:22 gradle
drwxrwxrwx. 6 root root 4096 Oct 4 09:22 .gradle
-rwxrwxrwx. 1 root root 5774 Oct 4 09:22 gradlew
-rw-rw-rw-. 1 root root 2763 Oct 4 09:22 gradlew.bat
-rw-rw-rw-. 1 root root 1849 Oct 4 09:22 pom.xml
drwxrwxrwx. 3 root root 4096 Oct 4 09:22 src
drwxrwxrwx. 7 root root 4096 Oct 4 09:22 WebContent

 image.pngimage.png

Deploy result

Status: Downloaded newer image for bitbucket$BITBUCKET_USERNAME/bitbucket-upload-file:0.3.2
INFO: Executing the pipe...
✖ File admin.war doesn't exist.

Thanks,

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 5, 2021

Hi @JJ지우근,

I believe that the file name you mentioned, artifact_2dfe02f9-78ba-4a44-9a33-b5bb96decd64.tar.gz, is the name of the file when you download the artifact from the Artifacts tab of the Pipelines build log, is that correct?

This doesn't have anything to do with the error you are seeing in the deployment step:

File admin.war doesn't exist.

I think the culprit for this error may be the parallel keyword in your yaml file: parallel steps can only use artifacts produced by previous steps, not by steps in the same parallel set. If both of these steps belong to the same parallel set, then the 2nd one won't be able to use the artifacts generated by the first one.

Are these two steps the only ones in your yaml file? If so, can you remove the parallel keyword from the yaml file and run another build? The admin.war file should then be available for the second step, and the file should be uploaded in the Downloads section of the repo with the same name.

Kind regards,
Theodora

JJ지우근 October 5, 2021

After removing the parallel keyword, I have been able to upload the file to downloads.

Thanks for your support.

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2021

Thank you for the update and you are very welcome, I'm glad to have helped!

Like JJ지우근 likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events