Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ runs:
inputs:
aws_access_key_id:
description: 'AWS Access Key ID'
required: true
required: false
aws_secret_access_key:
description: 'AWS Secret Access Key'
required: true
required: false
aws_ssh_key:
description: 'AWS SSH Key'
required: false
Expand Down
29 changes: 29 additions & 0 deletions cmd/action/ci/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ func newAwsProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (*aws.Provi
}
}

// Get AWS_SSH_KEY and write it to a file
sshKey := os.Getenv("AWS_SSH_KEY")
if sshKey == "" {
log.Error(fmt.Errorf("ssh key not provided"))
os.Exit(1)
}

err := os.WriteFile(sshKeyFile, []byte(sshKey), 0600)
if err != nil {
log.Error(fmt.Errorf("error writing ssh key to file: %s", err))
os.Exit(1)
}

// Set auth.PrivateKey
cfg.Spec.Auth.PrivateKey = sshKeyFile
cfg.Spec.Auth.Username = username
Expand All @@ -84,6 +97,22 @@ func newVsphereProvider(log *logger.FunLogger, cfg v1alpha1.Environment) (*vsphe
}
}

// Get VSPHERE_SSH_KEY and write it to a file
sshKey := os.Getenv("VSPHERE_SSH_KEY")
if sshKey == "" {
log.Error(fmt.Errorf("ssh key not provided"))
os.Exit(1)
}

err := os.WriteFile(sshKeyFile, []byte(sshKey), 0600)
if err != nil {
log.Error(fmt.Errorf("error writing ssh key to file: %s", err))
os.Exit(1)
}

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

// Set env name
setCfgName(&cfg)

Expand Down