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,551,903
Community Members
 
Community Events
184
Community Groups

problem uploading gradle build scans

we are running gradle tasks with the --scan parameter in our pipelines but most of the time they cannot be views afterwardsScreenshot 2023-04-14 at 16.25.18.pngScreenshot 2023-04-15 at 22.46.19.png

what could be the reason?

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.
Apr 18, 2023

Hi Thomas,

I do not recognize these screenshots, are these from a third-party application? If so, are you uploading in this application scan results while a Pipelines build is running?

If this is the case, I would suggest adding a flag for verbose output (if available) to the command(s) in your bitbucket-pipelines.yml file that upload these scans. Then, the output of the command(s) may give you an indication of what is going wrong with the upload.

The second screenshot you attached seems to have a link to a 'User Manual', this may have additional info on how to troubleshoot the issue.

Kind regards,
Theodora

the images are from the gradle server where I want to view the results of the build scan

my build step looks something like

- step:
name: Tests
size: 2x
caches:
- gradlewrapper
- gradle
script:
- ./gradlew test --stacktrace --scan
services:
- mysql

and at the end of the stop the output shows something like

Publishing build scan...
https://gradle.com/s/linktoscanresult

but when I click I get the errors shown above

The manual behind the links says that I could get more information by looking into

~/.gradle/build-scan-data/upload-failure.log

is there a way to get that file from my pipeline?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 19, 2023

Hi Thomas,

Just to give you some context, Pipelines builds run in Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. If you use a service for a step, then a second Docker container will start for the service which will share a network adapter with your build container. The repo is cloned in the build container, and then the commands of the step's script are executed. When the step finishes, these Docker containers get destroyed (so, any files in these containers get destroyed as well).

I can think of a few ways to access the file ~/.gradle/build-scan-data/upload-failure.log:

 

1) Create an after-script for your step:

In the after-script, upload this file to a server of yours or to the Downloads page of the repo with the following pipe:

Please keep in mind that if you upload it to the Downloads page of the repo, the file will get replaced the next time a build runs and uploads another file with the same name.

I suggest using an after-script, so that the step won't fail in case the upload of build scans is successful and the file doesn't exist.

 

2) In the after-script of the step, copy this file with a cp command to the build directory (exposed in the variable $BITBUCKET_CLONE_DIR) or to a subdirectory of the build directory, and then define this file as an artifact:

I suggest copying the file because only files in $BITBUCKET_CLONE_DIR and its subdirectories can be defined as artifacts.

Then, while viewing the build log of a specific build on Bitbucket Cloud website, the artifact will be found in the Artifacts tab of the build log and can be downloaded from there (it will remain there for 14 days until it expires).

The purpose of artifacts is to make files generated by one step available to subsequent steps, which may not be desirable here. I am just sharing this option as an easy way to get the file from a tab in the build log. You can always disable artifacts download in subsequent steps by adding the following to these steps

artifacts:
download: false

 

3) You could also use a cat command in the after-script to show the contents of this file in the Pipelines build log. This may or may not be convenient, depending on the size of the file and the format of its content.

 

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

ok, tried those and found that there is no

~/.gradle/build-scan-data/upload-failure.log

created - which means that the gradle task did not encounter a problem while uploading

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 21, 2023

Hi Thomas,

In this case, I would suggest reaching out to the team that provides support for the server you are using, and asking if they can provide you with any additional steps for troubleshooting.

Kind regards,
Theodora

what resolved my problem was to disable background uploading as explained here https://docs.gradle.com/enterprise/gradle-plugin/#configuring_background_uploading

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 05, 2023

That's good to hear Thomas, thank you for sharing the solution here!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events