-
Notifications
You must be signed in to change notification settings - Fork 164
Compute next version and add scheduled release #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Compute the next release version based on changes to components that are installed in the container.
Create a workflow that would automatically create a new release every Friday at 0900 UTC.
Default to creating a draft.
Use `gh` to get the latest release.
Quote string to resolve SC2086 warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces automated release capabilities by computing the next version based on component changes and creating a scheduled workflow to trigger releases. The implementation detects changes in the docker/ directory and automatically determines whether to bump minor or patch versions based on component version changes (never automatically releasing a major version).
Key Changes
- Automated version computation logic that inspects Docker image environment variables to compare component versions between releases
- Scheduled workflow (currently disabled) to automatically trigger releases every Friday at 0900 UTC if changes are detected
- Version bumping strategy: minor version bump for major/minor component changes, patch version bump otherwise
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
.github/workflows/scheduled-release.yml |
New workflow that checks for changes in docker/ directory since last release and triggers the publish-release workflow if changes are found |
.github/workflows/publish-release.yml |
Enhanced with PowerShell functions to automatically compute next version by comparing component versions between the latest released image and main branch image |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Treat added or removed components as a major change. - Pull docker images before inspecting. - Fix incorrect workflow permission. - Simplify `gh` syntax for workflow dispatch.
zeitlinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea to use the minor version for something useful!
| $headers = @{ | ||
| Authorization = "Bearer ${env:GH_TOKEN}"; | ||
| Accept = "application/vnd.github+json"; | ||
| # Get the component versions from the container image environment variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is quite involved - would it make sense to extract it to a script that can be tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered adding it to a script, but then the only difference is that the repo now needs to be cloned to get it.
In terms of testability, you can just copy the script into a pwsh terminal and run it directly after setting a few env vars (which is how I tested it before opening the PR):
# <paste script excluding final two linesWhich outputs the following for different input combinations:
> ${env:NEXT_VERSION}=""
> ${env:GITHUB_REPOSITORY}="grafana/docker-otel-lgtm"
> Get-Next-LGTM-Version ${env:NEXT_VERSION}
0.11.19
> ${env:NEXT_VERSION}="0.12.0"
> Get-Next-LGTM-Version ${env:NEXT_VERSION}
0.12.0
> ${env:NEXT_VERSION}="v0.12.0"
> Get-Next-LGTM-Version ${env:NEXT_VERSION}
0.12.0
> Get-Component-Versions "ghcr.io/grafana/docker-otel-lgtm:main"
Name Value
---- -----
GRAFANA 12.3.0
LOKI 3.6.2
OPENTELEMETRY_COLLECTOR 0.139.0
PROMETHEUS 3.7.3
PYROSCOPE 1.16.0
TEMPO 2.9.0
> Get-Component-Versions "grafana/otel-lgtm:latest"
Name Value
---- -----
GRAFANA 12.3.0
LOKI 3.6.1
OPENTELEMETRY_COLLECTOR 0.139.0
PROMETHEUS 3.7.3
PYROSCOPE 1.16.0
TEMPO 2.9.0
> Get-Component-Versions "grafana/otel-lgtm:0.11.16"
Name Value
---- -----
GRAFANA 12.2.1
LOKI 3.5.7
OPENTELEMETRY_COLLECTOR 0.139.0
PROMETHEUS 3.7.3
PYROSCOPE 1.15.0
TEMPO 2.9.0I'll refactor slightly so that the increment can be easily tested separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the latest refactor and we pretend that the last release was 0.11.10:
> ${env:NEXT_VERSION}=""
> $currentVersion = [System.Version]::new("0.11.10")
> $next = Get-Component-Versions "ghcr.io/grafana/docker-otel-lgtm:main"
> $current = Get-Component-Versions "grafana/otel-lgtm:0.11.10"
> Get-Next-Version $currentVersion $current $next
0.12.0Move the version diff to a function so it can be more easily tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix incorrect code to detect added components.
Looks like it worked as expected:
Will do this now. |
x.{y+1}.0- otherwise we usex.y.{z+1}(i.e. never automatically release a new major version).The idea is to merge this without the schedule and then me manually run it see if it correctly detects the changes since the last release in
docker/and queues the release workflow to create a draft.If that works, I'll do a follow-up PR to set
draft:falseand enable the schedule. Then in theory, a release should be automatically created on the schedule we decide to use.Contributes to #846.