Skip to content

Commit 34e6940

Browse files
Merge pull request #14 from fabi200123/set-version-v0.1.1
Update provider to use explicitly version v0.1.0
2 parents 619da3b + 82d29c9 commit 34e6940

File tree

76 files changed

+1078
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1078
-219
lines changed

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/aws/aws-sdk-go-v2/credentials v1.17.20
1212
github.com/aws/aws-sdk-go-v2/service/ec2 v1.165.0
1313
github.com/aws/smithy-go v1.20.2
14-
github.com/cloudbase/garm-provider-common v0.1.3
14+
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae
1515
github.com/stretchr/testify v1.9.0
1616
github.com/xeipuuv/gojsonschema v1.2.0
1717
)
@@ -39,8 +39,8 @@ require (
3939
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
4040
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
4141
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
42-
golang.org/x/crypto v0.25.0 // indirect
43-
golang.org/x/sys v0.22.0 // indirect
42+
golang.org/x/crypto v0.26.0 // indirect
43+
golang.org/x/sys v0.24.0 // indirect
4444
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
4545
gopkg.in/yaml.v3 v3.0.1 // indirect
4646
)

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.29.0 h1:dqW4XRwPE/poWSqVntpeXLHzpPK6
2828
github.com/aws/aws-sdk-go-v2/service/sts v1.29.0/go.mod h1:j8+hrxlmLR8ZQo6ytTAls/JFrt5bVisuS6PD8gw2VBw=
2929
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
3030
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
31-
github.com/cloudbase/garm-provider-common v0.1.3 h1:8pHSRs2ljwLHgtDrge68dZ7ILUW97VF5h2ZA2fQubGQ=
32-
github.com/cloudbase/garm-provider-common v0.1.3/go.mod h1:VIJzbcg5iwyD4ac99tnnwcActfwibn/VOt2MYOFjf2c=
31+
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae h1:GDcVb/ForsCtpGj2kFH+iPu6/IIj0b5pV/h27qL6+GI=
32+
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae/go.mod h1:sK26i2NpjjAjhanNKiWw8iPkqt+XeohTKpFnEP7JdZ4=
3333
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3434
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3535
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -66,11 +66,11 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
6666
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
6767
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
6868
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
69-
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
70-
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
69+
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
70+
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
7171
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
72-
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
73-
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
72+
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
73+
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
7474
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
7575
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7676
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=

main.go

+1-15
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,7 @@ var signals = []os.Signal{
3030
syscall.SIGTERM,
3131
}
3232

33-
var (
34-
// Version is the version of the application
35-
Version = "v0.0.0-unknown"
36-
)
37-
3833
func main() {
39-
// This is an unofficial command. It will be added into future versions of the
40-
// external provider interface. For now we manually hardcode it here. This is not
41-
// used by GARM itself. It is informative for the user to be able to check the version
42-
// of the provider.
43-
garmCommand := os.Getenv("GARM_COMMAND")
44-
if garmCommand == "GetVersion" {
45-
fmt.Println(Version)
46-
os.Exit(0)
47-
}
4834

4935
ctx, stop := signal.NotifyContext(context.Background(), signals...)
5036
defer stop()
@@ -61,7 +47,7 @@ func main() {
6147
os.Exit(1)
6248
}
6349

64-
result, err := execution.Run(ctx, prov, executionEnv)
50+
result, err := executionEnv.Run(ctx, prov)
6551
if err != nil {
6652
fmt.Fprintf(os.Stderr, "failed to run command: %+v\n", err)
6753
os.Exit(1)

provider/provider.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ import (
2727
"github.com/cloudbase/garm-provider-aws/internal/spec"
2828
"github.com/cloudbase/garm-provider-aws/internal/util"
2929
garmErrors "github.com/cloudbase/garm-provider-common/errors"
30-
"github.com/cloudbase/garm-provider-common/execution"
30+
execution "github.com/cloudbase/garm-provider-common/execution/v0.1.0"
3131
"github.com/cloudbase/garm-provider-common/params"
3232
)
3333

3434
var _ execution.ExternalProvider = &AwsProvider{}
3535

36+
var Version = "v0.0.0-unknown"
37+
3638
func NewAwsProvider(ctx context.Context, configPath, controllerID string) (execution.ExternalProvider, error) {
3739
conf, err := config.NewConfig(configPath)
3840
if err != nil {
@@ -159,3 +161,7 @@ func (a *AwsProvider) Start(ctx context.Context, instance string) error {
159161
}
160162
return a.awsCli.StartInstance(ctx, instance)
161163
}
164+
165+
func (a *AwsProvider) GetVersion(ctx context.Context) string {
166+
return Version
167+
}

scripts/build-static.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ cd $GARM_SOURCE
3131
GOOS=linux GOARCH=amd64 go build -mod vendor \
3232
-o $BUILD_DIR/linux/amd64/$GARM_PROVIDER_NAME \
3333
-tags osusergo,netgo,sqlite_omit_load_extension \
34-
-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .
34+
-ldflags "-extldflags '-static' -s -w -X github.com/cloudbase/garm-provider-aws/provider.Version=$VERSION" .
3535
GOOS=linux GOARCH=arm64 CC=aarch64-linux-musl-gcc go build \
3636
-mod vendor \
3737
-o $BUILD_DIR/linux/arm64/$GARM_PROVIDER_NAME \
3838
-tags osusergo,netgo,sqlite_omit_load_extension \
39-
-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .
39+
-ldflags "-extldflags '-static' -s -w -X github.com/cloudbase/garm-provider-aws/provider.Version=$VERSION" .
4040

4141
# Windows
4242
GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-cc go build -mod vendor \
4343
-o $BUILD_DIR/windows/amd64/$GARM_PROVIDER_NAME.exe \
4444
-tags osusergo,netgo,sqlite_omit_load_extension \
45-
-ldflags "-s -w -X main.Version=$VERSION" .
45+
-ldflags "-s -w -X github.com/cloudbase/garm-provider-aws/provider.Version=$VERSION" .
4646

4747
git checkout $CURRENT_BRANCH || true
4848
chown $USER_ID:$USER_GROUP -R "$OUTPUT_DIR"

vendor/github.com/cloudbase/garm-provider-common/execution/common/commands.go

+99
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/cloudbase/garm-provider-common/execution/interface.go vendor/github.com/cloudbase/garm-provider-common/execution/common/interface.go

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/cloudbase/garm-provider-common/execution/commands.go vendor/github.com/cloudbase/garm-provider-common/execution/common/versions.go

+5-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)