Skip to content

Configure bumpver for Concourse release pipeline#5509

Open
blarghmatey wants to merge 6 commits into
masterfrom
configure-bumpver
Open

Configure bumpver for Concourse release pipeline#5509
blarghmatey wants to merge 6 commits into
masterfrom
configure-bumpver

Conversation

@blarghmatey
Copy link
Copy Markdown
Member

What are the relevant tickets?

N/A

Description (What does it do?)

Adds [tool.bumpver] configuration to pyproject.toml so the Concourse
release pipeline can update the application version automatically on each
release.

The new version format is YYYY.MM.DD.N (e.g., 2026.04.16.1), which
replaces the previous semver-style version strings. This is required by the
Concourse release resource workflow being rolled out in
mitodl/ol-infrastructure#4506.

The VERSION constant in Django settings is updated to the initial release
format version as part of this change.

How can this be tested?

  1. With bumpver installed (pip install bumpver), run bumpver update --dry from the repo root and confirm it shows the expected diff with no errors.
  2. Check that VERSION in Django settings matches current_version in pyproject.toml.

Additional Context

Part of the Concourse release pipeline modernization — migrating from the Doof
Slack bot to a Concourse-native release workflow using GitHub Issues as
production gates.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces bumpver for automated version management, updating the version string in micromasters/settings.py and adding the corresponding configuration to pyproject.toml. Feedback indicates that the VERSION constant in settings.py is currently overridden by a local file, which should be removed to ensure the new versioning logic takes effect. Additionally, it is recommended to include pyproject.toml in the bumpver file patterns to maintain version consistency across the project.

Comment thread micromasters/settings.py Outdated
from micromasters.sentry import init_sentry

VERSION = "0.0.0" # Default version
VERSION = "2026.04.16.1" # Default version
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The VERSION constant defined here will be overridden by the logic in lines 19-22 if a VERSION file exists in the root directory. Since the repository currently contains a VERSION file (with value 0.249.0), this update will not take effect at runtime. To ensure bumpver works as intended, you should remove the VERSION file and the code that reads it (lines 19-22), making this line the single source of truth for the application version.

Comment thread pyproject.toml Outdated
push = false

[tool.bumpver.file_patterns]
"micromasters/settings.py" = ['VERSION = "{version}"']
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is good practice to keep the [project].version field in pyproject.toml synchronized with the application version. Consider adding pyproject.toml to the file_patterns. Note that if you add this, you must also manually update the version field at the top of pyproject.toml (line 3) to match the current_version ("2026.04.16.1") in this PR, as bumpver requires the current version string to be present in all configured files to perform an update.

Suggested change
"micromasters/settings.py" = ['VERSION = "{version}"']
"micromasters/settings.py" = ['VERSION = "{version}"']
"pyproject.toml" = ['version = "{version}"']

Comment thread micromasters/settings.py Outdated
from micromasters.sentry import init_sentry

VERSION = "0.0.0" # Default version
VERSION = "2026.04.16.1" # Default version
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The change to a four-part calendar version for VERSION is incompatible with the existing test_semantic_version test, which expects a three-part semantic version, causing a test failure.
Severity: HIGH

Suggested Fix

Update or remove the test_semantic_version test in micromasters/tests/test_settings.py. If validation of the new calendar-based versioning format is required, the test logic should be adapted accordingly and should no longer use the semantic_version library.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: micromasters/settings.py#L18

Potential issue: The PR updates the `VERSION` variable in `settings.py` from a
three-part semantic version (`"0.0.0"`) to a four-part calendar version
(`"2026.04.16.1"`). An existing unit test, `test_semantic_version`, uses the
`semantic_version` library to validate `settings.VERSION`. This library's constructor,
`semantic_version.Version()`, strictly requires a three-part version string and will
raise a `ValueError` when passed the new four-part format. This will cause the test to
fail, which will in turn cause the CI build to fail and block the merge.

Did we get this right? 👍 / 👎 to inform future reviews.

@Anas12091101 Anas12091101 self-assigned this Apr 17, 2026
@Anas12091101
Copy link
Copy Markdown
Contributor

@blarghmatey, could you please update the lock file?

Comment thread pyproject.toml
Comment on lines +83 to +87
[tool.bumpversion]
commit = false
tag = false
parse = "(?P<release>(?:[1-9][0-9]{3})\\.(?:1[0-2]|0[1-9])\\.(?:3[0-1]|[1-2][0-9]|0[1-9]))\\.(?P<build>\\d+)"
serialize = ["{release}.{build}"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The [tool.bumpversion] configuration in pyproject.toml is missing the required current_version key, which will cause the bump-my-version tool to fail during the release process.
Severity: HIGH

Suggested Fix

Add the current_version key to the [tool.bumpversion] section in pyproject.toml. The value should be set to the project's current version, for example: current_version = "0.1.0".

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: pyproject.toml#L83-L87

Potential issue: The `[tool.bumpversion]` configuration in `pyproject.toml` is missing
the required `current_version` key. The `bump-my-version` tool relies on this key to
substitute the `{current_version}` placeholder in its search-and-replace patterns. The
automated release pipeline executes `bumpver update`, which will fail during
configuration parsing or when attempting to evaluate the search patterns, thus breaking
the automated release process this pull request is intended to enable.

Comment thread pyproject.toml Outdated
"micromasters/settings.py" = ['VERSION = "{version}"']
"pyproject.toml" = ['version = "{version}"']
[tool.bumpversion.parts.release]
calver_format = "{YYYY}.{0M}.{0D}"
Copy link
Copy Markdown
Contributor

@Anas12091101 Anas12091101 Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found an issue while testing. uv normalizes version strings per PEP 440, stripping leading zeros from month/day (e.g. 2026.04.16.1 → 2026.4.16.1). This means after any uv lock or uv sync run, the version in uv.lock no longer matches the search pattern in [tool.bumpversion.files], and bump-my-version fails with:

Did not find 'name = "micromasters"
version = "2026.04.16.1"...' in file: 'uv.lock'

We can fix this by changing calver_format from {YYYY}.{0M}.{0D} (zero-padded) to {YYYY}.{MM}.{DD} (non-padded), and updating the parse regex and all version strings accordingly. This makes the format match what UV produces natively, so uv.lock tracking works correctly.

Suggested change
calver_format = "{YYYY}.{0M}.{0D}"
calver_format = "{YYYY}.{MM}.{DD}"

Comment thread pyproject.toml Outdated
commit = false
tag = false
push = false
parse = "(?P<release>(?:[1-9][0-9]{3})\\.(?:1[0-2]|0[1-9])\\.(?:3[0-1]|[1-2][0-9]|0[1-9]))\\.(?P<build>\\d+)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parse = "(?P<release>(?:[1-9][0-9]{3})\\.(?:1[0-2]|0[1-9])\\.(?:3[0-1]|[1-2][0-9]|0[1-9]))\\.(?P<build>\\d+)"
parse = "(?P<release>(?:[1-9][0-9]{3})\\.(?:1[0-2]|[1-9])\\.(?:3[0-1]|[1-2][0-9]|[1-9]))\\.(?P<build>\\d+)"

blarghmatey and others added 6 commits May 6, 2026 12:14
Set VERSION in Django settings to the new YYYY.MM.DD.N format
and add [tool.bumpver] config pointing at the settings file.

The Concourse release pipeline (mitodl/ol-infrastructure#4506) runs
`bumpver update --set-version $VERSION --no-commit --no-fetch` on
each release, so bumpver must be configured before the pipeline
can manage versions automatically.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add pyproject.toml to bumpver file_patterns so the [project] version
field stays in sync with VERSION in Django settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace [tool.bumpver] config with [tool.bumpversion]
- Uses CalVer parse/serialize to preserve zero-padded month/day
- Adds uv.lock to tracked files via multiline search pattern

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update version format from YYYY.0M.0D.N to YYYY.M.D.N to comply with
PEP 440, which prohibits leading zeros in version components. This is
required by uv, which enforces PEP 440 for project version strings.

- bump-my-version calver_format: {0M}.{0D} -> {MM}.{DD}
- parse regex: updated to match 1-2 digit month/day (no zero-prefix)
- Initial version: 2026.04.16.1 -> 2026.4.16.1 in settings.py,
  pyproject.toml, and uv.lock

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@Anas12091101 Anas12091101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Anas12091101 Anas12091101 removed their assignment May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants