diff --git a/cmd/action/ci/ci.go b/cmd/action/ci/ci.go index 027657ae..f56bb411 100644 --- a/cmd/action/ci/ci.go +++ b/cmd/action/ci/ci.go @@ -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 { diff --git a/cmd/action/ci/entrypoint.go b/cmd/action/ci/entrypoint.go index dc025ac9..612f1c4e 100644 --- a/cmd/action/ci/entrypoint.go +++ b/cmd/action/ci/entrypoint.go @@ -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 == "" { @@ -111,9 +112,6 @@ 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 @@ -121,11 +119,12 @@ func entrypoint(log *logger.FunLogger) error { } } - 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) } diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 8d9d11ae..609f4ba1 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -56,7 +56,7 @@ const ( warningSign = "\u26A0" // Unicode character for the loading emoji - loadingEmoji = "\u231B" + loadingEmoji = "\U0001f300" ) // NewLogger creates a new instance of FunLogger. diff --git a/pkg/provisioner/provisioner.go b/pkg/provisioner/provisioner.go index 5c18b514..f134e0a5 100644 --- a/pkg/provisioner/provisioner.go +++ b/pkg/provisioner/provisioner.go @@ -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 @@ -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)