Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I cancel a pipeline that is waiting on a manual trigger?

I used the starter template when starting to create a pipeline:

# This is an example Starter pipeline configuration
# Use a skeleton to build, test and deploy using manual and parallel steps
# -----
# You can specify a custom docker image from Docker Hub as your build environment.

image: atlassian/default-image:3

pipelines:
  default:
    - parallel:
      - step:
          name: 'Build and Test'
          script:
            - echo "Your build and test goes here..."
      - step:
          name: 'Lint'
          script:
            - echo "Your linting goes here..."
      - step:
          name: 'Security scan'
          script:
            - echo "Your security scan goes here..."

    # The following deployment steps will be executed for each pipeline run. To configure your steps and conditionally deploy see https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/
    - step:
        name: 'Deployment to Staging'
        deployment: staging
        script:
          - echo "Your deployment to staging script goes here..."
    - step:
        name: 'Deployment to Production'
        deployment: production
        trigger: 'manual'
        script:
          - echo "Your deployment to production script goes here..."

When running this pipeline it waits for the manual trigger stage:

enter image description here

I don't want to run that stage and want to just cancel the pipeline, but I cannot find any button in the UI to do that. It's currently hanging in the "IN_PROGRESS" state which I don't want because I plan on filtering pipelines by state for other purposes. How do I just cancel this?

Can pipelines be set to cancel automatically after a certain time?

Edit

I tried to rerun and then immediately stop it, but the run is still there as Paused. So it's not In progress, but it's still just hanging out there. Also, while the UI does not show it's in progress the state as returned by the /pipelines/ GET endpoint looks like this:

  "state": {
    "name": "IN_PROGRESS",
    "type": "pipeline_state_in_progress",
    "stage": {
      "name": "PAUSED",
      "type": "pipeline_state_in_progress_paused"
    }
  },

Is there no way to just remove and clean up this run?

enter image description here

like image 877
red888 Avatar asked Dec 28 '25 21:12

red888


1 Answers

A workaround is to start it and then immediately stop it. The pipeline would show as stopped.

The worker waiting time plus the setup phase are usually slow enough so that your pipeline step script would not even start.

Yet, keep in mind that the deploy steps can be individually redeployed and the full pipeline can be re-run. So you can't effectively irreversibly cancel that pipeline in a way that it can't be deployed to production in any future.

like image 101
N1ngu Avatar answered Dec 30 '25 22:12

N1ngu