Add SEMAPHORE_BUILD_INFO environment variable to override version display #3256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likev2.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 inutil/version.go
to check for theSEMAPHORE_BUILD_INFO
environment variable:{Ver}-{Commit}-{Date}
formatUsage 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:
Testing
semaphore version
command works correctlyBackward 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.