diff --git a/Jenkinsfile-Agent-Test b/Jenkinsfile-Agent-Test index e3f11f1ba..7998811b7 100755 --- a/Jenkinsfile-Agent-Test +++ b/Jenkinsfile-Agent-Test @@ -32,6 +32,7 @@ pipeline { } environment { + BUILD_NO="wl1_${BUILD_ID}" MAVEN_OPTS = '-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g' } @@ -63,12 +64,12 @@ pipeline { } } steps { - sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl1_${BUILD_ID} docker:build' + sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build' } } stage('Test Cases Report (169)') { steps { - echo "reserve." + echo "Test Cases Report" } } @@ -83,36 +84,36 @@ pipeline { stages { stage('httpasyncclient 4.0-4.1.3 (7)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} httpasyncclient-scenario' + sh 'bash test/plugin/run.sh httpasyncclient-scenario' } } stage('httpclient 4.3.x-4.5.x (14)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} httpclient-4.3.x-scenario' + sh 'bash test/plugin/run.sh httpclient-4.3.x-scenario' } } stage('ehcache 2.8.x-2.10.x (19)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} ehcache-2.x-scenario' + sh 'bash test/plugin/run.sh ehcache-2.x-scenario' } } stage('dubbo 2.7.x (4)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} dubbo-2.7.x-scenario' + sh 'bash test/plugin/run.sh dubbo-2.7.x-scenario' } } stage('spring async 4.3.x-5.1.x (35)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} spring-async-scenario' + sh 'bash test/plugin/run.sh spring-async-scenario' } } stage('netty-socketio 1.x (4)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} netty-socketio-scenario' + sh 'bash test/plugin/run.sh netty-socketio-scenario' } } } @@ -121,12 +122,12 @@ pipeline { stages { stage('jetty 9.x (63)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} jetty-scenario' + sh 'bash test/plugin/run.sh jetty-scenario' } } stage('undertow-routing-scenario 1.3.0-2.0.27 (23)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} undertow-routing-scenario' + sh 'bash test/plugin/run.sh undertow-routing-scenario' } } } @@ -137,7 +138,7 @@ pipeline { post { cleanup { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} --cleanup' + sh 'bash test/plugin/run.sh --cleanup' deleteDir() } } diff --git a/Jenkinsfile-Agent-Test-2 b/Jenkinsfile-Agent-Test-2 index 07ddf6533..2a51eebcd 100755 --- a/Jenkinsfile-Agent-Test-2 +++ b/Jenkinsfile-Agent-Test-2 @@ -32,6 +32,7 @@ pipeline { } environment { + BUILD_NO="wl2_${BUILD_ID}" MAVEN_OPTS = '-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g' } @@ -63,12 +64,12 @@ pipeline { } } steps { - sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl2_${BUILD_ID} docker:build' + sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build' } } stage('Test Cases Report (175)') { steps { - echo "reserve." + echo "Test Cases Report" } } @@ -83,43 +84,43 @@ pipeline { stages { stage('spring-cloud-gateway 2.1.x (3)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} gateway-scenario' + sh 'bash test/plugin/run.sh gateway-scenario' } } stage('spring-webflux 2.x (18)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} webflux-scenario' + sh 'bash test/plugin/run.sh webflux-scenario' } } stage('dubbo 2.5.x-2.6.x (10)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} dubbo-2.5.x-scenario' + sh 'bash test/plugin/run.sh dubbo-2.5.x-scenario' } } stage('spring 3.0.x (8)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} spring-3.0.x-scenario' + sh 'bash test/plugin/run.sh spring-3.0.x-scenario' } } stage('spring 3.1.x-4.0.x (25)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} spring-3.1.x-scenario' + sh 'bash test/plugin/run.sh spring-3.1.x-scenario' } } stage('spring 4.1.x-4.2.x (20)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} spring-4.1.x-scenario' + sh 'bash test/plugin/run.sh spring-4.1.x-scenario' } } stage('apm-toolkit-trace (1)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} apm-toolkit-trace-scenario' + sh 'bash test/plugin/run.sh apm-toolkit-trace-scenario' } } } @@ -128,24 +129,24 @@ pipeline { stages { stage('solrj 7.x (12)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} solrj-7.x-scenario' + sh 'bash test/plugin/run.sh solrj-7.x-scenario' } } stage('spring 4.3.x-5.2.x (54)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} spring-4.3.x-scenario' + sh 'bash test/plugin/run.sh spring-4.3.x-scenario' } } stage('undertow-scenario 1.3.0-2.0.27 (23)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} undertow-scenario' + sh 'bash test/plugin/run.sh undertow-scenario' } } stage('customize-scenario (1)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} customize-scenario' + sh 'bash test/plugin/run.sh customize-scenario' } } } @@ -156,7 +157,7 @@ pipeline { post { cleanup { - sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} --cleanup' + sh 'bash test/plugin/run.sh --cleanup' deleteDir() } } diff --git a/Jenkinsfile-Agent-Test-3 b/Jenkinsfile-Agent-Test-3 index db8467983..a171cc250 100755 --- a/Jenkinsfile-Agent-Test-3 +++ b/Jenkinsfile-Agent-Test-3 @@ -32,6 +32,7 @@ pipeline { } environment { + BUILD_NO="wl3_${BUILD_ID}" MAVEN_OPTS = '-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g' } @@ -63,7 +64,7 @@ pipeline { } } steps { - sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl3_${BUILD_ID} docker:build' + sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build' } } stage('Test Cases Report (149)') { @@ -83,27 +84,27 @@ pipeline { stages { stage('kafka 0.11.0.0-2.3.0 (16)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} kafka-scenario' + sh 'bash test/plugin/run.sh kafka-scenario' } } stage('canal 1.0.24-1.1.2 (5)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} canal-scenario' + sh 'bash test/plugin/run.sh canal-scenario' } } stage('sofarpc 5.4.0-5.6.2 (23)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} sofarpc-scenario' + sh 'bash test/plugin/run.sh sofarpc-scenario' } } stage('mongodb 3.4.0-3.11.1 (17)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} mongodb-3.x-scenario' + sh 'bash test/plugin/run.sh mongodb-3.x-scenario' } } stage('elasticsearch 5.x (3)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} elasticsearch-5.x-scenario' + sh 'bash test/plugin/run.sh elasticsearch-5.x-scenario' } } } @@ -112,12 +113,12 @@ pipeline { stages { stage('postgresql 9.2.x-9.4.x (36)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} postgresql-scenario' + sh 'bash test/plugin/run.sh postgresql-scenario' } } stage('postgresql-9.4.1207+ (49)') { steps { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} postgresql-above9.4.1207-scenario' + sh 'bash test/plugin/run.sh postgresql-above9.4.1207-scenario' } } } @@ -128,7 +129,7 @@ pipeline { post { cleanup { - sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} --cleanup' + sh 'bash test/plugin/run.sh --cleanup' deleteDir() } } diff --git a/test/plugin/containers/pom.xml b/test/plugin/containers/pom.xml index de3a598ee..7bb70796a 100644 --- a/test/plugin/containers/pom.xml +++ b/test/plugin/containers/pom.xml @@ -46,7 +46,7 @@ docker-maven-plugin ${docker-maven-plugin.version} - ${build_id} + ${BUILD_NO} skywalking/${project.name} ${project.basedir}/docker ${skip.docker} diff --git a/test/plugin/run.sh b/test/plugin/run.sh index 3ed198c3e..377d615b2 100644 --- a/test/plugin/run.sh +++ b/test/plugin/run.sh @@ -20,7 +20,6 @@ home="$(cd "$(dirname $0)"; pwd)" scenario_name="" parallel_run_size=1 force_build="off" -build_id="local" cleanup="off" mvnw=${home}/../../mvnw @@ -30,7 +29,6 @@ scenarios_home="${home}/scenarios" print_help() { echo "Usage: run.sh [OPTION] SCENARIO_NAME" echo -e "\t-f, --force_build \t\t do force to build Plugin-Test tools and images" - echo -e "\t--build_id, \t\t\t specify Plugin_Test's image tag. Defalt: latest" echo -e "\t--parallel_run_size, \t\t parallel size of test cases. Default: 1" echo -e "\t--cleanup, \t\t\t remove the related images and directories" } @@ -47,14 +45,6 @@ parse_commandline() { --cleanup) cleanup="on" ;; - --build_id) - test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'." - build_id="$2" - shift - ;; - --build_id=*) - build_id="${_key##--build_id=}" - ;; --parallel_run_size) test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'." parallel_run_size="$2" @@ -105,7 +95,7 @@ waitForAvailable() { } do_cleanup() { - images=$(docker images -q "skywalking/agent-test-*:${build_id}") + images=$(docker images -q "skywalking/agent-test-*:${BUILD_NO:=local}") [[ -n "${images}" ]] && docker rmi -f ${images} images=$(docker images -qf "dangling=true") [[ -n "${images}" ]] && docker rmi -f ${images} @@ -146,7 +136,7 @@ parse_commandline "$@" if [[ "$cleanup" == "on" ]]; then do_cleanup - exit 0 + [[ -z "${scenario_name}" ]] && exit 0 fi test -z "$scenario_name" && exitWithMessage "Missing value for the scenario argument" @@ -155,7 +145,7 @@ if [[ ! -d ${agent_home} ]]; then echo "[WARN] SkyWalking Agent not exists" ${mvnw} -f ${home}/../../pom.xml -Pagent -DskipTests clean package fi -[[ "$force_build" == "on" ]] && ${mvnw} -f ${home}/pom.xml clean package -DskipTests -Dbuild_id=${build_id} docker:build +[[ "$force_build" == "on" ]] && ${mvnw} -f ${home}/pom.xml clean package -DskipTests docker:build workspace="${home}/workspace/${scenario_name}" task_state_house="${workspace}/.states" @@ -215,7 +205,7 @@ do -Dscenario.version=${version} \ -Doutput.dir=${case_work_base} \ -Dagent.dir=${_agent_home} \ - -Ddocker.image.version=${build_id} \ + -Ddocker.image.version=${BUILD_NO:=local} \ ${plugin_runner_helper} 1>${case_work_logs_dir}/helper.log [[ $? -ne 0 ]] && exitWithMessage "${testcase_name}, generate script failure!" diff --git a/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java index 915236b56..c454313bd 100644 --- a/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java +++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java @@ -116,7 +116,7 @@ public class ConfigurationImpl implements IConfiguration { @Override public String dockerContainerName() { - return scenarioName() + "-" + scenarioVersion() + "-" + dockerImageVersion(); + return (scenarioName() + "-" + scenarioVersion() + "-" + dockerImageVersion()).toLowerCase(); } @Override public String scenarioHome() { diff --git a/test/plugin/runner-helper/src/main/resources/compose-start-script.template b/test/plugin/runner-helper/src/main/resources/compose-start-script.template index d12cbfd2d..313222b10 100644 --- a/test/plugin/runner-helper/src/main/resources/compose-start-script.template +++ b/test/plugin/runner-helper/src/main/resources/compose-start-script.template @@ -16,7 +16,7 @@ --> compose_file="${docker_compose_file}" -project_name="${build_id}" +project_name=$(echo "${build_id}" |awk '{print tolower($0)}') docker_container_name="${docker_container_name}_1" <#noparse> diff --git a/test/plugin/runner-helper/src/main/resources/docker-compose.template b/test/plugin/runner-helper/src/main/resources/docker-compose.template index c1e1029a8..03dad2b6d 100644 --- a/test/plugin/runner-helper/src/main/resources/docker-compose.template +++ b/test/plugin/runner-helper/src/main/resources/docker-compose.template @@ -17,7 +17,7 @@ version: '2.1' services: ${docker_container_name}: - image: ${docker_image_name}:latest + image: ${docker_image_name}:${docker_image_version} <#if hostname??> hostname: ${hostname}