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

Feature/CLD-484 (#87) #89

Merged
merged 1 commit into from
May 31, 2022
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 .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

- ##### Owner:

- [ ] JIRA_ID as part of branch name
- [ ] JIRA_ID as part of branch/PR name
- [ ] Rebase the branch with upstream
- [ ] Squashed all commits into a single commit
- [ ] Added Tests

- ##### Reviewer:

- [ ] Reviewed Tests
- [ ] Added to Release Wiki
- [ ] Added to Release Wiki/Jira
13 changes: 6 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,15 @@ def DockerRunTests() {
def defaultParams='-it -d -p 8000:8000 -p 8001:8001 -p 8002:8002 -p7997:7997'
def curlCommand='curl -sL'
def curlCommandAuth='curl -sL --anyauth -u test_admin:test_admin_pass'
def composePath='./docker-compose/'
def jUnitReport = "docker-test-results.xml"
def testCases = readJSON file: './test/docker-test-cases.json'

//validate JSON data
assert testCases instanceof Map

//create credential files for compose
writeFile(file: "${composePath}mldb_admin_username.txt", text: "test_admin")
writeFile(file: "${composePath}mldb_admin_password.txt", text: "test_admin_pass")
writeFile(file: "./docker-compose/mldb_admin_username.txt", text: "test_admin")
writeFile(file: "./docker-compose/mldb_admin_password.txt", text: "test_admin_pass")

def testResults = ''
def totalTests = 0
Expand All @@ -241,11 +240,11 @@ def DockerRunTests() {
// if .yaml config is provided in params, start compose. otherwise docker run is used
if ( value.params.toString().contains(".yaml")) {
//update image label in yaml file
composeFile = readFile(composePath + value.params)
composeFile = readFile(value.params)
composeFile = composeFile.replaceFirst(/image: .*/, "image: "+testImage)
writeFile( file: composePath + value.params, text: composeFile)
writeFile( file: value.params, text: composeFile)
// start docker compose
sh( returnStdout: true, script: "docker compose -f ${composePath}${value.params} up -d" )
sh( returnStdout: true, script: "docker compose -f ${value.params} up -d" )
} else {
//insert valid license data in parameters
value.params = value.params.toString().replaceAll("LICENSE_PLACEHOLDER", "LICENSEE='MarkLogic - Version 9 QA Test License' -e LICENSE_KEY=\"${env.QA_LICENSE_KEY}\"")
Expand Down Expand Up @@ -300,7 +299,7 @@ def DockerRunTests() {
}
echo "-Deleting resources"
if ( value.params.toString().contains(".yaml")) {
sh( returnStdout: true, script: "docker compose -f ${composePath}${value.params} down" )
sh( returnStdout: true, script: "docker compose -f ${value.params} down" )
} else {
sh( returnStdout: true, script: "docker rm -f ${testCont}" )
}
Expand Down
2 changes: 1 addition & 1 deletion dockerFiles/dockerfile-marklogic-server-centos
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################
#
# Copyright (c) 2021 MarkLogic Corporation
# Copyright (c) 2022 MarkLogic Corporation
#
###############################################################
FROM ml-docker-dev.marklogic.com/marklogic/marklogic-server-centos:10.0-7.3_1.0.0_EA
Expand Down
2 changes: 1 addition & 1 deletion dockerFiles/marklogic-deps-centos:base
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################
#
# Copyright (c) 2021 MarkLogic Corporation
# Copyright (c) 2022 MarkLogic Corporation
#
###############################################################

Expand Down
2 changes: 1 addition & 1 deletion dockerFiles/marklogic-server-centos:base
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################
#
# Copyright (c) 2021 MarkLogic Corporation
# Copyright (c) 2022 MarkLogic Corporation
#
###############################################################

Expand Down
32 changes: 4 additions & 28 deletions src/centos/scripts/join-cluster.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash
###############################################################
#
# Copyright 2019 MarkLogic Corporation. All Rights Reserved.
# Copyright 2022 MarkLogic Corporation. All Rights Reserved.
#
###############################################################
# join host to cluster
Expand All @@ -11,46 +11,22 @@
#
###############################################################

################################################################
# check if admin password is a secret or env var
################################################################
SECRET_USR_FILE=/run/secrets/${MARKLOGIC_ADMIN_USERNAME_FILE}
SECRET_PWD_FILE=/run/secrets/${MARKLOGIC_ADMIN_PASSWORD_FILE}

if [[ -f "$SECRET_PWD_FILE" ]] && [[ ! -z "$(<"$SECRET_PWD_FILE")" ]]
then
echo "using docker secrets for credentials"
ML_ADMIN_PASSWORD=$(<"$SECRET_PWD_FILE")
else
echo "using ENV for credentials"
ML_ADMIN_PASSWORD=$MARKLOGIC_ADMIN_PASSWORD
fi

if [[ -f "$SECRET_USR_FILE" ]] && [[ ! -z "$(<"$SECRET_USR_FILE")" ]]
then
echo "using docker secrets for credentials"
ML_ADMIN_USERNAME=$(<"$SECRET_USR_FILE")
else
echo "using ENV for credentials"
ML_ADMIN_USERNAME=$MARKLOGIC_ADMIN_USERNAME
fi

cluster=${1:-${MARKLOGIC_BOOTSTRAP_HOST}}
joiner=${2:-localhost}
user=${3:-${ML_ADMIN_USERNAME}}
pass=${4:-${ML_ADMIN_PASSWORD}}

curl -o host.xml --anyauth --user $user:$pass -X GET -H "Accept: application/xml" \
curl -s -o host.xml --anyauth --user $user:$pass -X GET -H "Accept: application/xml" \
http://${joiner}:8001/admin/v1/server-config

curl -v --anyauth --user $user:$pass -X POST -d "group=Default" \
curl -s -v --anyauth --user $user:$pass -X POST -d "group=Default" \
--data-urlencode "server-config@./host.xml" \
-H "Content-type: application/x-www-form-urlencoded" \
-o cluster.zip http://${cluster}:8001/admin/v1/cluster-config

sleep 10s

curl -v --anyauth --user $user:$pass -X POST -H "Content-type: application/zip" \
curl -s -v --anyauth --user $user:$pass -X POST -H "Content-type: application/zip" \
--data-binary @./cluster.zip \
http://${joiner}:8001/admin/v1/cluster-config

Expand Down
Loading