Skip to content

Clean up workflows and packaging#139

Open
nevoodoo wants to merge 8 commits intomainfrom
cleanup-cpg-flow
Open

Clean up workflows and packaging#139
nevoodoo wants to merge 8 commits intomainfrom
cleanup-cpg-flow

Conversation

@nevoodoo
Copy link
Contributor

@nevoodoo nevoodoo commented Nov 25, 2025

Motivation

Our packaging, versioning, and dependency upgrade workflows were fragile and hard to maintain. We relied on python-semantic-release which added complexity without clear benefit for our release cadence, Renovate for dependency updates which required a separate hosted workflow, and had hardcoded version strings scattered across multiple files.

Approach

Version management: uv version over external tools

Rather than replacing python-semantic-release with another third-party tool (bump-my-version was considered initially), we use uv version --bump which is built into our existing toolchain. The version source of truth is now a static field in pyproject.toml — no more dynamic = ["version"] indirection through __init__.py. The Makefile targets (make bump-major/minor/patch) handle the bump + commit in one step, producing bump: x.y.z commit messages that the release workflow keys off.

Dependency updates: Dependabot over Renovate

Switched from Renovate (which needed a separate workflow + config) to Dependabot, which is native to GitHub. We use only the uv ecosystem (not pip) since Dependabot's uv support handles both pyproject.toml and uv.lock. Added github-actions ecosystem to keep our action pins current. The original config used multi-ecosystem-groups which isn't a valid Dependabot feature — replaced with proper groups syntax.

Workflow security fixes

The release workflow had several issues flagged by GitHub Advanced Security: commit message content was interpolated directly into shell commands (injection risk), persist-credentials wasn't disabled, and step outputs were used unsafely. Fixed by reading the version from pyproject.toml via uv version --short instead of parsing commit messages, and using environment variables consistently.

Dynamic version in workflows

Hardcoded VERSION env vars in docker.yaml and test.yaml were a maintenance burden — every bump required touching multiple files. These now extract the version dynamically from pyproject.toml at workflow runtime.

Dependabot release age checker

Added a lightweight workflow that comments on Dependabot PRs with how old each proposed package version is. This helps reviewers assess whether a dependency update is battle-tested or brand new. Uses only stdlib Python (no external dependencies).

SonarQube comment auth

Switched from BOT_ACCESS_TOKEN to GITHUB_TOKEN for posting SonarQube PR comments, since the bot token had expired. Added pull-requests: write permission to the sonarqube job to support this.

Our packaging and upgrades were messy and very difficult to maintain
and this switch moves to a standard bump version process that we have
more control over.
@cpg-software-ci-bot
Copy link
Contributor

cpg-software-ci-bot commented Nov 25, 2025

📊 SonarQube Summary

Metric This PR Main Branch
✅ Coverage 76.3% 76.3%
💨 Code Smells 47 47
🐞 Bugs 0 0
🔐 Vulnerabilities 0 0
🚨 Security Hotspots 1 0
📝 New Issues 0 0
🌟 Quality Gate ✅ OK ✅ OK

🔗 View Main Branch Report
🔗 View PR Report

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

🐳 Docker Image Built

A new Docker image has been built for this PR:

Image: australia-southeast1-docker.pkg.dev/cpg-common/images-dev/cpg_flow:e84116466ecc390211437c5f1ca53f7dd1b47356

Pull command:

docker pull australia-southeast1-docker.pkg.dev/cpg-common/images-dev/cpg_flow:e84116466ecc390211437c5f1ca53f7dd1b47356

🔗 View in Google Cloud Console


This comment was automatically generated by the Docker workflow.

The docs builds had some duplication across workflows and caused issues in packaging.
This change condenses the workflows.
@nevoodoo nevoodoo marked this pull request as ready for review November 30, 2025 23:11
@nevoodoo nevoodoo requested a review from a team as a code owner November 30, 2025 23:11
@nevoodoo
Copy link
Contributor Author

nevoodoo commented Jan 5, 2026

We should just use the standard uv version --bump for bumping our packages instead of adding a dependency on other tools like bump-my-version.

# Conflicts:
#	.github/renovate-config.json
#	uv.lock
- Switch from bump-my-version to uv version --bump for version management
- Move version from dynamic (__init__.py) to static in pyproject.toml
- Read __version__ via importlib.metadata at runtime
- Fix all GitHub Advanced Security issues in package.yaml:
  persist-credentials: false, read version from pyproject.toml
  instead of parsing commit messages
- Remove hardcoded VERSION env vars from docker.yaml and test.yaml,
  extract dynamically via uv version --short
- Fix dependabot.yml: replace invalid multi-ecosystem-groups with
  proper groups syntax, use uv ecosystem only, add github-actions
- Add dependabot release age check script and workflow
- Remove .bumpversion.toml and Dockerfile version marker
- Sync with main (v1.3.1)
Copy link
Contributor

@rameshka rameshka left a comment

Choose a reason for hiding this comment

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

@nevoodoo, thanks for working on this, and the new changes are looking good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants