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 ./build-debug.sh
chmod: changing permissions of ‘./build-debug.sh’: Operation not permitted

 This is my bitbucket-pipelines.yml

image: uber/android-build-environment:latest

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

 

How can I solve this and make build-debug.sh 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 build-debug.sh

instead of 

chmod +x ./build-debug.sh

 

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

pipelines:
    pull-requests:
        '**': #this runs as default for any branch not elsewhere defined
        - step:
            name: "Build [DEBUG] and run Unit Tests"
            caches:
                - gradle
                - gradlewrapper
                - androidavd
            script:
                - echo "START script build-debug.sh"
                - /bin/bash build-debug.sh
                - echo "END script build-debug.sh - artifacts we [DEBUG] build can be downloaded..."
            artifacts:
                - 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
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

918 views 0 3
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