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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I run a custom script from within bitbucket-pipelines.yml

Hi folks

I am trying to use Bitbucket Pipelines to build my Android App and I am struggling with a custom script I wrote to avoid having everything in the .yml file.

This is my error:

chmod +x ./
chmod: changing permissions of ‘./’: Operation not permitted

 This is my bitbucket-pipelines.yml

image: uber/android-build-environment:latest

pull-requests: '**':
- step:
name: "Build DEBUG and run Unit Tests"
- gradle
- echo "START script"
- chmod +x ./
- ./
- echo "END script"
artifacts: - app/build/outputs/apk/debug/*.apk


How can I solve this and make executable?

1 answer

0 votes
Aneita Atlassian Team Dec 19, 2019

Hey @azolliker


Looks like your config is slightly incorrect. It should be

chmod +x

instead of 

chmod +x ./


Let me know if that fixes things :) 

Hi @Aneita 

Sorry for the late answer. It works for me with following setting:

image: mingc/android-build-box:latest

        '**': #this runs as default for any branch not elsewhere defined
        - step:
            name: "Build [DEBUG] and run Unit Tests"
                - gradle
                - gradlewrapper
                - androidavd
                - echo "START script"
                - /bin/bash
                - echo "END script - artifacts we [DEBUG] build can be downloaded..."
                - app/build/outputs/apk/debug/*.apk

definitions: caches: gradlewrapper: ~/.gradle/wrapper androidavd: $ANDROID_HOME/.android/avd

I don't even need the `chmod` any more :-)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

3,808 views 64 20
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you