diff --git a/Jenkinsfile.api b/Jenkinsfile.api index 08e9625..e118360 100644 --- a/Jenkinsfile.api +++ b/Jenkinsfile.api @@ -16,7 +16,7 @@ properties([ string(name: 'AwsUsePublicIp', defaultValue: 'Yes', description: 'AWS EC2 has public IP or not'), string(name: 'MdRepo', defaultValue: 'http://folio-registry.aws.indexdata.com', description: 'Module descriptor repository'), string(name: 'StableFolio', defaultValue: 'https://folio-snapshot.dev.folio.org', description: 'Use stable version of modules'), - string(name: 'FixedOkapi', defaultValue: '4.5.0', description: 'Use specified version of Okapi'), + string(name: 'FixedOkapi', defaultValue: 'latest', description: 'Use specified version of Okapi'), text(name: 'FixedMods', defaultValue: '', description: 'Paste install.json content here to use predefined module versions rather than pulling from stable FOLIO site'), string(name: 'SampleDataRepo', defaultValue: 'https://s3.amazonaws.com/folio-public-sample-data', description: 'Sample data repository'), string(name: 'SampleDataName', defaultValue: 'perf', description: 'Sample dataset name'), diff --git a/Jenkinsfile.folioci b/Jenkinsfile.folioci index 5bc546b..bc9f664 100644 --- a/Jenkinsfile.folioci +++ b/Jenkinsfile.folioci @@ -11,7 +11,7 @@ properties([ string(name: 'AwsUsePublicIp', defaultValue: 'Yes', description: 'AWS EC2 has public IP or not'), string(name: 'MdRepo', defaultValue: 'http://folio-registry.aws.indexdata.com', description: 'Module descriptor repository'), string(name: 'StableFolio', defaultValue: 'https://folio-snapshot.dev.folio.org', description: 'Use stable version of modules'), - string(name: 'FixedOkapi', defaultValue: '4.5.0', description: 'Use specified version of Okapi'), + string(name: 'FixedOkapi', defaultValue: 'latest', description: 'Use specified version of Okapi'), text(name: 'FixedMods', defaultValue: '', description: 'Paste install.json content here to use predefined module versions rather than pulling from stable FOLIO site'), string(name: 'SampleDataRepo', defaultValue: 'https://s3.amazonaws.com/folio-public-sample-data', description: 'Sample data repository'), string(name: 'SampleDataName', defaultValue: 'perf', description: 'Sample dataset name'), diff --git a/Jenkinsfile.integration b/Jenkinsfile.integration index ce3add5..28780d6 100644 --- a/Jenkinsfile.integration +++ b/Jenkinsfile.integration @@ -16,9 +16,9 @@ properties([ string(name: 'AwsUsePublicIp', defaultValue: 'Yes', description: 'AWS EC2 has public IP or not'), string(name: 'MdRepo', defaultValue: 'http://folio-registry.aws.indexdata.com', description: 'Module descriptor repository'), string(name: 'StableFolio', defaultValue: 'https://folio-snapshot.dev.folio.org', description: 'Use stable version of modules'), - string(name: 'FixedOkapi', defaultValue: '4.5.0', description: 'Use specified version of Okapi'), + string(name: 'FixedOkapi', defaultValue: 'latest', description: 'Use specified version of Okapi'), text(name: 'FixedMods', defaultValue: '', description: 'Paste install.json content here to use predefined module versions rather than pulling from stable FOLIO site'), - string(name: 'SampleDataRepo', defaultValue: 'https://s3.amazonaws.com/folio-public-sample-data', description: 'Sample data repository'), + string(name: 'SampleDataRepo', defaultValue: 'https://folio-public-sample-data-jenkins.s3.us-west-2.amazonaws.com', description: 'Sample data repository'), string(name: 'SampleDataName', defaultValue: 'perf', description: 'Sample dataset name'), string(name: 'TestRailUrl', defaultValue: 'https://foliotest.testrail.io', description: 'TestRail reporitng server URL'), string(name: 'TestRailProjectId', defaultValue: '19', description: 'TestRail Project ID for Intgegration tests'), @@ -30,7 +30,7 @@ def context node('jenkins-agent-java11') { - timeout(180) { + timeout(600) { stage("Checkout") { cleanWs() @@ -48,7 +48,7 @@ node('jenkins-agent-java11') { try { stage("Create Environment") { - sharedLib.notifySlack() + // sharedLib.notifySlack() sharedLib.createEnv(context) } @@ -73,11 +73,11 @@ node('jenkins-agent-java11') { } stage("Run integration tests") { - node('jenkins-slave-all') { sharedLib.runIntegrationTests(context) - } } } catch (e) { + // turn the timer on in case of failures + //sleep 1800 currentBuild.result = 'FAILURE' throw e } finally { diff --git a/Jenkinsfile.platform b/Jenkinsfile.platform index e11f117..b5d4f14 100644 --- a/Jenkinsfile.platform +++ b/Jenkinsfile.platform @@ -11,7 +11,7 @@ properties([ string(name: 'AwsUsePublicIp', defaultValue: 'Yes', description: 'AWS EC2 has public IP or not'), string(name: 'MdRepo', defaultValue: 'http://folio-registry.aws.indexdata.com', description: 'Module descriptor repository'), string(name: 'StableFolio', defaultValue: 'https://folio-snapshot-core.dev.folio.org', description: 'Use stable version of modules'), - string(name: 'FixedOkapi', defaultValue: '4.5.0', description: 'Use specified version of Okapi'), + string(name: 'FixedOkapi', defaultValue: 'latest', description: 'Use specified version of Okapi'), text(name: 'FixedMods', defaultValue: '', description: 'Paste install.json content here to use predefined module versions rather than pulling from stable FOLIO site'), string(name: 'SampleDataRepo', defaultValue: 'https://s3.amazonaws.com/folio-public-sample-data', description: 'Sample data repository'), string(name: 'SampleDataName', defaultValue: 'perf', description: 'Sample dataset name'), diff --git a/Jenkinsfile.public b/Jenkinsfile.public index a8d714f..06fb32a 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -11,7 +11,7 @@ properties([ string(name: 'AwsUsePublicIp', defaultValue: 'Yes', description: 'AWS EC2 has public IP or not'), string(name: 'MdRepo', defaultValue: 'http://folio-registry.aws.indexdata.com', description: 'Module descriptor repository'), string(name: 'StableFolio', defaultValue: 'https://folio-snapshot-stable.dev.folio.org', description: 'Use stable version of modules'), - string(name: 'FixedOkapi', defaultValue: '4.5.0', description: 'Use specified version of Okapi'), + string(name: 'FixedOkapi', defaultValue: 'latest', description: 'Use specified version of Okapi'), text(name: 'FixedMods', defaultValue: '', description: 'Paste install.json content here to use predefined module versions rather than pulling from stable FOLIO site'), string(name: 'SampleDataRepo', defaultValue: 'https://s3.amazonaws.com/folio-public-sample-data', description: 'Sample data repository'), string(name: 'SampleDataName', defaultValue: 'perf', description: 'Sample dataset name'), diff --git a/cloudformation/folio.yml b/cloudformation/folio.yml index 20f5209..a950bd6 100644 --- a/cloudformation/folio.yml +++ b/cloudformation/folio.yml @@ -27,7 +27,7 @@ Parameters: InstanceTypeMods: Description: EC2 instance type for backend modules server Type: String - Default: m5.2xlarge + Default: m5.4xlarge InstanceTypeDb: Description: EC2 instance type for database server Type: String diff --git a/config/db.sh b/config/db.sh index 100c67f..c752f54 100644 --- a/config/db.sh +++ b/config/db.sh @@ -1 +1 @@ -docker run -d --rm --name foliodb -e POSTGRES_USER=folio -e POSTGRES_PASSWORD=folioadmin -p5432:5432 postgres:10 -N 1000 +docker run -d --rm --name foliodb -e POSTGRES_USER=folio -e POSTGRES_PASSWORD=folioadmin -p5432:5432 postgres:12 -N 1000 diff --git a/config/elasticsearch.sh b/config/elasticsearch.sh new file mode 100644 index 0000000..1982404 --- /dev/null +++ b/config/elasticsearch.sh @@ -0,0 +1 @@ +docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "ELASTIC_PASSWORD=s3cret" docker.dev.folio.org/folio-elasticsearch:7.10.1 diff --git a/config/mod-bursar-export.sh b/config/mod-bursar-export.sh new file mode 100644 index 0000000..da26faa --- /dev/null +++ b/config/mod-bursar-export.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -p${port}:8081 folioci/${modName}:${modVer} \ No newline at end of file diff --git a/config/mod-circulation-storage.sh b/config/mod-circulation-storage.sh new file mode 100644 index 0000000..9a2587a --- /dev/null +++ b/config/mod-circulation-storage.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'OKAPI_URL=http://${okapiIp}:9130' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'ENV=${envName}' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-data-export-spring.sh b/config/mod-data-export-spring.sh new file mode 100644 index 0000000..4bed89e --- /dev/null +++ b/config/mod-data-export-spring.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'OKAPI_URL=http://${okapiIp}:9130' -e 'ENV=${envName}' -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'ELASTICSEARCH_HOST=${dbHost}' -e 'ELASTICSEARCH_PORT=9301' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json \ No newline at end of file diff --git a/config/mod-data-export.sh b/config/mod-data-export.sh new file mode 100644 index 0000000..236a2d0 --- /dev/null +++ b/config/mod-data-export.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e JAVA_OPTIONS=\'-Dorg.folio.metadata.inventory.storage.type=okapi -Daws.region=us-west-2 -Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Dbucket.name=folio-concorde\' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-data-import-converter-storage.sh b/config/mod-data-import-converter-storage.sh new file mode 100644 index 0000000..7085efc --- /dev/null +++ b/config/mod-data-import-converter-storage.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-data-import.sh b/config/mod-data-import.sh new file mode 100644 index 0000000..9a2587a --- /dev/null +++ b/config/mod-data-import.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'OKAPI_URL=http://${okapiIp}:9130' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'ENV=${envName}' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-erm.sh b/config/mod-erm.sh index 165183b..493f07c 100644 --- a/config/mod-erm.sh +++ b/config/mod-erm.sh @@ -1 +1 @@ -docker run -d --rm --name ${modName} -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -p${port}:8080 folioci/${modName}:${modVer} +docker run -d --name ${modName} -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -p${port}:8080 folioci/${modName}:${modVer} diff --git a/config/mod-inn-reach.sh b/config/mod-inn-reach.sh new file mode 100644 index 0000000..7085efc --- /dev/null +++ b/config/mod-inn-reach.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-inventory-storage.sh b/config/mod-inventory-storage.sh new file mode 100644 index 0000000..232bc6a --- /dev/null +++ b/config/mod-inventory-storage.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'OKAPI_URL=http://${okapiIp}:9130' -e 'ENV=${envName}' -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-inventory.sh b/config/mod-inventory.sh new file mode 100644 index 0000000..5a7503c --- /dev/null +++ b/config/mod-inventory.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'OKAPI_URL=http://${okapiIp}:9130' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:9403 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mod-kb-ebsco.sh b/config/mod-kb-ebsco.sh index b760529..af06add 100644 --- a/config/mod-kb-ebsco.sh +++ b/config/mod-kb-ebsco.sh @@ -1 +1 @@ -docker run -d --rm --name ${modName} -e 'EBSCO_RMAPI_BASE_URL=https://sandbox.ebsco.io' -p${port}:8081 folioci/${modName}:${modVer} +docker run -d --rm --name ${modName} -e 'EBSCO_RMAPI_BASE_URL=https://sandbox.ebsco.io' -p${port}:8081 folioci/${modName}:${modVer} diff --git a/config/mod-oa.sh b/config/mod-oa.sh new file mode 100644 index 0000000..edcffee --- /dev/null +++ b/config/mod-oa.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} -e 'OKAPI_SERVICE_PORT=9130' -e 'OKAPI_SERVICE_HOST=${okapiIp}' -e 'JAVA_OPTIONS="-server -XX:+UseContainerSupport -XX:MaxRAMPercentage=55.0 -XX:+PrintFlagsFinal"' -p${port}:8080 folioci/${modName}:${modVer} diff --git a/config/mod-search.sh b/config/mod-search.sh new file mode 100644 index 0000000..31ef0e9 --- /dev/null +++ b/config/mod-search.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} -e 'DB_HOST=${dbHost}' -e 'ENV=${envName}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'ELASTICSEARCH_HOST=${dbHost}' -e 'ELASTICSEARCH_PASSWORD=s3cret' -e 'OKAPI_URL=http://${okapiIp}:9130' -p${port}:8081 folioci/${modName}:${modVer} diff --git a/config/mod-service-interaction.sh b/config/mod-service-interaction.sh new file mode 100644 index 0000000..cee9424 --- /dev/null +++ b/config/mod-service-interaction.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/mod-courses:1.2.3-SNAPSHOT.117 db_connection=/folio-conf/pg.json diff --git a/config/mod-source-record-manager.sh b/config/mod-source-record-manager.sh new file mode 100644 index 0000000..35d9819 --- /dev/null +++ b/config/mod-source-record-manager.sh @@ -0,0 +1 @@ +docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'OKAPI_URL=http://${okapiIp}:9130' -e 'ENV=${envName}' -e 'DB_HOST=${dbHost}' -e 'DB_PORT=5432' -e 'DB_DATABASE=folio' -e 'DB_USERNAME=folio' -e 'DB_PASSWORD=folioadmin' -e 'KAFKA_HOST=${dbHost}' -e 'KAFKA_PORT=9092' -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/config/mods.sh b/config/mods.sh index 88c4350..61f61f7 100644 --- a/config/mods.sh +++ b/config/mods.sh @@ -1 +1 @@ -docker run -d --rm --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json +docker run -d --name ${modName} --mount type=bind,source=/tmp/folio-conf,target=/folio-conf -e 'JAVA_OPTIONS=-Dorg.folio.metadata.inventory.storage.type=okapi' -p${port}:8081 folioci/${modName}:${modVer} db_connection=/folio-conf/pg.json diff --git a/shared.groovy b/shared.groovy index 53c7e2f..4c03ef5 100644 --- a/shared.groovy +++ b/shared.groovy @@ -85,7 +85,7 @@ def waitForEnv(ctx) { def bootstrapDb(ctx) { stopFolioDockers(ctx, ctx.dbIp) sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} sudo service ecs stop" - sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} sudo amazon-linux-extras install -y postgresql10" + sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} sudo amazon-linux-extras install -y postgresql12" sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} sudo yum install -y jq wget" sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} sudo yum install -y git" sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} sudo curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-\$(uname -s)-\$(uname -m) -o /usr/local/bin/docker-compose" @@ -109,6 +109,21 @@ def bootstrapDb(ctx) { } } } + + def elasticJob = readFile("config/elasticsearch.sh").trim() + sh "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} ${elasticJob}" + def elasticCmd = 'docker ps | grep elasticsearch | wc -l' + timeout(10) { + waitUntil { + try { + def rs = sh(script: "${ctx.sshCmd} -l ${ctx.sshUser} ${ctx.dbIp} '${elasticCmd}'", returnStdout: true) + rs.toInteger() >= 1 + } catch (e) { + sleep 10 + false + } + } + } } def bootstrapOkapi(ctx) { @@ -164,7 +179,7 @@ def bootstrapModules(ctx) { echo "mods: ${mods}" mods = registerMods(mods, ctx.mdRepo, ctx.okapiIp) echo "valid mods: ${mods}" - deployMods(mods, ctx.okapiIp, ctx.modsIp, ctx.modsPvtIp, ctx.dbPvtIp, ctx.tenant, ctx.sshCmd, ctx.sshUser) + deployMods(ctx.envName, mods, ctx.okapiIp, ctx.modsIp, ctx.modsPvtIp, ctx.dbPvtIp, ctx.tenant, ctx.sshCmd, ctx.sshUser) } def populateData(ctx) { @@ -254,7 +269,7 @@ def runNewman(ctx, postmanEnvironment) { userRemoteConfigs: [[url: 'https://github.com/folio-org/folio-api-tests.git']] ]) def okapiDns = "ec2-" + ctx.okapiIp.replaceAll(/\./, "-") + ".compute-1.amazonaws.com" - def okapiUser="super_admin" + def okapiUser="admin" def okapiPwd="admin" dir("${env.WORKSPACE}/folio-api-tests") { withDockerContainer(image: 'postman/newman', args: '--user 0:0 --entrypoint=\'\'') { @@ -321,17 +336,60 @@ def runIntegrationTests(ctx) { echo "Run all folio-integration-tests" dir("${env.WORKSPACE}/folio-integration-tests") { withMaven( - jdk: 'openjdk-8-jenkins-slave-all', + jdk: 'openjdk-11-jenkins-slave-all', maven: 'maven3-jenkins-slave-all', mavenSettingsConfig: 'folioci-maven-settings' ) { def okapiDns = "ec2-" + ctx.okapiIp.replaceAll(/\./, "-") + ".compute-1.amazonaws.com" - withCredentials([usernamePassword(credentialsId: 'testrail-ut56', passwordVariable: 'testrail_password', usernameVariable: 'testrail_user')]) { - sh "mvn test -Dkarate.env=${okapiDns} -DfailIfNoTests=false -Dtestrail_url=${TestRailUrl} -Dtestrail_userId=${testrail_user} -Dtestrail_pwd=${testrail_password} -Dtestrail_projectId=${TestRailProjectId}" + withCredentials([usernamePassword(credentialsId: 'testrail-ut56', passwordVariable: 'testrail_password', usernameVariable: 'testrail_user'), string(credentialsId: 'mod-kb-ebsco-key', variable: 'ebsco_key'), string(credentialsId: 'mod-kb-ebsco-url', variable: 'ebsco_url'), string(credentialsId: 'mod-kb-ebsco-id', variable: 'ebsco_id'), string(credentialsId: 'mod-kb-ebsco-usageId', variable: 'ebsco_usage_id'), string(credentialsId: 'mod-kb-ebsco-usageSecret', variable: 'ebsco_usage_secret'), string(credentialsId: 'mod-kb-ebsco-usageKey', variable: 'ebsco_usage_key')]) { + sh """ + export kbEbscoCredentialsApiKey=${ebsco_key} + export kbEbscoCredentialsUrl=${ebsco_url} + export kbEbscoCredentialsCustomerId=${ebsco_id} + export usageConsolidationCredentialsId=${ebsco_usage_id} + export usageConsolidationCredentialsSecret=${ebsco_usage_secret} + export usageConsolidationCustomerKey=${ebsco_usage_key} + mvn test -Dkarate.env=${okapiDns} -DfailIfNoTests=false -Dtestrail_url=${TestRailUrl} -Dtestrail_userId=${testrail_user} -Dtestrail_pwd=${testrail_password} -Dtestrail_projectId=${TestRailProjectId} -DkbEbscoCredentialsApiKey=${ebsco_key} -DkbEbscoCredentialsUrl=${ebsco_url} -DkbEbscoCredentialsCustomerId=${ebsco_id} -DusageConsolidationCredentialsId=${ebsco_usage_id} -DusageConsolidationCredentialsSecret=${ebsco_usage_secret} -DusageConsolidationCustomerKey=${ebsco_usage_key} + """ } } sh "mkdir ${env.WORKSPACE}/folio-integration-tests/cucumber-reports" - sh "find . | grep json | grep '/target/surefire-reports/' | xargs -i cp {} ${env.WORKSPACE}/folio-integration-tests/cucumber-reports" + sh "find . | grep json | grep '/target/karate-reports' | xargs -i cp {} ${env.WORKSPACE}/folio-integration-tests/cucumber-reports" + teams = ['thunderjet', 'bama', 'firebird', 'prokopovych', 'folijet', 'spitfire', 'vega', 'core-platform', 'erm-delivery', 'fse', 'stripes', 'leipzig', + 'ncip', 'thor', 'volaris', 'knowledgeware', 'spring'] + teams_test = ['spitfire', 'bama', 'folijet', 'thunderjet', 'firebird', 'prokopovych', 'vega', 'core_platform'] + team_modules = [spitfire: ['mod-kb-ebsco-java', 'tags', 'codexekb', 'mod-notes', 'mod-quick-marc', 'mod-search', 'passwordvalidator'], + folijet: ['mod-source-record-storage', 'mod-source-record-manager', 'mod-data-import', 'data-import', 'mod-data-import-converter-storage'], + thunderjet: ['mod-finance', 'edge-orders', 'mod-gobi', 'mod-orders', 'mod-organizations', 'mod-invoice', 'mod-ebsconet', 'cross-modules'], + firebird: ['mod-audit', 'bulk-edit', 'edge-dematic', 'edge-caiasoft', 'dataexport', 'oaipmh', 'mod-data-export-spring', 'mod-data-export-worker'], + prokopovych: ['mod-inventory', 'mod-users-bl', 'edge-patron', 'edge-rtac', 'mod-users'], + vega: ['mod-event-config', 'mod-sender', 'mod-circulation', 'mod-template-engine', 'mod-email', 'mod-notify', 'mod-feesfines', 'mod-patron-blocks', 'mod-circulation'], + core_platform: ['mod-configuration', 'mod-permissions', 'mod-login-saml', 'mod-user-import'], + bama: ['mod-calendar'] + ] + dir("${env.WORKSPACE}/folio-integration-tests/cucumber-reports"){ + for (team in teams_test){ + sh """ + mkdir ${team} + touch ${team}/status.txt + touch ${team}/failed.txt + echo -n SUCCESS > ${team}/status.txt + """ + for (mod in team_modules[team]){ + sh """ + for i in \$(find .. | grep json | grep '/target/karate-reports'| grep summary); do + if [[ \$(cat \$i | grep ${mod}) ]]; then + if [[ \$(cat \$i | grep '"failed":true') ]]; then + echo -n FAILED > ${team}/status.txt + echo ${mod} >> ${team}/failed.txt + break + fi + fi + done + """ + } + } + } cucumber buildStatus: "UNSTABLE", fileIncludePattern: "*.json", jsonReportDirectory: "cucumber-reports" @@ -417,18 +475,30 @@ def getMods(fixedMods, mdRepo) { } def latestMods = [:] for (mod in mods) { -// skip edge-sip2 for now due to regex issue +// skip edge-sip2, mod-oa, mod eusage for now due to regex issue // should be fixed later if (mod.id.startsWith("edge-sip2")) { continue } + if (mod.id.startsWith("mod-oa-")) { + continue + } + if (mod.id.startsWith("mod-eusage-reports")) { + continue + } // registering in Okapi issue // should be fixed later - if (mod.id.startsWith("mod-data-export")) { + // if (mod.id.startsWith("mod-data-export-spring")) { + // continue + // } + + // if (mod.id.startsWith("mod-data-export-worker")) { + // continue + // } + if (mod.id.startsWith("mod-service-interaction")) { continue } - def group = (mod.id =~ /(^\D+)-(\d+.*$)/) def modName = group[0][1] // only select backend (mod-) and frontend (folio-) modules @@ -503,7 +573,7 @@ def registerMods(mods, mdRepo, okapiIp) { } // deploy modules -def deployMods(mods, okapiIp, modsIp, modsPvtIp, dbPvtIp, tenant, sshCmd, sshUser) { +def deployMods(envName, mods, okapiIp, modsIp, modsPvtIp, dbPvtIp, tenant, sshCmd, sshUser) { def port = 9200 def modJobTemplate = readFile("config/mods.sh").trim() def installTemplate = readFile("config/install.json").trim() @@ -549,8 +619,95 @@ def deployMods(mods, okapiIp, modsIp, modsPvtIp, dbPvtIp, tenant, sshCmd, sshUse modJob = modJob.replace('8080', '8081') } } + // mod-inventory-storage and mod-ebsconet have different env variables + if (modName.equals("mod-inventory-storage") || + modName.equals("mod-source-record-storage") || + modName.equals("mod-ebsconet") || + modName.equals("mod-data-import")) { + modJob = readFile("config/mod-inventory-storage.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + modJob = modJob.replace('${envName}', envName) + } + // mod-source-record-storage has different env variables + if (modName.equals("mod-source-record-manager")) { + modJob = readFile("config/mod-source-record-manager.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + modJob = modJob.replace('${envName}', envName) + modJob = modJob.replace('${port}', '' + port) + modJob = modJob.replace('${modVer}', "" + modVer) + modJob = modJob.replace('${modName}', modName) + } + // mod-data-import-converter-storage, users has different env variables + if (modName.equals("mod-data-import-converter-storage") || + modName.equals("mod-users") || + modName.equals("mod-notes")) { + modJob = readFile("config/mod-data-import-converter-storage.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + } + // mod-data-export-string, mod-data-export-worker has different env variables + if (modName.equals("mod-data-export-spring") || + modName.equals("mod-data-export-worker")) { + modJob = readFile("config/mod-data-export-spring.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + modJob = modJob.replace('${envName}', envName) + modJob = modJob.replace('${port}', '' + port) + modJob = modJob.replace('${modVer}', "" + modVer) + modJob = modJob.replace('${modName}', modName) + } + // mod-bursar-export and mod-password-validator have different env variables + if (modName.equals("mod-bursar-export") || + modName.equals("mod-password-validator") || + modName.equals("mod-login")) { + modJob = readFile("config/mod-bursar-export.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + } + // mod-search has different env variables + if (modName.equals("mod-search")) { + modJob = readFile("config/mod-search.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + modJob = modJob.replace('${envName}', envName) + + } + // mod-oa has different env variables + if (modName.equals("mod-oa")) { + modJob = readFile("config/mod-oa.sh").trim() + modJob = modJob.replace('${okapiIp}', okapiIp) + } + //mod-inn-reach needs additional db params + if ((modName.equals("mod-inn-reach")) || + modName.equals("mod-tags")) + { + modJob = readFile("config/mod-inn-reach.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + } + // added s3 credentials to data-export + if (modName.equals("mod-data-export")) { + modJob = readFile("config/mod-data-export.sh").trim() + modJob = modJob.replace('${AWS_ACCESS_KEY_ID}', AWS_ACCESS_KEY_ID) + modJob = modJob.replace('${AWS_SECRET_ACCESS_KEY}', AWS_SECRET_ACCESS_KEY) + } + if (modName.equals("mod-inventory")) { + modJob = readFile("config/mod-inventory.sh").trim() + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + } + // temporary solution to escape mod-service-interaction failure + //if (modName.equals("mod-service-interaction")) { + // continue + // modJob = readFile("config/mod-service-interaction.sh").trim() + // modJob = modJob.replace('${dbHost}', dbPvtIp) + // modJob = modJob.replace('${okapiIp}', okapiIp) + // } // mod-pubsub has different env variables - if (modName.equals("mod-pubsub")) { + if (modName.equals("mod-pubsub") || + modName.equals("mod-ebsconet") || + modName.equals("mod-remote-storage") || + modName.equals("mod-quick-marc")) { modJob = readFile("config/mod-pubsub.sh").trim() modJob = modJob.replace('${dbHost}', dbPvtIp) modJob = modJob.replace('${okapiIp}', okapiIp) @@ -563,12 +720,27 @@ def deployMods(mods, okapiIp, modsIp, modsPvtIp, dbPvtIp, tenant, sshCmd, sshUse modJob = modJob.replace('${port}', '' + port) modJob = modJob.replace('${modVer}', "" + modVer) // mod-inventory uses port 9403, not 8081 - if (modName.equals("mod-inventory")) { - modJob = modJob.replace('8081', '9403') - } + // if (modName.equals("mod-inventory")) { + // modJob = modJob.replace('8081', '9403') + // } // mod-circulation uses port 9801, not 8081 if (modName.equals("mod-circulation")) { modJob = modJob.replace('8081', '9801') + } + + // mod-circulation-storage uses port 9801, not 8081 + if (modName.equals("mod-circulation-storage")) { + modJob = readFile("config/mod-circulation-storage.sh").trim() + // modJob = modJob.replace('8081', '9801') + modJob = modJob.replace('${modName}', modName) + modJob = modJob.replace('${dbHost}', dbPvtIp) + modJob = modJob.replace('${okapiIp}', okapiIp) + modJob = modJob.replace('${port}', '' + port) + modJob = modJob.replace('${modVer}', "" + modVer) + modJob = modJob.replace('${envName}', envName) + + + } // mod-login has a special parameter if (modName.equals("mod-login")) { @@ -621,21 +793,37 @@ def stopFolioDockers(ctx, ip) { } def notifySlack(String buildStatus = 'STARTED') { - - // Build status of null means success. - buildStatus = buildStatus ?: 'SUCCESS' + teams_test = ['spitfire', 'bama', 'firebird', 'prokopovych', 'folijet', 'vega', 'core_platform'] + teams_channels = [spitfire: '#spitfire', bama: '#bama', firebird: '#firebird', folijet: '#folijet-test', + prokopovych: '#prokopovych', vega: '#vega', core_platform: '#core-platform'] + + // Build status of null means success. + buildStatus = buildStatus ?: 'SUCCESS' + def msg = "${buildStatus}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}" + + //slackSend(color: color, message: msg, channel: '#api-integration-testing') + for (team in teams_test) { + def tests_status = readFile "${env.WORKSPACE}/folio-integration-tests/cucumber-reports/${team}/status.txt" + def failed_mod = readFile "${env.WORKSPACE}/folio-integration-tests/cucumber-reports/${team}/failed.txt" def color - if (buildStatus == 'STARTED') { + def team_msg + if (tests_status == 'STARTED') { color = '#D4DADF' - } else if (buildStatus == 'SUCCESS') { + } else if (tests_status == 'SUCCESS') { color = '#BDFFC3' - } else if (buildStatus == 'UNSTABLE') { + } else if (tests_status == 'UNSTABLE') { color = '#FFFE89' } else { - color = '#FF9FA1' + color = '#FF9FA1' } - def msg = "${buildStatus}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}" - slackSend(color: color, message: msg, channel: '#api-integration-testing') + if (tests_status == 'FAILED'){ + team_msg = "${tests_status}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}\n Failed:\n${failed_mod}" + } else { + team_msg = "${tests_status}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}" + } + slackSend(color: color, message: team_msg, channel: "#karate-tests-reports-${team}") + slackSend(color: color, message: team_msg, channel: "${teams_channels[team]}") + } } return this