Skip to content

Conversation

@GuruOrGoru
Copy link

@GuruOrGoru GuruOrGoru commented Oct 10, 2025

What this PR does

This PR fixes an issue where piped plugins were showing "unspecified" for version, git commit, and build date information when running the version command.

Problem

Currently, when downloading and running a plugin binary, the version command shows:

$ curl -Lo wait_plugin https://github.com/pipe-cd/pipecd/releases/download/pkg%2Fapp%2Fpipedv1%2Fplugin%2Fwait%2Fv0.1.1/wait_v0.1.1_darwin_arm64
$ ./wait_plugin version
Version: unspecified, GitCommit: unspecified, BuildDate: unspecified

This happened because the plugin build process in the Makefile was not setting the necessary ldflags to inject version information during compilation.

Solution

Modified the build/plugin target in the Makefile to include version ldflags similar to how the main build/go target works. The changes add:

-> BUILD_VERSION, BUILD_COMMIT, BUILD_DATE variables

-> BUILD_LDFLAGS_PREFIX for the version package

-> Updated BUILD_OPTS to include ldflags that inject version information

After the fix

Now plugin binaries will correctly display version information:

$ ./wait_plugin version
Version: v0.1.1, GitCommit: abc123def456, BuildDate: 20231010-123456

Testing

-> Built the wait plugin locally and verified the version command now shows proper information.

-> The fix maintains consistency with how main PipeCD binaries are built.

Related Issues

Fixes #6306

Changes Made

  • Makefile: Added version ldflags to the build/plugin target to inject version, git commit, and build date information during plugin compilation.

Note: Existing plugin binaries remain unaffected; only new builds include version info.

@GuruOrGoru GuruOrGoru requested a review from a team as a code owner October 10, 2025 08:07
Add version ldflags to plugin build process to inject version, git commit,
and build date information during compilation. This fixes the issue where
plugin binaries showed 'unspecified' for all version fields.

The build/plugin target now includes the same version ldflags as the
build/go target, ensuring consistency across all PipeCD binaries.

Fixes pipe-cd#6305

Signed-off-by: GuruOrGoru <siddharthadhakall3722@gmail.com>
@GuruOrGoru GuruOrGoru force-pushed the fix/plugin-version-display branch from 4ca8559 to 8a3c2fc Compare October 10, 2025 08:13
Update the plugin_release workflow to pass BUILD_VERSION, BUILD_COMMIT, and BUILD_DATE
to the make build/plugin command for all platforms. This ensures that plugins built
in CI also display correct version information instead of 'unspecified'.

The Makefile already supports overriding these variables with ?= syntax, so both
local and CI builds now work consistently.

Signed-off-by: GuruOrGoru <siddharthadhakall3722@gmail.com>
@GuruOrGoru
Copy link
Author

I noticed this PR is almost identical to #6307. I’m happy to close mine if you prefer, or collaborate on a single PR.

@khanhtc1202
Copy link
Member

Thanks @GuruOrGoru , let's keep #6307 since it came first. Thank you!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure version of plugins binary showing correctly

2 participants