Skip to content

Commit

Permalink
Merge pull request #132 from NVIDIA/main
Browse files Browse the repository at this point in the history
[Release-02]Fix handling of cfg var
  • Loading branch information
ArangoGutierrez authored Aug 1, 2024
2 parents 684dee2 + 9fb1a8f commit 4bff1d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/action/ci/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func cleanup(log *logger.FunLogger) error {
os.Exit(1)
}

provider, err := newProvider(log, cfg)
provider, err := newProvider(log, &cfg)
if err != nil {
return fmt.Errorf("failed to create provider: %v", err)
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/action/ci/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func entrypoint(log *logger.FunLogger) error {
cfg.Spec.ContainerRuntime.Name = v1alpha1.ContainerRuntimeNone
}

// Set default values for the environment
setCfgName(&cfg)

// Read Inputs
// INPUT_* vars are optional since v0.2 of the action
// Users can set the variables on self hosted runners.
Expand Down Expand Up @@ -77,7 +80,7 @@ func entrypoint(log *logger.FunLogger) error {
}
}

provider, err := newProvider(log, cfg)
provider, err := newProvider(log, &cfg)
if err != nil {
return fmt.Errorf("failed to create provider: %v", err)
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/action/ci/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/NVIDIA/holodeck/pkg/provider/vsphere"
)

func newProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (provider.Provider, error) {
func newProvider(log *logger.FunLogger, cfg *v1alpha1.Environment) (provider.Provider, error) {
var provider provider.Provider
var err error

Expand All @@ -49,7 +49,7 @@ func newProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (provider.Prov
return provider, nil
}

func newAwsProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (*aws.Provider, error) {
func newAwsProvider(log *logger.FunLogger, cfg *v1alpha1.Environment) (*aws.Provider, error) {
// Create cachedir directory
if _, err := os.Stat(cachedir); os.IsNotExist(err) {
err := os.Mkdir(cachedir, 0755)
Expand Down Expand Up @@ -77,17 +77,17 @@ func newAwsProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (*aws.Provi
cfg.Spec.Auth.Username = "ubuntu"

// Set env name
setCfgName(&cfg)
setCfgName(cfg)

a, err := aws.New(log, cfg, cacheFile)
a, err := aws.New(log, *cfg, cacheFile)
if err != nil {
return nil, err
}

return a, nil
}

func newVsphereProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (*vsphere.Provider, error) {
func newVsphereProvider(log *logger.FunLogger, cfg *v1alpha1.Environment) (*vsphere.Provider, error) {
// Create cachedir directory
if _, err := os.Stat(cachedir); os.IsNotExist(err) {
err := os.Mkdir(cachedir, 0755)
Expand Down Expand Up @@ -115,9 +115,9 @@ func newVsphereProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (*vsphe
cfg.Spec.Auth.Username = "nvidia"

// Set env name
setCfgName(&cfg)
setCfgName(cfg)

v, err := vsphere.New(log, cfg, cacheFile)
v, err := vsphere.New(log, *cfg, cacheFile)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 4bff1d0

Please sign in to comment.