1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

fix: npmExecuteTests vault variables confusing names (#5297)

This commit is contained in:
phgermanov
2025-03-10 12:00:38 +02:00
committed by GitHub
parent b5e18ffdff
commit 08edb989a5
4 changed files with 20 additions and 20 deletions

View File

@@ -48,7 +48,7 @@ func runNpmExecuteTests(config *npmExecuteTestsOptions, c command.ExecRunner) er
return fmt.Errorf("failed to execute install command: %w", err)
}
parsedURLs, err := parseURLs(config.VaultURLs)
parsedURLs, err := parseURLs(config.URLs)
if err != nil {
return err
}
@@ -59,7 +59,7 @@ func runNpmExecuteTests(config *npmExecuteTestsOptions, c command.ExecRunner) er
}
}
if err := runTestForUrl(config.BaseURL, config.VaultUsername, config.VaultPassword, config, c); err != nil {
if err := runTestForUrl(config.BaseURL, config.Username, config.Password, config, c); err != nil {
return err
}
return nil

View File

@@ -23,9 +23,9 @@ import (
type npmExecuteTestsOptions struct {
InstallCommand string `json:"installCommand,omitempty"`
RunCommand string `json:"runCommand,omitempty"`
VaultURLs []map[string]interface{} `json:"vaultURLs,omitempty"`
VaultUsername string `json:"vaultUsername,omitempty"`
VaultPassword string `json:"vaultPassword,omitempty"`
URLs []map[string]interface{} `json:"URLs,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
BaseURL string `json:"baseUrl,omitempty"`
UsernameEnvVar string `json:"usernameEnvVar,omitempty"`
PasswordEnvVar string `json:"passwordEnvVar,omitempty"`
@@ -200,8 +200,8 @@ func addNpmExecuteTestsFlags(cmd *cobra.Command, stepConfig *npmExecuteTestsOpti
cmd.Flags().StringVar(&stepConfig.InstallCommand, "installCommand", `npm ci`, "Command to be executed for installation`.")
cmd.Flags().StringVar(&stepConfig.RunCommand, "runCommand", `npm run wdi5`, "Command to be executed for running tests`.")
cmd.Flags().StringVar(&stepConfig.VaultUsername, "vaultUsername", os.Getenv("PIPER_vaultUsername"), "The base URL username.")
cmd.Flags().StringVar(&stepConfig.VaultPassword, "vaultPassword", os.Getenv("PIPER_vaultPassword"), "The base URL password.")
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "The base URL username used to authenticate")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "The base URL password used to authenticate")
cmd.Flags().StringVar(&stepConfig.BaseURL, "baseUrl", `http://localhost:8080/index.html`, "Base URL of the application to be tested.")
cmd.Flags().StringVar(&stepConfig.UsernameEnvVar, "usernameEnvVar", `wdi5_username`, "Env var for username.")
cmd.Flags().StringVar(&stepConfig.PasswordEnvVar, "passwordEnvVar", `wdi5_password`, "Env var for password.")
@@ -243,7 +243,7 @@ func npmExecuteTestsMetadata() config.StepData {
Default: `npm run wdi5`,
},
{
Name: "vaultURLs",
Name: "URLs",
ResourceRef: []config.ResourceReference{
{
Name: "appMetadataVaultSecretName",
@@ -257,7 +257,7 @@ func npmExecuteTestsMetadata() config.StepData {
Aliases: []config.Alias{},
},
{
Name: "vaultUsername",
Name: "username",
ResourceRef: []config.ResourceReference{
{
Name: "appMetadataVaultSecretName",
@@ -269,10 +269,10 @@ func npmExecuteTestsMetadata() config.StepData {
Type: "string",
Mandatory: false,
Aliases: []config.Alias{},
Default: os.Getenv("PIPER_vaultUsername"),
Default: os.Getenv("PIPER_username"),
},
{
Name: "vaultPassword",
Name: "password",
ResourceRef: []config.ResourceReference{
{
Name: "appMetadataVaultSecretName",
@@ -284,7 +284,7 @@ func npmExecuteTestsMetadata() config.StepData {
Type: "string",
Mandatory: false,
Aliases: []config.Alias{},
Default: os.Getenv("PIPER_vaultPassword"),
Default: os.Getenv("PIPER_password"),
},
{
Name: "baseUrl",

View File

@@ -46,7 +46,7 @@ and Vault configuration in PIPELINE-GROUP-<id>/PIPELINE-<id>/appMetadata
```json
{
"vaultURLs": [
"URLs": [
{
"url": "http://one.example.com/index.html",
"username": "some-username1",
@@ -58,8 +58,8 @@ and Vault configuration in PIPELINE-GROUP-<id>/PIPELINE-<id>/appMetadata
"password": "some-password2"
}
],
"vaultUsername": "base-url-username",
"vaultPassword": "base-url-password"
"username": "base-url-username",
"password": "base-url-password"
}
```

View File

@@ -30,7 +30,7 @@ spec:
- STEPS
mandatory: true
default: "npm run wdi5"
- name: vaultURLs
- name: URLs
type: "[]map[string]interface{}"
description: |
An array of objects, each representing an application URL with associated credentials.
@@ -46,9 +46,9 @@ spec:
- type: vaultSecret
default: appMetadata
name: appMetadataVaultSecretName
- name: vaultUsername
- name: username
type: "string"
description: The base URL username.
description: The base URL username used to authenticate
scope:
- PARAMETERS
- STAGES
@@ -57,9 +57,9 @@ spec:
- type: vaultSecret
default: appMetadata
name: appMetadataVaultSecretName
- name: vaultPassword
- name: password
type: "string"
description: The base URL password.
description: The base URL password used to authenticate
scope:
- PARAMETERS
- STAGES