-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce new npmExecuteTests step #5124
Conversation
- PARAMETERS | ||
- STAGES | ||
- STEPS | ||
default: "npm install" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use npm clean-install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- STAGES | ||
- STEPS | ||
mandatory: true | ||
default: "wdi5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above we expose the tool npm
, here we don't. We should be consistent. default: "npm run wdi5"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: e2e | ||
containers: | ||
- name: node | ||
image: node:lts-buster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buster
is a pretty old image. use a more recent one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vars/npmExecuteTests.groovy
Outdated
if (config.credentialsId) { | ||
if (config.wdi5) { | ||
credentials.add([type: 'usernamePassword', id: config.credentialsId, env: ['wdi5_username', 'wdi5_password']]) | ||
} else { | ||
credentials.add([type: 'usernamePassword', id: config.credentialsId, env: ['e2e_username', 'e2e_password']]) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid doing such special handling in the groovy. That way we will have no support for it in GHA / ADO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So should we store those in Vault as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like:
{
"appSecrets": {
"urls": [
{
"url": "loocalhost:8080",
"username": "some-username1",
"password": "some-password1"
},
{
"url": "loocalhost:8080",
"username": "some-username2",
"password": "some-password2"
}
],
"username": "base-url-username",
"password": "base-url-password"
}
}
if configOptions.OpenFile == nil { | ||
return stepConfig, errors.New("config: open file function not set") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks unrelated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but it's been missed in some old PR and it's a hard bug to catch, might add it as a new PR
params: | ||
- name: installCommand | ||
type: string | ||
description: Command to be executed for installation. Defaults to `npm ci`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the "defaults to" can be omitted as defaults are printed in the docs.
- name: onlyRunInProductiveBranch | ||
type: bool | ||
default: false | ||
description: Boolean to indicate whether the step should only be executed in the productive branch or not. | ||
scope: | ||
- PARAMETERS | ||
- STAGES | ||
- STEPS | ||
- name: productiveBranch | ||
type: string | ||
default: "main" | ||
description: The branch used as productive branch. | ||
scope: | ||
- GENERAL | ||
- PARAMETERS | ||
- STAGES | ||
- STEPS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that really needed? I would not make a simple step aware of where it's running. This should be part of the pipeline I would say.
- name: reports | ||
type: reports | ||
params: | ||
- filePattern: "**/e2e-results.xml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typical file pattern for WDI5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can provide report with wdi5
- STEPS | ||
mandatory: true | ||
default: "npm run wdi5" | ||
- name: appSecrets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name is misleading as it also contains the URLs
cmd/npmExecuteTests.go
Outdated
prefix := "e2e" | ||
if wdi5 { | ||
prefix = "wdi5" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about leaving this to the user by exposing a credentialEnvVarPrefix
parameter?
cmd/npmExecuteTests.go
Outdated
log.Entry().Infof("Running end to end tests for URL: %s", url) | ||
|
||
// Execute the npm script | ||
options := "--baseUrl=" + url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is tool specific and should be configurable or maybe expose as an env var as well?
cmd/npmExecuteTests.go
Outdated
|
||
username := config.AppSecrets["username"].(string) | ||
password := config.AppSecrets["password"].(string) | ||
credentialsToEnv(username, password, isWdi5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are empty credentials working here..?
cmd/npmExecuteTests.go
Outdated
if ok { | ||
for _, urlRaw := range urlsRaw { | ||
urlMap := urlRaw.(map[string]interface{}) | ||
url := urlMap["url"].(string) | ||
appURLs[url] = AppURL{ | ||
URL: url, | ||
Username: urlMap["username"].(string), | ||
Password: urlMap["password"].(string), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can handle the single url case with the collection as well.
if ok { | |
for _, urlRaw := range urlsRaw { | |
urlMap := urlRaw.(map[string]interface{}) | |
url := urlMap["url"].(string) | |
appURLs[url] = AppURL{ | |
URL: url, | |
Username: urlMap["username"].(string), | |
Password: urlMap["password"].(string), | |
} | |
} | |
} | |
if ok { | |
for _, urlRaw := range urlsRaw { | |
urlMap := urlRaw.(map[string]interface{}) | |
url := urlMap["url"].(string) | |
appURLs[url] = AppURL{ | |
URL: url, | |
Username: urlMap["username"].(string), | |
Password: urlMap["password"].(string), | |
} | |
} | |
} else { | |
appURLs[url] = AppURL{ | |
URL: config.BaseURL, | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this complicates it a bit
cmd/npmExecuteTests.go
Outdated
for _, urlRaw := range urlsRaw { | ||
urlMap := urlRaw.(map[string]interface{}) | ||
url := urlMap["url"].(string) | ||
appURLs[url] = AppURL{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key
is not used at all, so this could also be a list of AppUrL
.
cmd/npmExecuteTests.go
Outdated
} | ||
|
||
func runNpmExecuteTests(config *npmExecuteTestsOptions, c command.ExecRunner) error { | ||
type AppURL struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type AppURL struct { | |
type AppUnderTest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far, just one thing with the docs, that we should align.
vars/piperExecuteBin.groovy
Outdated
@@ -78,6 +78,7 @@ void call(Map parameters = [:], String stepName, String metadataFile, List crede | |||
try { | |||
try { | |||
credentialWrapper(config, credentialInfo) { | |||
echo "CONFIG: ${defaultConfigArgs}, ${customConfigArg}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? We would see the values in the command anyways, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was debug log, removed in a205ec9
test.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that shouldn't have been committed, removed in a205ec9
- STAGES | ||
- STEPS | ||
mandatory: true | ||
default: "npm run wdi5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be clear what our default tool is, if any. So I guess for WDI5 we need a sidecar, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added default sidecar: c215bac
/it-go |
Quality Gate passedIssues Measures |
/it-go |
…ix-fix * origin/master: (36 commits) Revert changes done to release action (SAP#5228) Update release-go.yml (SAP#5227) Remove README and CONTRIBUTING files from release 3rd try (SAP#5226) fix(setupCommonPipelineEnvironment): handling tags from scm info (SAP#5219) Remove README and CONTRIBUTING files from release 2nd try (SAP#5225) [CxONE] Improve report: add Low findings; Proposed Not Exploitable state (SAP#5223) Remove README and CONTRIBUTING files from release (SAP#5221) fix(naming): Rename Trust Engine to System Trust (SAP#5217) abapEnvironmentAssemblePackages Check for Build Errors (SAP#5214) docs: fix npmExuceteTests documentation formatting issues (SAP#5218) feat: Introduce new npmExecuteTests step (SAP#5124) fix(cloudFoundryDeploy): argument list too long (SAP#5216) Revert "Fix deployment failure with CF if password contains special char (SAP#5197)" (SAP#5215) chore(trustengine): Rename Trust Engine to System Trust in logs and docs (SAP#5210) Fix deployment failure with CF if password contains special char (SAP#5197) Update go version to 1.23 and removed some helper methods in favor of STD library (SAP#5200) Added validation for buildTool and buildDescriptorFile (SAP#5193) Unstash class files for Compliance stage (SAP#5192) (SAP#5204) fix(documentation): check param for jenkinsParams before appending Jenkins-specific text (SAP#5203) Align description of ADO and GHA (SAP#5202) ...
* origin/master: (36 commits) Revert changes done to release action (SAP#5228) Update release-go.yml (SAP#5227) Remove README and CONTRIBUTING files from release 3rd try (SAP#5226) fix(setupCommonPipelineEnvironment): handling tags from scm info (SAP#5219) Remove README and CONTRIBUTING files from release 2nd try (SAP#5225) [CxONE] Improve report: add Low findings; Proposed Not Exploitable state (SAP#5223) Remove README and CONTRIBUTING files from release (SAP#5221) fix(naming): Rename Trust Engine to System Trust (SAP#5217) abapEnvironmentAssemblePackages Check for Build Errors (SAP#5214) docs: fix npmExuceteTests documentation formatting issues (SAP#5218) feat: Introduce new npmExecuteTests step (SAP#5124) fix(cloudFoundryDeploy): argument list too long (SAP#5216) Revert "Fix deployment failure with CF if password contains special char (SAP#5197)" (SAP#5215) chore(trustengine): Rename Trust Engine to System Trust in logs and docs (SAP#5210) Fix deployment failure with CF if password contains special char (SAP#5197) Update go version to 1.23 and removed some helper methods in favor of STD library (SAP#5200) Added validation for buildTool and buildDescriptorFile (SAP#5193) Unstash class files for Compliance stage (SAP#5192) (SAP#5204) fix(documentation): check param for jenkinsParams before appending Jenkins-specific text (SAP#5203) Align description of ADO and GHA (SAP#5202) ...
…fig-fix * origin/master: (36 commits) Revert changes done to release action (SAP#5228) Update release-go.yml (SAP#5227) Remove README and CONTRIBUTING files from release 3rd try (SAP#5226) fix(setupCommonPipelineEnvironment): handling tags from scm info (SAP#5219) Remove README and CONTRIBUTING files from release 2nd try (SAP#5225) [CxONE] Improve report: add Low findings; Proposed Not Exploitable state (SAP#5223) Remove README and CONTRIBUTING files from release (SAP#5221) fix(naming): Rename Trust Engine to System Trust (SAP#5217) abapEnvironmentAssemblePackages Check for Build Errors (SAP#5214) docs: fix npmExuceteTests documentation formatting issues (SAP#5218) feat: Introduce new npmExecuteTests step (SAP#5124) fix(cloudFoundryDeploy): argument list too long (SAP#5216) Revert "Fix deployment failure with CF if password contains special char (SAP#5197)" (SAP#5215) chore(trustengine): Rename Trust Engine to System Trust in logs and docs (SAP#5210) Fix deployment failure with CF if password contains special char (SAP#5197) Update go version to 1.23 and removed some helper methods in favor of STD library (SAP#5200) Added validation for buildTool and buildDescriptorFile (SAP#5193) Unstash class files for Compliance stage (SAP#5192) (SAP#5204) fix(documentation): check param for jenkinsParams before appending Jenkins-specific text (SAP#5203) Align description of ADO and GHA (SAP#5202) ...
Changes
ADR