how to set bitbucket pipelines to be manually triggered?

Viewed 1011

i wrote a pipeline in bitbucket environment but i would like the pipeline to be triggered only when the user run it and not automatically on push or commit. here is the code:

pipelines:  
 branches:
    new_ui_apk:
      - step:
          name: Build apk
          size: 2x
          script:
            - JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
            - docker build -t app-release:1.0.0 .
          services:
            - docker
          

definitions:
  services:
    docker:
      memory: 7128

actually i use the skip ci tip to avoid it but if another team member push or commit any change, the pipeline will run, how else can i avoid it please?

2 Answers

if you mention the definition under "custom" property it stops listening branches and only acts when a user triggers it.

use this.

pipelines:  
 custom:
    new_ui_apk:
      - step:
          name: Build apk
          size: 2x
          script:
            - JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
            - docker build -t app-release:1.0.0 .
          services:
            - docker
          

definitions:
  services:
    docker:
      memory: 7128

The Answer is not good you only need to add trigger: manual

-step
  image: XXX
  name: XXXX
  deployment: XXXX
  trigger: manual
  script:
    - whatever....

And it will be shown a option to be run inside the pipeline options.

Related