From ef2bc101b3663a2b2abaa1a28cd5b8751866c55b Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Arango Gutierrez Date: Thu, 8 Aug 2024 15:56:52 +0200 Subject: [PATCH] Add vSphere inputs Signed-off-by: Carlos Eduardo Arango Gutierrez --- action.yml | 9 +++++++++ cmd/action/ci/ci.go | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/action.yml b/action.yml index 82aaed31..3131b9d8 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,15 @@ inputs: aws_ssh_key: description: 'AWS SSH Key' required: false + vsphere_ssh_key: + description: 'vSphere SSH Key' + required: false + vsphere_username: + description: 'vSphere Username' + required: false + vsphere_password: + description: 'vSphere Password' + required: false holodeck_config: description: 'Holodeck configuration file' required: true diff --git a/cmd/action/ci/ci.go b/cmd/action/ci/ci.go index 4e07fb54..4e19f58b 100644 --- a/cmd/action/ci/ci.go +++ b/cmd/action/ci/ci.go @@ -89,6 +89,31 @@ func readInputs() error { } } + // For vSphere + vsphereSshKey := os.Getenv("INPUT_VSPHERE_SSH_KEY") + if vsphereSshKey != "" { + err := os.Setenv("VSPHERE_SSH_KEY", vsphereSshKey) + if err != nil { + return fmt.Errorf("failed to set VSPHERE_SSH_KEY: %v", err) + } + } + // Map INPUT_VSPHERE_USERNAME and INPUT_VSPHERE_PASSWORD + // to VSPHERE_USERNAME and VSPHERE_PASSWORD + vsphereUsername := os.Getenv("INPUT_VSPHERE_USERNAME") + if vsphereUsername != "" { + err := os.Setenv("VSPHERE_USERNAME", vsphereUsername) + if err != nil { + return fmt.Errorf("failed to set VSPHERE_USERNAME: %v", err) + } + } + vspherePassword := os.Getenv("INPUT_VSPHERE_PASSWORD") + if vspherePassword != "" { + err := os.Setenv("VSPHERE_PASSWORD", vspherePassword) + if err != nil { + return fmt.Errorf("failed to set VSPHERE_PASSWORD: %v", err) + } + } + return nil }