<HTML><BODY><div>Hi Sergey, thanks for the review, I’ve added shell-checker flag and fixed found warnings.<br><br> <blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Понедельник, 23 марта 2020, 12:04 +03:00 от Sergey Bronnikov <sergeyb@tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><style type="text/css"></style><div><div id="style_15849542650039088756_BODY">Hello,<br><br>I propose to check script tools/check_package.sh with shellcheck.<br>Right now it reports a number of warnings.<br><br>Sergey<br><br>On 10:20 Mon 23 Mar , Alexander V. Tikhonov wrote:<div class="mail-quote-collapse">> Created Dockerfile based script to check packages available at the S3<br>> repository. Set this script to be run just after the package creation.<br>><br>> Follows up #3380<br>> ---<br>><br>> Github: <a href="https://github.com/tarantool/tarantool/tree/avtikhon/gh-3380-check-packages-s3-full-ci" target="_blank">https://github.com/tarantool/tarantool/tree/avtikhon/gh-3380-check-packages-s3-full-ci</a><br>> Issue: <a href="https://github.com/tarantool/tarantool/issues/3380" target="_blank">https://github.com/tarantool/tarantool/issues/3380</a><br>> Gitlab: <a href="https://gitlab.com/tarantool/tarantool/pipelines/128701075" target="_blank">https://gitlab.com/tarantool/tarantool/pipelines/128701075</a><br>><br>> .gitlab.mk | 1 +<br>> tools/Dockerfile.s3 | 23 +++++++++++++++++<br>> tools/check_package.sh | 57 ++++++++++++++++++++++++++++++++++++++++++<br>> 3 files changed, 81 insertions(+)<br>> create mode 100644 tools/Dockerfile.s3<br>> create mode 100755 tools/check_package.sh<br>><br>> diff --git a/.gitlab.mk b/.gitlab.mk<br>> index b39c5c651..5053b914f 100644<br>> --- a/.gitlab.mk<br>> +++ b/.gitlab.mk<br>> @@ -127,6 +127,7 @@ deploy: package<br>> echo ${GPG_SECRET_KEY} | base64 -d | gpg --batch --import || true<br>> ./tools/update_repo.sh -o=${OS} -d=${DIST} \<br>> -b="${LIVE_REPO_S3_DIR}/${BUCKET}" build<br>> + ./tools/check_package.sh "" ${OS}:${DIST} ${BUCKET}<br>> if git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null ; then \<br>> ./tools/update_repo.sh -o=${OS} -d=${DIST} \<br>> -b="${RELEASE_REPO_S3_DIR}/${BUCKET}" build ; \<br>> diff --git a/tools/Dockerfile.s3 b/tools/Dockerfile.s3<br>> new file mode 100644<br>> index 000000000..338cf6926<br>> --- /dev/null<br>> +++ b/tools/Dockerfile.s3<br>> @@ -0,0 +1,23 @@<br>> +ARG IMG<br>> +FROM ${IMG}<br>> +<br>> +ARG PKG_TOOL<br>> +RUN ${PKG_TOOL} update -y >1.log 2>&1 || ( cat 1.log && false )<br>> +RUN ${PKG_TOOL} install -y curl >2.log 2>&1 || ( cat 2.log && false )<br>> +<br>> +RUN curl -L <a href="https://tarantool.io/installer.sh" target="_blank">https://tarantool.io/installer.sh</a> >installer.sh 2>3.log || ( cat 3.log && false )<br>> +RUN chmod a+x installer.sh<br>> +RUN sed "s#/bin/bash#/bin/bash -x#g" -i installer.sh<br>> +<br>> +# ./installer.sh is the external tool which return status is not<br>> +# expectable and can be false because of its additional features,<br>> +# all that is needed for us from the script just to install Tarantool,<br>> +# NOTE: found that on centos:8 script fails but on rerun passes<br>> +ARG REL<br>> +RUN VER=${REL} ./installer.sh >4.log 2>&1 || ( VER=${REL} ./installer.sh >>4.log 2>&1 || ( cat 4.log && false ))<br>> +ARG TNT_VER<br>> +RUN CVER=$(tarantool -V | head -n 1 | awk '{print $2}' | sed 's#-#.#g') && \<br>> + echo "Tarantool version:" && \<br>> + echo "Expected: ${TNT_VER}" && \<br>> + echo "Returned: ${CVER}" && \<br>> + if ! echo "${CVER}" | grep -e "^${TNT_VER}" >/dev/null ; then false ; fi<br>> diff --git a/tools/check_package.sh b/tools/check_package.sh<br>> new file mode 100755<br>> index 000000000..b3fdcdcda<br>> --- /dev/null<br>> +++ b/tools/check_package.sh<br>> @@ -0,0 +1,57 @@<br>> +#!/bin/bash<br>> +set -e<br>> +<br>> +ver="$1"<br>> +imgs="$2"<br>> +rels="$3"<br>> +<br>> +if [ "$ver" == "" ]; then<br>> + # some OS like CentOS/Fedora use only 6 hexadecimal<br>> + # digits as the abbreviated object name<br>> + ver=$(git describe --abbrev=6 | sed 's#-#.#g')<br>> +fi<br>> +<br>> +if [ "$imgs" == "" ]; then<br>> + for dist in 14.04 16.04 18.04 19.04 19.10 ; do imgs="$imgs ubuntu:$dist" ; done<br>> + for dist in jessie stretch buster ; do imgs="$imgs debian:$dist" ; done<br>> + for dist in 6 7 8 ; do imgs="$imgs centos:$dist" ; done<br>> + for dist in 28 29 30 31 ; do imgs="$imgs fedora:$dist" ; done<br>> +fi<br>> +<br>> +imgs=$(echo $imgs | sed "s#el:#centos:#g")<br>> +<br>> +if [ "$rels" == "" ]; then<br>> + rels="1.10 2.1 2.2 2.3 2.4"<br>> +fi<br>> +<br>> +cwd=`dirname $0`<br>> +<br>> +run_docker () {<br>> + VER=$1<br>> + IMG=$2<br>> + REL=$3<br>> +<br>> + PKG_TOOL=yum<br>> + if [[ $IMG =~ .*ubuntu.* || $IMG =~ .*debian.* ]]; then<br>> + PKG_TOOL=apt<br>> + fi<br>> + echo "Testing $REL Tarantool on $IMG image ..."<br>> + newimg="check-s3_"`echo $IMG | sed 's#:#-#g'`"_$REL"<br>> + # repository update command must always be rerun to be able<br>> + # to get the new available versions of the Tarantool, so the<br>> + # flag "--no-cache" must be set<br>> + docker build \<br>> + --network=host \<br>> + --no-cache \<br>> + --build-arg PKG_TOOL=$PKG_TOOL \<br>> + --build-arg REL=$REL \<br>> + --build-arg IMG=$IMG \<br>> + --build-arg TNT_VER=$VER \<br>> + -f $cwd/Dockerfile.s3 -t $newimg .<br>> +}<br>> +<br>> +for rel in $rels ; do<br>> + for img in $imgs ; do<br>> + run_docker $ver $img $rel<br>> + done<br>> +done<br>> --<br>> 2.17.1<br>></div><br>--<br>sergeyb@</div></div></div></div></blockquote> <div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Alexander Tikhonov</div></div></div><div> </div></div></BODY></HTML>