Skip to content
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

Update provider to use explicitly version v0.1.0 #10

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

fabi200123
Copy link
Contributor

  • Update the provider to use version v0.1.0 explicitly

provider/lxd.go Outdated
@@ -26,6 +26,8 @@ import (

var _ execution.ExternalProvider = &LXD{}

var version = "v0.1.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the interface version. This is the provider version.... The GetVersion() command gets the provider version. Not the interface version.

This needs to be 0.0.0-unknown by default. This will then be set by:

-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .

which also needs to be updated to no longer try to set the Version in main.go.

Also, this variable must be exported.

provider/lxd.go Outdated

// GetVersion returns the interface version of the provider.
func (l *LXD) GetVersion(ctx context.Context) string {
fmt.Println(version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel right. We either return a string or just print it, but not both. This function gets called in garm-provider-common here:

https://github.com/cloudbase/garm-provider-common/blob/899c120c80ce01a42e94cc2319e1e1df6407e4ff/execution/v0.1.0/execution.go#L159-L161

Which in turn gets used by the provider here:

result, err := execution.Run(ctx, prov, executionEnv)

the result of which is printed here:

if len(result) > 0 {
fmt.Fprint(os.Stdout, result)
}

if you test these changes with:

GARM_COMMAND="GetVersion" ./garm-provider-lxd

you will most likely get the version printed twice.

@gabriel-samfira gabriel-samfira merged commit 1130dc9 into cloudbase:main Sep 13, 2024
2 checks passed
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