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

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

azolliker December 5, 2019

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
Atlassian Team members are employees working across the company in a wide variety of roles.
December 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 :) 

azolliker July 8, 2020

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
AUG Leaders

Atlassian Community Events