[input] Error: Unknown repo: 'powertools'
[output] unknown-repo.powertools: 1
Signed-off-by: Bai Jing 799286817@qq.com --- stats/openeuler_docker | 8 +++++++- tests/openeuler_docker | 43 +++++++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/stats/openeuler_docker b/stats/openeuler_docker index f85c9ca63..4c65c6bb3 100755 --- a/stats/openeuler_docker +++ b/stats/openeuler_docker @@ -6,12 +6,18 @@ sys_set = Set[]
while (line = STDIN.gets) case line.chomp! - # Error: Unable to find a match: docker-registry + # Error: Unable to find a match: docker-registry mock xx when /Error: Unable to find a match: (.+)/ $1.split.each do |repo| repo_set << repo end
+ # Error: Unknown repo: 'powertools' + when /Error: Unknown repo: (.+)/ + repo = $1.delete!("'") + puts "unknown-repo.#{repo}: 1" + puts "unknown-repo.#{repo}.message: #{line}" + # /bin/sh: passwd: command not found when //bin/sh: (.+): command not found/ puts "sh.command-not-found.#{$1}: 1" diff --git a/tests/openeuler_docker b/tests/openeuler_docker index b77b890a9..5270bde6e 100755 --- a/tests/openeuler_docker +++ b/tests/openeuler_docker @@ -13,7 +13,7 @@
cd $BENCHMARK_ROOT
-centos_one_ok=false +nr_openeuler_fail=0
fit_repo() { @@ -21,7 +21,7 @@ fit_repo() git clone "$dockerfile_url" || exit 0 file_dir=$(find ./ -type f -name "*Dockerfile*" | xargs grep -HE '^FROM centos:(centos|)[78]') [ -n "$file_dir" ] || { - echo "current-repo not support centos" + echo "current-repo-not-support-centos: 1" exit 0 } } @@ -42,21 +42,23 @@ centos_docker() [ -n "$image" ] || image=${file#*/}_$i if [ -f "$file_dir/build.sh" ] && [ -x "$file_dir/build.sh" ]; then "$file_dir/build.sh" > /dev/null 2> /dev/null && { - centos_one_ok=true handle_dockerfile } else docker_build > /dev/null 2> /dev/null && { - centos_one_ok=true handle_dockerfile } fi let i++ done - [ "$centos_one_ok" == "false" ] && { - echo "centos all failed" + if [ "$nr_openeuler_fail" != 0 ]; then + echo "openeuler failed times: $nr_openeuler_fail" + echo "openeuler_valid_url: $dockerfile_url" + exit 1 + else + echo "current-repo-not-support-centos: 1" exit 0 - } + fi }
handle_FROM() @@ -81,19 +83,18 @@ handle_epelrpm() } }
-handle_groupadd() +add_base_commands() { - grep -qw "groupadd*" "$file" && { - sed -i '/groupadd*/i\ yum -y install shadow && \' "$file" - } + # grep -qw "groupadd*" "$file" && { + # fix missing useradd, groupadd, chpasswd, etc. commands + sed -i '/FROM /a\RUN yum -y install shadow tar' "$file" + # }
}
handle_epel_repo() { - grep -qwE '.* wget .*(epel|CentOS-Base).repo' "$file" && { - sed 's|^|#|g' "$file" - } + sed -i '/.* wget .*(epel|CentOS-Base).repo/ s|^|#|g' "$file" }
handle_dockerfile() @@ -101,15 +102,18 @@ handle_dockerfile() flag=1 handle_FROM handle_epel - handle_groupadd - docker_build "-openeuler" - [ $? -ne 0 ] || docker_run "-openeuler" + add_base_commands + if docker_build "-openeuler"; then + docker_run "-openeuler" + else + let nr_openeuler_fail++ + fi }
docker_build() { docker build -f "$file" -t "${image}$1" . - [ $? -ne 0 ] && { + [ $? != 0 ] && { [ "$flag" == "1" ] && echo "${image}$1.build.fail: 1" return 1 } @@ -120,7 +124,8 @@ docker_build() docker_run() { docker run -d --name "${image}" "${image}$1" - docker_stats=$(docker inspect ${image} | grep Running | awk -F ' ' '{print $2}' | tr -d ',') + wait + docker_stats=$(docker inspect -f '{{.State.Running}}' ${image}) [ $docker_stats == false ] && { echo "${image}.run.fail: 1" return 1