Skip to content

Commit

Permalink
improves script
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsolr committed Oct 9, 2019
1 parent 2db2638 commit 6f7e4ba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile-Agent-Test
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pipeline {

stage('Compile plugin-test tools Codes') {
steps {
sh './mvnw -f test/plugin/pom.xml -Pagent clean package -DskipTests -Dbuild_id=${BUILD_ID} docker:build'
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=${BUILD_ID} docker:build'
}
}

Expand Down
32 changes: 25 additions & 7 deletions test/plugin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,43 @@
# limitations under the License.

home="$(cd "$(dirname $0)"; pwd)"
scenario_name="empty"
scenario_name=""
parallel_run_size=1
force_build="off"
build_id="latest"


mvnw=${home}/../../mvnw
agent_home=${home}"/../../skywalking-agent"
scenarios_home="${home}/scenarios"

_positionals=()

print_help() {
echo "Usage: run.sh [OPTION] SCENARIO [SCENARIO]"
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"
}

parse_commandline() {
_positionals_count=0
while test $# -gt 0
do
_key="$1"
case "$_key" in
-f|--force_build)
force_build="on"
shift
;;
--build_id)
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
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 && die "Missing value for the optional argument '$_key'." 1
test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'."
parallel_run_size="$2"
shift
;;
Expand Down Expand Up @@ -93,9 +104,15 @@ waitForAvailable() {
exitAndClean 1
fi
}
parse_commandline "$@"

start_stamp=`date +%s` ### start
parse_commandline "$@"

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

workspace="${home}/workspace/${scenario_name}"
task_state_house="${workspace}/.states"
Expand All @@ -104,7 +121,8 @@ mkdir -p ${task_state_house}

plugin_autotest_helper="${home}/dist/plugin-autotest-helper.jar"
if [[ ! -f ${plugin_autotest_helper} ]]; then
exitWithMessage "plugin autotest helper not exist!"
exitWithMessage "Plugin autotest tools not exists, Please re-try it with '-f'"
print_helper
fi

echo "start submit job"
Expand Down

0 comments on commit 6f7e4ba

Please sign in to comment.