Skip to content

Conversation

@martincostello
Copy link
Member

  • Compute the next release version based on changes to components that are installed in the container. If any installed component has a major or minor bump, we roll the version to the x.{y+1}.0 - otherwise we use x.y.{z+1} (i.e. never automatically release a new major version).
  • Create a workflow that would automatically create a new release every Friday at 0900 UTC (or if run manually, principally for test purposes).

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:false and enable the schedule. Then in theory, a release should be automatically created on the schedule we decide to use.

Contributes to #846.

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.
Copilot AI review requested due to automatic review settings December 2, 2025 16:59
Use `gh` to get the latest release.
Quote string to resolve SC2086 warning.
Copy link
Contributor

Copilot AI left a 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.
Copy link
Member

@zeitlinger zeitlinger left a 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
Copy link
Member

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?

Copy link
Member Author

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 lines

Which 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.0

I'll refactor slightly so that the increment can be easily tested separately.

Copy link
Member Author

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.0

Move the version diff to a function so it can be more easily tested.
Copilot AI review requested due to automatic review settings December 3, 2025 12:06
Copy link
Contributor

Copilot AI left a 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.
@martincostello martincostello merged commit 2d1b793 into main Dec 4, 2025
44 checks passed
@martincostello martincostello deleted the compute-next-version branch December 4, 2025 13:33
@martincostello
Copy link
Member Author

martincostello commented Dec 4, 2025

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.

Looks like it worked as expected:

  1. Manually ran Scheduled Release
  2. Publish Release was run
  3. Draft for v0.11.19 was created

If that works, I'll do a follow-up PR to set draft:false and enable the schedule.

Will do this now.

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.

2 participants