Skip to content

Commit 1e6c239

Browse files
vitalykorolevVitaly Korolev
and
Vitaly Korolev
authored
Feature/CLD-420 (#81) (#82)
* Replace all instances of yml with yaml * Fix docker test cases * Increase wait and add port to report output Co-authored-by: Vitaly Korolev <[email protected]> Co-authored-by: Vitaly Korolev <[email protected]>
1 parent 1d3f2cf commit 1e6c239

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

Jenkinsfile

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// This Jenkinsfile defines internal MarkLogic build pipeline.
22

3-
/* groovylint-disable CatchException, CompileStatic, DuplicateStringLiteral, LineLength, MethodName, MethodParameterTypeRequired, MethodReturnTypeRequired, NoDef, UnnecessaryGetter, UnusedVariable, VariableName, VariableTypeRequired */
4-
53
//Shared library definitions: https://github.com/marklogic/MarkLogic-Build-Libs/tree/1.0-declarative/vars
64
@Library('[email protected]')
75
import groovy.json.JsonSlurperClassic
@@ -195,9 +193,9 @@ def StructureTests() {
195193
sh """
196194
cd test
197195
#insert current version
198-
sed -i -e 's/VERSION_PLACEHOLDER/${mlVersion}-${env.platformString}-${env.dockerVersion}/' ./structure-test.yml
196+
sed -i -e 's/VERSION_PLACEHOLDER/${mlVersion}-${env.platformString}-${env.dockerVersion}/' ./structure-test.yaml
199197
curl -s -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 && chmod +x container-structure-test-linux-amd64 && mv container-structure-test-linux-amd64 container-structure-test
200-
./container-structure-test test --config ./structure-test.yml --image marklogic-centos/marklogic-server-centos:${mlVersion}-${env.platformString}-${env.dockerVersion} --output junit | tee container-structure-test.xml
198+
./container-structure-test test --config ./structure-test.yaml --image marklogic-centos/marklogic-server-centos:${mlVersion}-${env.platformString}-${env.dockerVersion} --output junit | tee container-structure-test.xml
201199
#fix junit output
202200
sed -i -e 's/<\\/testsuites>//' -e 's/<testsuite>//' -e 's/<testsuites/<testsuite name="container-structure-test"/' ./container-structure-test.xml
203201
"""
@@ -240,9 +238,9 @@ def DockerRunTests() {
240238
testCases.each { key, value ->
241239

242240
echo "Running "+key+": "+value.description
243-
// if .yml config is provided in params, start compose. otherwise docker run is used
244-
if ( value.params.toString().contains(".yml")) {
245-
//update image label in yml file
241+
// if .yaml config is provided in params, start compose. otherwise docker run is used
242+
if ( value.params.toString().contains(".yaml")) {
243+
//update image label in yaml file
246244
composeFile = readFile(composePath + value.params)
247245
composeFile = composeFile.replaceFirst(/image: .*/, "image: "+testImage)
248246
writeFile( file: composePath + value.params, text: composeFile)
@@ -257,7 +255,7 @@ def DockerRunTests() {
257255

258256
// TODO find a good way to skip the test on error from invalid params
259257
// TODO: Find a way to check for server status instead of a wait. (log: Database Modules is online)
260-
sleep(60)
258+
sleep(80)
261259

262260
echo "-Unauthenticated requests"
263261
value.expected.unauthenticated.each { test, verify ->
@@ -267,7 +265,7 @@ def DockerRunTests() {
267265
} catch (e) {
268266
cmdOutput = 'Curl retured error: '+e.message
269267
}
270-
testResults = testResults + '<testcase name="'+value.description+' on '+key+' without credentials"'
268+
testResults = testResults + '<testcase name="'+value.description+' on '+key+' without credentials on port '+test+'"'
271269
totalTests += 1
272270
echo "--Port ${test}: "
273271
if ( cmdOutput.contains(verify) ) {
@@ -287,7 +285,7 @@ def DockerRunTests() {
287285
} catch (e) {
288286
cmdOutput = 'Curl retured error: '+e.message
289287
}
290-
testResults = testResults + '<testcase name="'+value.description+' on '+key+' with credentials"'
288+
testResults = testResults + '<testcase name="'+value.description+' on '+key+' with credentials on port '+test+'"'
291289
totalTests += 1
292290
echo "--Port ${test}: "
293291
if ( cmdOutput.contains(verify) ) {
@@ -301,7 +299,7 @@ def DockerRunTests() {
301299
sleep(1)
302300
}
303301
echo "-Deleting resources"
304-
if ( value.params.toString().contains(".yml")) {
302+
if ( value.params.toString().contains(".yaml")) {
305303
sh( returnStdout: true, script: "docker compose -f ${composePath}${value.params} down" )
306304
} else {
307305
sh( returnStdout: true, script: "docker rm -f ${testCont}" )

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ The credentials for the admin user are configured using Docker secrets, and are
234234
## Single node MarkLogic Server on a single VM
235235
Single node configurations are used primarily on a development machine with a single user.
236236

237-
Create these files on your host machine: `marklogic-centos.yml`, `mldb_admin_username.txt`, and `mldb_admin_password.txt`. Run example Docker commands from the same directory where the files created.
237+
Create these files on your host machine: `marklogic-centos.yaml`, `mldb_admin_username.txt`, and `mldb_admin_password.txt`. Run example Docker commands from the same directory where the files created.
238238

239-
**marklogic-centos.yml**
239+
**marklogic-centos.yaml**
240240

241241
```
242242
#Docker compose file sample to setup single node cluster
@@ -291,7 +291,7 @@ volumes:
291291
Once the files are ready, run this command to start the MarkLogic Server container.
292292

293293
```
294-
$ docker-compose -f marklogic-centos.yml up -d
294+
$ docker-compose -f marklogic-centos.yaml up -d
295295
```
296296
The previous command starts a container running MarkLogic Server named "bootstrap".
297297

@@ -305,9 +305,9 @@ After the container is initialized, you can access the MarkLogic Query Console o
305305

306306
## Three node cluster on a single VM
307307

308-
The following is an example of a three-node MarkLogic server cluster created using Docker compose. Create these files on your host machine: `marklogic-cluster-centos.yml`, `mldb_admin_username.txt`, and `mldb_admin_password.txt`. Run example Docker commands from the same directory where the files created.
308+
The following is an example of a three-node MarkLogic server cluster created using Docker compose. Create these files on your host machine: `marklogic-cluster-centos.yaml`, `mldb_admin_username.txt`, and `mldb_admin_password.txt`. Run example Docker commands from the same directory where the files created.
309309

310-
**marklogic-cluster-centos.yml**
310+
**marklogic-cluster-centos.yaml**
311311

312312
```
313313
#Docker compose file sample to setup a three node cluster
@@ -406,7 +406,7 @@ volumes:
406406
Once the files have been created, run the following command to start the MarkLogic Server container:
407407

408408
```
409-
$ docker-compose -f marklogic-cluster-centos.yml up -d
409+
$ docker-compose -f marklogic-cluster-centos.yaml up -d
410410
```
411411

412412
This command will start three Docker containers running MarkLogic Server, named "bootstrap_3n", "node2" and, "node3".
@@ -423,7 +423,7 @@ As in the previous single-node example, each node of the cluster can be accessed
423423

424424
### Using ENV for admin credentials in Docker compose
425425

426-
In the previous examples, Docker secrets files were used to specify admin credentials for the MarkLogic Server. If your environment prevents the use of Docker secrets, you can use environmental variables. This approach is less secure, but it is commonly used in development environments. This is not recommended for production environments. In order to use these environment variables in the Docker compose files, remove the secrets section at the end of the Docker compose yml file, and remove the secrets section in each node. Then replace the MARKLOGIC_ADMIN_USERNAME_FILE/MARKLOGIC_ADMIN_PASSWORD_FILE variables with MARKLOGIC_ADMIN_USERNAME/MARKLOGIC_ADMIN_PASSWORD and provide the appropriate values.
426+
In the previous examples, Docker secrets files were used to specify admin credentials for the MarkLogic Server. If your environment prevents the use of Docker secrets, you can use environmental variables. This approach is less secure, but it is commonly used in development environments. This is not recommended for production environments. In order to use these environment variables in the Docker compose files, remove the secrets section at the end of the Docker compose yaml file, and remove the secrets section in each node. Then replace the MARKLOGIC_ADMIN_USERNAME_FILE/MARKLOGIC_ADMIN_PASSWORD_FILE variables with MARKLOGIC_ADMIN_USERNAME/MARKLOGIC_ADMIN_PASSWORD and provide the appropriate values.
427427

428428
Using Docker secrets, username and password information are secured when transmitting the sensitive data from Docker host to Docker containers. To prevent any attacks, the login information is not available as an environment variable. However, these values are stored in a text file and persisted in an in-memory file system inside the container. We recommend that you delete the Docker secrets information once the cluster is up and running.
429429

@@ -443,7 +443,7 @@ Using Docker secrets, username and password information are secured when transmi
443443
```
444444
$docker secret create mldb_admin_password_v1 mldb_admin_password_v1.txt
445445
```
446-
3. Create marklogic-multi-centos.yml using below:
446+
3. Create marklogic-multi-centos.yaml using below:
447447
```
448448
version: '3.6'
449449
services:
@@ -778,7 +778,7 @@ This section describes the teardown process for clusters set up on a single VM u
778778
Resources such as containers, volumes, and networks that were created with compose command can be removed using this command:
779779

780780
```
781-
$ docker-compose -f marklogic-centos.yml down
781+
$ docker-compose -f marklogic-centos.yaml down
782782
```
783783

784784
### Remove volumes

src/centos/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lint:
2222
# test docker images ** TBD **
2323
#***************************************************************************
2424
test:
25-
${container_test_tool} test --image ${REPONAME}/marklogic-server-centos:${version} --config "test/test-marklogic-server-centos:${version}.yml"
25+
${container_test_tool} test --image ${REPONAME}/marklogic-server-centos:${version} --config "test/test-marklogic-server-centos:${version}.yaml"
2626

2727
#***************************************************************************
2828
# push docker images to mlregistry.marklogic.com

test/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
There are two types of tests: Docker structure tests and Docker image tests. Both are started by the pipeline.
44

55
## Docker Structure Tests
6-
We use [container-structure-test](https://github.com/GoogleContainerTools/container-structure-testhttps:/) to validate the structure of our Docker images. Configuration file structure-test.yml defines the test cases for validation of image metadata, exposed ports, and essential files.
6+
We use [container-structure-test](https://github.com/GoogleContainerTools/container-structure-testhttps:/) to validate the structure of our Docker images. Configuration file structure-test.yaml defines the test cases for validation of image metadata, exposed ports, and essential files.
77

88
Here is an example command to run the test:
99

10-
`container-structure-test test --config ./structure-test.yml --image ml-docker-dev.marklogic.com/marklogic/marklogic-server-centos:10.0-8.1-centos-1.0.0-ea2`
10+
`container-structure-test test --config ./structure-test.yaml --image ml-docker-dev.marklogic.com/marklogic/marklogic-server-centos:10.0-8.1-centos-1.0.0-ea2`
1111

1212

1313
## Docker Image Tests

test/docker-test-cases.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"docker-2": {
1919
"description": "Initialized MarkLogic Server",
20-
"params": "-e MARKLOGIC_INIT=false -e MARKLOGIC_ADMIN_USERNAME=test_admin -e MARKLOGIC_ADMIN_PASSWORD=test_admin_pass",
20+
"params": "-e MARKLOGIC_INIT=true -e MARKLOGIC_ADMIN_USERNAME=test_admin -e MARKLOGIC_ADMIN_PASSWORD=test_admin_pass",
2121
"expected": {
2222
"unauthenticated": {
2323
"8000": "401 Unauthorized",
@@ -33,7 +33,7 @@
3333
},
3434
"docker-3": {
3535
"description": "Initialized MarkLogic Server with License Key",
36-
"params": "-e MARKLOGIC_INIT=false -e MARKLOGIC_ADMIN_USERNAME=test_admin -e MARKLOGIC_ADMIN_PASSWORD=test_admin_pass -e LICENSE_PLACEHOLDER -e INSTALL_CONVERTERS=false",
36+
"params": "-e MARKLOGIC_INIT=true -e MARKLOGIC_ADMIN_USERNAME=test_admin -e MARKLOGIC_ADMIN_PASSWORD=test_admin_pass -e LICENSE_PLACEHOLDER -e INSTALL_CONVERTERS=false",
3737
"expected": {
3838
"unauthenticated": {
3939
"8000": "401 Unauthorized",
@@ -65,7 +65,7 @@
6565
},
6666
"compose-1": {
6767
"description": "Compose single node",
68-
"params": "marklogic-centos.yml",
68+
"params": "marklogic-centos.yaml",
6969
"expected": {
7070
"unauthenticated": {
7171
"8000": "401 Unauthorized",
@@ -81,7 +81,7 @@
8181
},
8282
"compose-2": {
8383
"description": "Compose three node",
84-
"params": "marklogic-cluster-centos.yml",
84+
"params": "marklogic-cluster-centos.yaml",
8585
"expected": {
8686
"unauthenticated": {
8787
"7100": "401 Unauthorized",

0 commit comments

Comments
 (0)