Bitbucket pipeline global function

26 Views Asked by At

I have pipeline like below

definitions:
  steps:
    common_function: &common_function |
      if [ "$BITBUCKET_BRANCH" == "master" ]; then
       echo "steps"
      fi

pipelines:
  branches:
    master:
      - step:
          name: Step1
          size: 2x 
          runs-on: 
            - 'scanner.scanner'
          script:
            if some condition; then
                  common_function
              fi

but the common_function is not getting called and getting the below error. I tried with * as well.

if [ -n "$bugs" ] || [ -n "$vulnerabilities" ] || [ "$status" = "ERROR" ]; then
   common_function
fi
bash: common_function: command not found

Can someone help

if [ -n "$bugs" ] || [ -n "$vulnerabilities" ] || [ "$status" = "ERROR" ]; then
   common_function
fi
bash:common_function: command not found
0

There are 0 best solutions below