I have several repositories in my project and all of them are integrated in to circleCI. For each I have a CI run on any push and a bump versions run on merge to main. This has been working well for a while now.
Today I switched from requirements.txt to poetry, the CI runs were ok but when I merged the branch to main it started an endless loop in CircleCI of bumpversion, I started in 0.0.4 and now I'm up to 0.0.265. Help!!!
My old config.yml:
version: 2.1
parameters:
bump_patch:
type: boolean
default: false
bump_minor:
type: boolean
default: false
jobs:
ci_check:
docker:
- image: python:3.11.3-slim
resource_class: small
environment:
PYTHONPATH: /root/project
steps:
- checkout # checkout source code to working directory
- run:
name: Install git & requirements
command: |
apt update && apt install -y git
pip install pre-commit
pip install pytest==7.4.2
- run:
name: Run pre-commit
command: |
pre-commit install
pre-commit run --all-files
bump_version:
docker:
- image: python:3.11.3-slim
resource_class: small
parameters:
bump:
type: string
steps:
- checkout
- run:
name: Installs and setup
command: |
apt update && apt install -y git
pip install bump2version==1.0.1
git remote set-url origin $GIT_URL_TOKEN
git config user.email [email protected]
git config --global user.name "CircleCI"
git push --set-upstream origin ${CIRCLE_BRANCH}
- run:
name: Bump version
command: |
DATE=$(date -u +%Y.%m.%d_%H%M%S)
bump2version << parameters.bump >> --message "[skip ci] version bump $DATE"
git push --no-verify
git push --no-verify --tags
workflows:
bump_main:
jobs:
- bump_version:
bump: patch
filters:
branches:
only: main
run_ci:
jobs:
- ci_check
bump_patch:
when: << pipeline.parameters.bump_patch >>
jobs:
- bump_version:
bump: patch
filters:
branches:
only: main
bump_minor:
when: << pipeline.parameters.bump_minor >>
jobs:
- bump_version:
bump: minor
filters:
branches:
only: main
New config.yml:
version: 2.1
parameters:
bump_patch:
type: boolean
default: false
bump_minor:
type: boolean
default: false
jobs:
ci_check:
docker:
- image: python:3.11.3-slim
resource_class: small
environment:
PYTHONPATH: /root/project
steps:
- checkout # checkout source code to working directory
- run:
name: Install git & requirements
command: |
apt update && apt install -y git
pip install pre-commit poetry
poetry install
- run:
name: Run pre-commit
command: |
pre-commit install
SKIP=pytest-check pre-commit run --all-files
- run:
name: Run tests
command: |
poetry run pytest
bump_version:
docker:
- image: python:3.11.3-slim
resource_class: small
parameters:
bump:
type: string
steps:
- checkout
- run:
name: Installs and setup
command: |
apt update && apt install -y git
pip install bump2version==1.0.1
git remote set-url origin $GIT_URL_TOKEN
git config user.email [email protected]
git config --global user.name "CircleCI"
git push --set-upstream origin ${CIRCLE_BRANCH}
- run:
name: Bump version
command: |
DATE=$(date -u +%Y.%m.%d_%H%M%S)
bump2version << parameters.bump >> --message "[skip ci] version bump $DATE"
git push --no-verify
git push --no-verify --tags
workflows:
bump_main:
jobs:
- bump_version:
bump: patch
filters:
branches:
only: main
run_ci:
jobs:
- ci_check
bump_patch:
when: << pipeline.parameters.bump_patch >>
jobs:
- bump_version:
bump: patch
filters:
branches:
only: main
bump_minor:
when: << pipeline.parameters.bump_minor >>
jobs:
- bump_version:
bump: minor
filters:
branches:
only: main
Edit: To clarify, I clicked "stop building" in the settings many times, didn't help.