[why] ./git--github.com-peternav-myrepo.git/z9.2062565/dockerfile:from_openeuler_1 => ./git--github.com-peternav-myrepo.git/z9.2062565/peternav-myrepo_1
Signed-off-by: Liu Shaofei 370072077@qq.com --- tests/openeuler_docker | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tests/openeuler_docker b/tests/openeuler_docker index 3ea57e2c9..906d6c88c 100755 --- a/tests/openeuler_docker +++ b/tests/openeuler_docker @@ -19,8 +19,10 @@ declare -i dockerfile_count=0 fit_repo() { yum reinstall -y git - git clone "$dockerfile_url" "$BENCHMARK_ROOT/src/" - dockerfile_path="$(find "$BENCHMARK_ROOT/src/" -type f -name "*Dockerfile*" | xargs grep -HE '^FROM centos:(centos|)[78]')" + project_name="${dockerfile_url##*/}" + project_name="${project_name%.git}" + git clone "$dockerfile_url" "$BENCHMARK_ROOT/{project_name}/" + dockerfile_path="$(find "$BENCHMARK_ROOT/{project_name}/" -type f -name "*Dockerfile*" | xargs grep -HE '^FROM centos:(centos|)[78]')" dockerfile_count=$(( $(echo $dockerfile_path | awk '{print NF}') / 2 )) [ -n "$dockerfile_path" ] || { echo "current-repo-not-support-centos: 1" @@ -45,7 +47,7 @@ build_centos()
build_openeuler() { - docker build -f "$dockerfile_name" -t "${image}_$1_$index" . >> $TMP_RESULT_ROOT/${image}_$1_$index 2>&1 + docker build -f "$dockerfile_name" -t "${image}_$1_$index" . >> $TMP_RESULT_ROOT/${image}_$index 2>&1 [ $? != 0 ] && { let nr_openeuler_fail++ echo "${image}_$index.build.fail: 1" @@ -60,7 +62,7 @@ docker_run() { docker_run_cmd="docker run -d --name ${image}_$1_$index ${image}_$1_$index" [ $1 == "openeuler" ] && { - docker_run_cmd="${docker_run_cmd} >> $TMP_RESULT_ROOT/${image}_$1_$index 2>&1" + docker_run_cmd="${docker_run_cmd} >> $TMP_RESULT_ROOT/${image}_$index 2>&1" }
eval $docker_run_cmd @@ -84,6 +86,9 @@ handle_build_result() elif [ "$nr_openeuler_success" == "$dockerfile_count" ]; then echo "openeuler_valid_url: $dockerfile_url" exit 0 + else + echo "Build CentOS images failed." + exit 0 fi }
@@ -91,7 +96,7 @@ build() { dockerfile_name="${file##*/}" dockerfile_name="${dockerfile_name%:*}" - image=$(echo "$file" | awk -F '/' '{print $5}' | tr 'A-Z' 'a-z') + image=$(echo "$file" | awk -F '/' '$5~/Dockerfile/ {print $4} $5!~/Dockerfile/ {print $5}' | tr 'A-Z' 'a-z')
build_centos "centos" > /dev/null 2>&1 || return 1 handle_dockerfile "$dockerfile_name"