Skip to content

Commit

Permalink
Merge pull request #7 from fabi200123/set-version-v0.1.0
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 14, 2024
2 parents cc08bca + 82a1a0d commit da8e2df
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 @@ -6,7 +6,7 @@ toolchain go1.22.3

require (
github.com/BurntSushi/toml v1.3.2
github.com/cloudbase/garm-provider-common v0.1.3
github.com/cloudbase/garm-provider-common v0.1.4-0.20240906095211-57315d4ac8ae
github.com/oracle/oci-go-sdk/v49 v49.2.0
github.com/stretchr/testify v1.9.0
github.com/xeipuuv/gojsonschema v1.2.0
Expand All @@ -26,8 +26,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
@@ -1,7 +1,7 @@
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
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 @@ -40,11 +40,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 @@ -31,21 +31,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 @@ -62,7 +48,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 @@ -19,7 +19,7 @@ import (
"context"
"fmt"

"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"
"github.com/cloudbase/garm-provider-oci/config"
"github.com/cloudbase/garm-provider-oci/internal/client"
Expand All @@ -29,6 +29,8 @@ import (

var _ execution.ExternalProvider = &OciProvider{}

var Version = "v0.0.0-unknown"

func NewOciProvider(ctx context.Context, cfgFile string, controllerID string) (*OciProvider, error) {
conf, err := config.NewConfig(cfgFile)
if err != nil {
Expand Down Expand Up @@ -105,3 +107,7 @@ func (o *OciProvider) Stop(ctx context.Context, instance string, force bool) err
func (o *OciProvider) Start(ctx context.Context, instance string) error {
return o.ociCli.StartInstance(ctx, instance)
}

func (o *OciProvider) 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-oci/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-oci/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-oci/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 da8e2df

Please sign in to comment.