Skip to content
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

Pass in initial admin password in jenkins verification library #357

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 6 additions & 2 deletions vars/rpmDashboardsDistValidation.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,22 @@ def call(Map args = [:]) {
error("Something went run! Installed $name is not actively running.")
}

def versionNumbers = version.split('\\.')*.toInteger()

def adminPassword = versionNumbers[0] > 2 || (versionNumbers[0] == 2 && versionNumbers[1] >= 12) ? "myStrongPassword123!" : "admin"

// Get the OpenSearch-Dashboards api status after start.
def osd_status_json = -1
for (int i = 0; i < 10; i++) {
if (osd_status_json != 0) {
sleep 10
osd_status_json = sh (
script: "curl -s \"http://localhost:5601/api/status\" -u admin:admin",
script: "curl -s \"http://localhost:5601/api/status\" -u admin:${adminPassword}",
returnStatus: true
)
} else {
osd_status_json = sh (
script: "curl -s \"http://localhost:5601/api/status\" -u admin:admin",
script: "curl -s \"http://localhost:5601/api/status\" -u admin:${adminPassword}",
returnStdout: true
).trim()
break
Expand Down
8 changes: 6 additions & 2 deletions vars/rpmOpenSearchDistValidation.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def call(Map args = [:]) {
//Install OpenSearch with designated version via yum
println("Start installation with yum.")
rpmCommands(
command: "install",
command: "sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! install",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you expecting user to first define the env var before running yum/rpm install?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to change the spec files of both deb and rpm, check if the var is set else exit with error msgs in the console.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in build repo companion PR.

product: "$name-$rpmVersion"
)
println("RPM distribution for $name is installed with yum.")
Expand Down Expand Up @@ -101,9 +101,13 @@ def call(Map args = [:]) {
error("Something went wrong! Installed $name is not actively running.")
}

def versionNumbers = version.split('\\.')*.toInteger()

def adminPassword = versionNumbers[0] > 2 || (versionNumbers[0] == 2 && versionNumbers[1] >= 12) ? "myStrongPassword123!" : "admin"

//Check the starting cluster
def cluster_info_json = sh (
script: "curl -s \"https://localhost:9200\" -u admin:admin --insecure",
script: "curl -s \"https://localhost:9200\" -u admin:${adminPassword} --insecure",
returnStdout: true
).trim()
println("Cluster info is: \n" + cluster_info_json)
Expand Down
Loading