Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 30, 2025

This PR adds support for the SEMAPHORE_BUILD_INFO environment variable to allow downstream Docker images to override the version string displayed in the Semaphore UI without rebuilding the binary.

Problem

When building downstream Docker images based on Semaphore (e.g., FROM semaphoreui/semaphore:v2.14.9), the UI continues to show the original version string like v2.14.9-66611eb-1746447063. Organizations want to display their own version information to users but previously had to rebuild the entire Semaphore binary to achieve this.

Solution

Modified the Version() function in util/version.go to check for the SEMAPHORE_BUILD_INFO environment variable:

  • If set and non-empty, returns the custom version string
  • If not set or empty, falls back to the default {Ver}-{Commit}-{Date} format
  • Works across all contexts: CLI commands, API endpoints, and frontend display

Usage Examples

Docker runtime override:

docker run -e SEMAPHORE_BUILD_INFO="v2.14.9-mycompany-1.0.0" semaphoreui/semaphore:v2.14.9

Dockerfile for downstream builds:

FROM semaphoreui/semaphore:v2.14.9
ENV SEMAPHORE_BUILD_INFO="v2.14.9-downstream-custom"

Testing

  • Added comprehensive unit tests covering all scenarios
  • Created API integration test to verify endpoint behavior
  • Verified CLI semaphore version command works correctly
  • Confirmed frontend displays the first part of custom versions in Docker commands
  • All existing tests continue to pass

Backward Compatibility

The change is fully backward compatible - existing installations continue to work unchanged, and the new feature is only activated when the environment variable is explicitly set.

Fixes #3237.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 30, 2025 14:30
…ion information

Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Feature: Override build info string Add SEMAPHORE_BUILD_INFO environment variable to override version display Aug 30, 2025
@Copilot Copilot AI requested a review from fiftin August 30, 2025 14:34
Copilot finished work on behalf of fiftin August 30, 2025 14:34
@fiftin fiftin marked this pull request as ready for review August 30, 2025 14:59
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.

Feature: Override build info string

2 participants