Disable running repository on commit

I’d like to manually trigger all builds. I’ve been trying to use continuation to automatically ignore builds that are triggered by commits, but I’m finding a few issues and I’d like to know if there’s a better way.

Hello!
I guess the thing you search for is the manual approval feature: Using Workflows to Schedule Jobs - CircleCI.

It looks like this requires manual approval for every run. I only want to require it for commits, not api-triggered.

The normal way to configure a ‘manually trigger’ environment would be to switch to tags on your repos. By doing this you can exclude commits via a filter and just do a build based on how you name the tag.

So you trigger the build via a CLI or GUI based step of adding the tag to whichever branch you want the build to operate against.

Without workflow starting webhooks, that makes it a bit hard to track. Is there really no other way of doing this?

This is a bit janky, but I’ve created a solution for my problem

workflows:
  version: 2
  build:
    when: # only execute when triggered by the api
      equal: [<< pipeline.trigger_source >>, api]
    jobs:
      - whatever
  noop:
    when: # prevents build errors
      not:
        equal: [<< pipeline.trigger_source >>, api]
    jobs:
      - noop

jobs:

  # do nothing
  noop:
    docker:
      - image: cimg/base:2022.06-22.04
    resource_class: small
    steps:
      - run: echo noop
2 Likes

@squili Pretty nice solution, as for me - easy to understand and without redundant things!

Hi @squili ,

Sorry if I’m a little late to the party,.

Maybe a simple way would be to unselect the “Pushes” event in the “Let me select individual events.” section of your webhook settings (in the VCS repository settings) :thinking:

Doing so would prevent webhook deliveries from being triggered when you push commits to the repository.

1 Like

This appears to have worked for me. I’ll leave the old code just in case, but this should probably documented somewhere.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.