Skip to content

Commit

Permalink
Merge pull request #29 from NVIDIA/ghaction
Browse files Browse the repository at this point in the history
Fix keypath handling
  • Loading branch information
ArangoGutierrez authored Mar 5, 2024
2 parents 13c330c + 89a9662 commit f28386e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions cmd/action/ci/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const (
cacheFile = "/github/workspace/.cache/holodeck.yaml"
kubeconfig = "/github/workspace/kubeconfig"
sshKeyFile = "/github/workspace/.cache/key"
// Default EC2 instance UserName for ubuntu AMI's
username = "ubuntu"
)

func Run(log *logger.FunLogger) error {
Expand Down
7 changes: 3 additions & 4 deletions cmd/action/ci/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func entrypoint(log *logger.FunLogger) error {

// Set auth.PrivateKey
cfg.Spec.Auth.PrivateKey = sshKeyFile
cfg.Spec.Auth.Username = username

// If no containerruntime is specified, default to none
if cfg.Spec.ContainerRuntime.Name == "" {
Expand All @@ -111,21 +112,19 @@ func entrypoint(log *logger.FunLogger) error {
}

var hostUrl string

log.Info("Provisioning \u2699")

for _, p := range cache.Status.Properties {
if p.Name == aws.PublicDnsName {
hostUrl = p.Value
break
}
}

p, err := provisioner.New(log, cfg.Spec.Auth.PrivateKey, cfg.Spec.Auth.Username, hostUrl)
p, err := provisioner.New(log, sshKeyFile, username, hostUrl)
if err != nil {
return err
}

log.Info("Provisioning \u2699")
if err = p.Run(cfg); err != nil {
return fmt.Errorf("failed to run provisioner: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
warningSign = "\u26A0"

// Unicode character for the loading emoji
loadingEmoji = "\u231B"
loadingEmoji = "\U0001f300"
)

// NewLogger creates a new instance of FunLogger.
Expand Down
4 changes: 2 additions & 2 deletions pkg/provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (p *Provisioner) Run(env v1alpha1.Environment) error {
}
// Reset the connection, this step is needed to make sure some configuration changes take effect
// e.g after installing docker, the user needs to be added to the docker group
if err := p.resetConnection(env.Spec.Auth.PrivateKey, p.HostUrl); err != nil {
if err := p.resetConnection(); err != nil {
return fmt.Errorf("failed to reset connection: %v", err)
}
// Clear the template buffer
Expand All @@ -114,7 +114,7 @@ func (p *Provisioner) Run(env v1alpha1.Environment) error {
}

// resetConnection resets the ssh connection, and retries if it fails to connect
func (p *Provisioner) resetConnection(keyPath, hostUrl string) error {
func (p *Provisioner) resetConnection() error {
// Close the current ssh connection
if err := p.Client.Close(); err != nil {
return fmt.Errorf("failed to close ssh client: %v", err)
Expand Down

0 comments on commit f28386e

Please sign in to comment.