Builds not triggering from bitbucket

2.0

#1

Hi,

I was trying to add another project to be build in CircleCi today, but whenever I push to a branch in bitbucket the build is not started it CircleCi :frowning:

I can trigger the build manually by calling the api curl -X POST -H "Content-Type: application/json" https://circleci.com/api/v1.1/project/bitbucket/<org>/<project>/tree/<branch>?circle-token=<my_token> and the build goes through ok, so my .circleci/config.yml is correct.

I tried using “Stop building” a few times and confirmed it removes the webhooks in bitbucket. When I configured the project again in CircleCi the webhooks were added back and look ok. When I make a push to the branch, bitbucket records it made the webhook request and received HTTP 200 OK response with Event repo:push successfully submitted message, but builds are not triggered :frowning:

Anything I missed or can try to get the builds to trigger when a push is made?

Thanks!


#2

Either you have a YAML syntax error in your config, or your workflow config is set to scheduled builds only. Can we see your config, in a Markdown formatted block?


#3

Since the config works from manual trigger, I’d say it’s not a syntax error.

It’s almost exactly the same config we use for other projects, just some parameter values in scripts are changed, which makes this very frustrating.

Here it is:

version: 2
jobs:
  build:
    docker:
      - image: circleci/python:3.7
        environment:
          AWS_DEFAULT_REGION: eu-west-1
          AWS_SOURCE_STORAGE_BUCKET_NAME: mybucket

    branches:
      only:
        - master
        - test

    steps:
      - checkout
      - run:
          name: Install awscli # debian has a very old version of awscli in repos
          command: sudo pip install awscli
      - deploy:
          name: Deploy
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
               ./bin/deployCodeVersion.sh $CIRCLE_SHA1 "env-prod"
            elif [ "${CIRCLE_BRANCH}" == "test" ]; then
               ./bin/deployCodeVersion.sh $CIRCLE_SHA1 "env-test"
            fi

#4

Aha, you hit a bug that’s been mentioned a few times recently. I believe there is a problem with branch filtering on jobs presently. Create yourself a little workflow, and move the branch filter to the workflow:


#5

Thanks, I’ve added the most basic workflow

workflows:
  version: 2
  main:
    jobs:
      - build:
          filters:
            branches:
              only:
                - master
                - test

and the build was triggered on push to the branch! This is quite annoying, because I think it works ok with the branch filtering without the workflow for our other projects!

Thanks a lot for pointing me in the right direction, hopefully I’ll get fixed soon :slight_smile:


#6

Most folks encountering this bug are sticking with the workflow filter, as most non-trivial CI strategies will need workflows at some point anyway. But yes, the CircleCI peeps know about it… :smiley_cat:


#7

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