Configure bumpver for Concourse release pipeline#5509
Conversation
There was a problem hiding this comment.
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.
| from micromasters.sentry import init_sentry | ||
|
|
||
| VERSION = "0.0.0" # Default version | ||
| VERSION = "2026.04.16.1" # Default version |
There was a problem hiding this comment.
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.
| push = false | ||
|
|
||
| [tool.bumpver.file_patterns] | ||
| "micromasters/settings.py" = ['VERSION = "{version}"'] |
There was a problem hiding this comment.
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.
| "micromasters/settings.py" = ['VERSION = "{version}"'] | |
| "micromasters/settings.py" = ['VERSION = "{version}"'] | |
| "pyproject.toml" = ['version = "{version}"'] |
| from micromasters.sentry import init_sentry | ||
|
|
||
| VERSION = "0.0.0" # Default version | ||
| VERSION = "2026.04.16.1" # Default version |
There was a problem hiding this comment.
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.
|
@blarghmatey, could you please update the lock file? |
| [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}"] |
There was a problem hiding this comment.
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.
| "micromasters/settings.py" = ['VERSION = "{version}"'] | ||
| "pyproject.toml" = ['version = "{version}"'] | ||
| [tool.bumpversion.parts.release] | ||
| calver_format = "{YYYY}.{0M}.{0D}" |
There was a problem hiding this comment.
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.
| calver_format = "{YYYY}.{0M}.{0D}" | |
| calver_format = "{YYYY}.{MM}.{DD}" |
| 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+)" |
There was a problem hiding this comment.
| 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+)" |
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>
89e280d to
10c0674
Compare
What are the relevant tickets?
N/A
Description (What does it do?)
Adds
[tool.bumpver]configuration topyproject.tomlso the Concourserelease 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), whichreplaces the previous semver-style version strings. This is required by the
Concourse
releaseresource workflow being rolled out inmitodl/ol-infrastructure#4506.
The
VERSIONconstant in Django settings is updated to the initial releaseformat version as part of this change.
How can this be tested?
bumpverinstalled (pip install bumpver), runbumpver update --dryfrom the repo root and confirm it shows the expected diff with no errors.VERSIONin Django settings matchescurrent_versioninpyproject.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.