Skip to content

Commit

Permalink
Merge pull request #14 from fabi200123/set-version-v0.1.1
Browse files Browse the repository at this point in the history
Update provider to use explicitly version v0.1.0
  • Loading branch information
gabriel-samfira authored Sep 16, 2024
2 parents 619da3b + 82d29c9 commit 34e6940
Show file tree
Hide file tree
Showing 76 changed files with 1,078 additions and 219 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/aws/aws-sdk-go-v2/credentials v1.17.20
github.com/aws/aws-sdk-go-v2/service/ec2 v1.165.0
github.com/aws/smithy-go v1.20.2
github.com/cloudbase/garm-provider-common v0.1.3
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae
github.com/stretchr/testify v1.9.0
github.com/xeipuuv/gojsonschema v1.2.0
)
Expand Down Expand Up @@ -39,8 +39,8 @@ require (
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/sys v0.24.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.29.0 h1:dqW4XRwPE/poWSqVntpeXLHzpPK6
github.com/aws/aws-sdk-go-v2/service/sts v1.29.0/go.mod h1:j8+hrxlmLR8ZQo6ytTAls/JFrt5bVisuS6PD8gw2VBw=
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
github.com/cloudbase/garm-provider-common v0.1.3 h1:8pHSRs2ljwLHgtDrge68dZ7ILUW97VF5h2ZA2fQubGQ=
github.com/cloudbase/garm-provider-common v0.1.3/go.mod h1:VIJzbcg5iwyD4ac99tnnwcActfwibn/VOt2MYOFjf2c=
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae h1:GDcVb/ForsCtpGj2kFH+iPu6/IIj0b5pV/h27qL6+GI=
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae/go.mod h1:sK26i2NpjjAjhanNKiWw8iPkqt+XeohTKpFnEP7JdZ4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -66,11 +66,11 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
Expand Down
16 changes: 1 addition & 15 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,7 @@ var signals = []os.Signal{
syscall.SIGTERM,
}

var (
// Version is the version of the application
Version = "v0.0.0-unknown"
)

func main() {
// This is an unofficial command. It will be added into future versions of the
// external provider interface. For now we manually hardcode it here. This is not
// used by GARM itself. It is informative for the user to be able to check the version
// of the provider.
garmCommand := os.Getenv("GARM_COMMAND")
if garmCommand == "GetVersion" {
fmt.Println(Version)
os.Exit(0)
}

ctx, stop := signal.NotifyContext(context.Background(), signals...)
defer stop()
Expand All @@ -61,7 +47,7 @@ func main() {
os.Exit(1)
}

result, err := execution.Run(ctx, prov, executionEnv)
result, err := executionEnv.Run(ctx, prov)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to run command: %+v\n", err)
os.Exit(1)
Expand Down
8 changes: 7 additions & 1 deletion provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ import (
"github.com/cloudbase/garm-provider-aws/internal/spec"
"github.com/cloudbase/garm-provider-aws/internal/util"
garmErrors "github.com/cloudbase/garm-provider-common/errors"
"github.com/cloudbase/garm-provider-common/execution"
execution "github.com/cloudbase/garm-provider-common/execution/v0.1.0"
"github.com/cloudbase/garm-provider-common/params"
)

var _ execution.ExternalProvider = &AwsProvider{}

var Version = "v0.0.0-unknown"

func NewAwsProvider(ctx context.Context, configPath, controllerID string) (execution.ExternalProvider, error) {
conf, err := config.NewConfig(configPath)
if err != nil {
Expand Down Expand Up @@ -159,3 +161,7 @@ func (a *AwsProvider) Start(ctx context.Context, instance string) error {
}
return a.awsCli.StartInstance(ctx, instance)
}

func (a *AwsProvider) GetVersion(ctx context.Context) string {
return Version
}
6 changes: 3 additions & 3 deletions scripts/build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ cd $GARM_SOURCE
GOOS=linux GOARCH=amd64 go build -mod vendor \
-o $BUILD_DIR/linux/amd64/$GARM_PROVIDER_NAME \
-tags osusergo,netgo,sqlite_omit_load_extension \
-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .
-ldflags "-extldflags '-static' -s -w -X github.com/cloudbase/garm-provider-aws/provider.Version=$VERSION" .
GOOS=linux GOARCH=arm64 CC=aarch64-linux-musl-gcc go build \
-mod vendor \
-o $BUILD_DIR/linux/arm64/$GARM_PROVIDER_NAME \
-tags osusergo,netgo,sqlite_omit_load_extension \
-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .
-ldflags "-extldflags '-static' -s -w -X github.com/cloudbase/garm-provider-aws/provider.Version=$VERSION" .

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

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 34e6940

Please sign in to comment.