Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Permission issue while running the gradle build through Bitbucket pipelines

Vishal_infy February 2, 2020

Hi,

We are trying to decorate bitbucket with Sonarcloud for every pull request and commit for a project with gradle build.

As a part of this, we have created a bitbucket-pipelines.yml file and used the standard pipeline syntax for a gradle technology, but while executing/running the bitbucket-pipeline we are facing the following error:

Set executable permissions for: /root/.gradle/wrapper/dists/gradle-2.1-all/27drb4udbjf4k88eh2ffdc0n55/gradle-2.1/bin/gradle

Yml Script: Standard Bitbucket yml template for gradle build:

script:
- ./gradlew build sonarqube
artifacts:
- build/libs/**

 

This build was successfull in local and also in Jenkins but not through Bitbucket. Can someone please suggest what needs to be done here?

Thank you,

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 3, 2020

Hello @Vishal_infy,

What Docker image are you using? Please post entire Pipelines configuration file, otherwise it's hard to guess what's wrong. Actually, in the message you've posted there's no indication of any errors. I assume there're few more lines pointing to the actual error.

In general, Pipelines run your script in the Docker image you specified (or in default image, if you didn't). You can troubleshoot the issue you're facing by running your script step by step inside a Docker container locally, here's a guide on how to do that.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Vishal_infy February 3, 2020

Hi @Daniil Penkin ,

Following is the yml script which i am using to run the pipeline. Please let me know if anything is wrong in this:

 

image: openjdk:11

clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly

definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- gradle
- sonar
script:
- bash ./gradlew clean build
artifacts:
- build/libs/**

pipelines:
branches:
'**':
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 7, 2020

Looking at Gradle wrapper's code I can see that this message is not an error, rather an expected behaviour:

Set executable permissions for ...

So the reason why the build failed is somewhere else.

I'd recommend to try debugging your pipeline locally. Basically, you can run openjdk:11 Docker container locally with your repository working directory mounted as a volume, and then run your script commands one by one.

I also noticed that the wrapper is for Gradle 2.1 which is pretty old. Are you running the build locally using the wrapper? If not, maybe you have more recent version of Gradle but haven't updated the wrapper for quite some time?

Hope this helps.

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events