From 67b1571fce7043baa4485f8df95b7d5e89d1b2c3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 7 Feb 2020 11:42:09 +0100 Subject: [PATCH 001/200] Restructure Dockerfiles --- libs/ecvl-toolkit.Dockerfile | 34 +++++++++ libs/ecvl.Dockerfile | 42 +++++++++++ libs/eddl-toolkit.Dockerfile | 31 ++++++++ libs/eddl.Dockerfile | 42 +++++++++++ ...ockerfile => libs-base-toolkit.Dockerfile} | 51 +------------ libs/libs-base.Dockerfile | 29 ++++++++ libs/libs-toolkit.Dockerfile | 7 ++ libs/libs.Dockerfile | 7 ++ libs/runtime.Dockerfile | 73 ------------------- ...p.Dockerfile => pyecvl-toolkit.Dockerfile} | 27 +------ pylibs/pyecvl.Dockerfile | 27 +++++++ pylibs/pyeddl-toolkit.Dockerfile | 26 +++++++ pylibs/pyeddl.Dockerfile | 27 +++++++ pylibs/pylibs-base-toolkit.Dockerfile | 15 ++++ pylibs/pylibs-base.Dockerfile | 16 ++++ pylibs/pylibs-toolkit.Dockerfile | 7 ++ pylibs/pylibs.Dockerfile | 8 ++ pylibs/runtime.Dockerfile | 40 ---------- 18 files changed, 324 insertions(+), 185 deletions(-) create mode 100644 libs/ecvl-toolkit.Dockerfile create mode 100644 libs/ecvl.Dockerfile create mode 100644 libs/eddl-toolkit.Dockerfile create mode 100644 libs/eddl.Dockerfile rename libs/{develop.Dockerfile => libs-base-toolkit.Dockerfile} (55%) create mode 100644 libs/libs-base.Dockerfile create mode 100644 libs/libs-toolkit.Dockerfile create mode 100644 libs/libs.Dockerfile delete mode 100644 libs/runtime.Dockerfile rename pylibs/{develop.Dockerfile => pyecvl-toolkit.Dockerfile} (54%) create mode 100644 pylibs/pyecvl.Dockerfile create mode 100644 pylibs/pyeddl-toolkit.Dockerfile create mode 100644 pylibs/pyeddl.Dockerfile create mode 100644 pylibs/pylibs-base-toolkit.Dockerfile create mode 100644 pylibs/pylibs-base.Dockerfile create mode 100644 pylibs/pylibs-toolkit.Dockerfile create mode 100644 pylibs/pylibs.Dockerfile delete mode 100644 pylibs/runtime.Dockerfile diff --git a/libs/ecvl-toolkit.Dockerfile b/libs/ecvl-toolkit.Dockerfile new file mode 100644 index 0000000..e55d8bc --- /dev/null +++ b/libs/ecvl-toolkit.Dockerfile @@ -0,0 +1,34 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} AS libs.ecvl-toolkit + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-ecvl" + +# set arguments +ARG ecvl_src_origin="ecvl" +ARG ecvl_src_target="/usr/local/src/ecvl" + +# expose lib source paths on environment +ENV ECVL_SRC ${ecvl_src_target} + +# copy libraries +COPY ${ecvl_src_origin} ${ECVL_SRC} + +# Build and install ECVL library +RUN echo "\nBuilding ECVL library..." >&2 \ + && cd ${ECVL_SRC} \ + && mkdir build \ + && cd build \ + && cmake \ + -D ECVL_BUILD_GUI=OFF \ + -D ECVL_WITH_OPENSLIDE=ON \ + -D ECVL_DATASET_PARSER=ON \ + -D ECVL_WITH_DICOM=ON \ + -D ECVL_BUILD_EDDL=ON \ + -D EDDL_DIR=${EDDL_SRC}/build/install \ + .. \ + && make -j$(grep -c ^processor /proc/cpuinfo) \ + && echo "\n Installing ECVL library..." >&2 \ + && make install diff --git a/libs/ecvl.Dockerfile b/libs/ecvl.Dockerfile new file mode 100644 index 0000000..d0f5f7d --- /dev/null +++ b/libs/ecvl.Dockerfile @@ -0,0 +1,42 @@ +ARG BASE_IMAGE +ARG TOOLKIT_IMAGE + +# Declare Toolkit image +FROM ${TOOLKIT_IMAGE} AS toolkit + +############################ +#### INTERMEDIATE Stage #### +############################ +FROM ${BASE_IMAGE} AS prepare_install + +# set arguments +ARG ecvl_src_origin="ecvl" +ARG ecvl_src_target="/usr/local/src/ecvl" + +# make a temporary copy of libraries +COPY --from=toolkit /usr/local/etc /tmp/local/etc +COPY --from=toolkit /usr/local/include /tmp/local/include +COPY --from=toolkit /usr/local/lib /tmp/local/lib +COPY --from=toolkit /usr/local/share /tmp/local/share +COPY --from=toolkit /usr/local/src/ecvl/build/install_manifest.txt /tmp/local/install_manifest.txt + + +# merge existing system directories with those containing libraries +RUN sed -e 's+/usr/local/++g' install_manifest.txt | \ + while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done + +###################### +#### TARGET Stage #### +###################### +FROM ${BASE_IMAGE} AS libs.ecvl + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-ecvl" + +# copy libraries to the target paths +COPY --from=prepare_install /usr/local/etc /usr/local/etc +COPY --from=prepare_install /usr/local/include /usr/local/include +COPY --from=prepare_install /usr/local/lib /usr/local/lib +COPY --from=prepare_install /usr/local/share /usr/local/share \ No newline at end of file diff --git a/libs/eddl-toolkit.Dockerfile b/libs/eddl-toolkit.Dockerfile new file mode 100644 index 0000000..5421285 --- /dev/null +++ b/libs/eddl-toolkit.Dockerfile @@ -0,0 +1,31 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} AS libs.eddl-toolkit + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl" + +# set arguments +ARG eddl_src_origin="eddl" +ARG eddl_src_target="/usr/local/src/eddl" + +# expose lib source paths on environment +ENV EDDL_SRC ${eddl_src_target} + +# copy libraries +COPY ${eddl_src_origin} ${EDDL_SRC} + +# Build and install EDDL library +RUN echo "\nBuilding EDDL library..." >&2 \ + && cd ${EDDL_SRC} \ + && mkdir build \ + && cd build \ + && cmake \ + -D BUILD_TARGET=GPU \ + -D BUILD_TESTS=ON \ + -D EDDL_SHARED=ON \ + .. \ + && make -j$(grep -c ^processor /proc/cpuinfo) \ + && echo "\n Installing EDDL library..." >&2 \ + && make install \ No newline at end of file diff --git a/libs/eddl.Dockerfile b/libs/eddl.Dockerfile new file mode 100644 index 0000000..50011d4 --- /dev/null +++ b/libs/eddl.Dockerfile @@ -0,0 +1,42 @@ +ARG BASE_IMAGE +ARG TOOLKIT_IMAGE + +# Declare Toolkit image +FROM ${TOOLKIT_IMAGE} AS toolkit + +############################ +#### INTERMEDIATE Stage #### +############################ +FROM ${BASE_IMAGE} AS prepare_install + +# set arguments +ARG eddl_src_origin="eddl" +ARG eddl_src_target="/usr/local/src/eddl" + +# make a temporary copy of libraries +COPY --from=toolkit /usr/local/etc /tmp/local/etc +COPY --from=toolkit /usr/local/include /tmp/local/include +COPY --from=toolkit /usr/local/lib /tmp/local/lib +COPY --from=toolkit /usr/local/share /tmp/local/share +#COPY --from=toolkit /usr/local/src/ecvl/build/install_manifest.txt /tmp/local/ecvl_manifest.txt +COPY --from=toolkit /usr/local/src/eddl/build/install_manifest.txt /tmp/local/install_manifest.txt + +# merge existing system directories with those containing libraries +RUN sed -e 's+/usr/local/++g' install_manifest.txt | \ + while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done + +###################### +#### TARGET Stage #### +###################### +FROM ${BASE_IMAGE} AS libs.eddl + +# Set metadata +LABEL website="https://github.com/deephealthproject" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl" + +# copy libraries to the target paths +COPY --from=prepare_install /usr/local/etc /usr/local/etc +COPY --from=prepare_install /usr/local/include /usr/local/include +COPY --from=prepare_install /usr/local/lib /usr/local/lib +COPY --from=prepare_install /usr/local/share /usr/local/share \ No newline at end of file diff --git a/libs/develop.Dockerfile b/libs/libs-base-toolkit.Dockerfile similarity index 55% rename from libs/develop.Dockerfile rename to libs/libs-base-toolkit.Dockerfile index 83dff95..1539e86 100644 --- a/libs/develop.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -1,21 +1,12 @@ -FROM nvidia/cuda:10.1-devel +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as libs.base-toolkit # set metadata LABEL website="https://github.com/deephealthproject/" LABEL description="DeepHealth European Distributed Deep Learning Library" LABEL software="deephealth-eddl,deephealth-ecvl" - ARG cmake_release="3.14.6" -# set arguments -ARG eddl_src_origin="eddl" -ARG ecvl_src_origin="ecvl" -ARG eddl_src_target="/usr/local/src/eddl" -ARG ecvl_src_target="/usr/local/src/ecvl" - -# expose lib source paths on environment -ENV EDDL_SRC ${eddl_src_target} -ENV ECVL_SRC ${ecvl_src_target} # Install software requirements RUN \ @@ -42,40 +33,4 @@ RUN \ && mv cmake*/share/* /usr/local/share/ \ && chown root:root /usr/local/bin/* /usr/local/share/* \ && chmod a+rx /usr/local/bin/* \ - && rm -rf /tmp/cmake* - -# copy libraries -COPY ${ecvl_src_origin} ${ECVL_SRC} -COPY ${eddl_src_origin} ${EDDL_SRC} - -# Build and install EDDL library -RUN echo "\nBuilding EDDL library..." >&2 \ - && cd ${EDDL_SRC} \ - && mkdir build \ - && cd build \ - && cmake \ - -D BUILD_TARGET=GPU \ - -D BUILD_TESTS=ON \ - -D EDDL_SHARED=ON \ - .. \ - && make -j$(grep -c ^processor /proc/cpuinfo) \ - && echo "\n Installing EDDL library..." >&2 \ - && make install - -# Build and install ECVL library -RUN echo "\nBuilding ECVL library..." >&2 \ - && cd ${ECVL_SRC} \ - && mkdir build \ - && cd build \ - && cmake \ - -D ECVL_BUILD_GUI=OFF \ - -D ECVL_WITH_OPENSLIDE=ON \ - -D ECVL_DATASET_PARSER=ON \ - -D ECVL_WITH_DICOM=ON \ - -D ECVL_BUILD_EDDL=ON \ - -D ECVL_BUILD_EXAMPLES=ON \ - -D EDDL_DIR=${EDDL_SRC}/build/install \ - .. \ - && make -j$(grep -c ^processor /proc/cpuinfo) \ - && echo "\n Installing ECVL library..." >&2 \ - && make install + && rm -rf /tmp/cmake* \ No newline at end of file diff --git a/libs/libs-base.Dockerfile b/libs/libs-base.Dockerfile new file mode 100644 index 0000000..30524cb --- /dev/null +++ b/libs/libs-base.Dockerfile @@ -0,0 +1,29 @@ +ARG BASE_IMAGE +#################### +#### BASE image #### +#################### +FROM ${BASE_IMAGE} AS base + +LABEL website="https://github.com/deephealthproject" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl" + +RUN \ + echo "\nInstalling software requirements..." >&2 \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get update -y -q \ + && apt-get install -y --no-install-recommends \ + wget \ + rsync \ + libopencv-core-dev \ + libopencv-imgproc-dev \ + libopencv-imgcodecs-dev \ + libopenslide-dev \ + libgomp1 \ + && apt-get clean + +# create a temp directory +RUN mkdir /tmp/local + +# change working directory +WORKDIR /tmp/local \ No newline at end of file diff --git a/libs/libs-toolkit.Dockerfile b/libs/libs-toolkit.Dockerfile new file mode 100644 index 0000000..5d6dd38 --- /dev/null +++ b/libs/libs-toolkit.Dockerfile @@ -0,0 +1,7 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} AS libs-toolkit + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl" \ No newline at end of file diff --git a/libs/libs.Dockerfile b/libs/libs.Dockerfile new file mode 100644 index 0000000..538caae --- /dev/null +++ b/libs/libs.Dockerfile @@ -0,0 +1,7 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} AS libs + +# Set metadata +LABEL website="https://github.com/deephealthproject" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl" diff --git a/libs/runtime.Dockerfile b/libs/runtime.Dockerfile deleted file mode 100644 index 6d45a34..0000000 --- a/libs/runtime.Dockerfile +++ /dev/null @@ -1,73 +0,0 @@ -ARG BASE_IMAGE -FROM ${BASE_IMAGE} AS toolkit - -#################### -#### BASE image #### -#################### - -FROM nvidia/cuda:10.1-runtime AS base - -LABEL website="https://github.com/deephealthproject" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl" - - -RUN \ - echo "\nInstalling software requirements..." >&2 \ - && export DEBIAN_FRONTEND=noninteractive \ - && apt-get update -y -q \ - && apt-get install -y --no-install-recommends \ - wget \ - rsync \ - libopencv-core-dev \ - libopencv-imgproc-dev \ - libopencv-imgcodecs-dev \ - libopenslide-dev \ - libgomp1 \ - && apt-get clean - -# set arguments -ARG eddl_src_origin="eddl" -ARG ecvl_src_origin="ecvl" -ARG eddl_src_target="/usr/local/src/eddl" -ARG ecvl_src_target="/usr/local/src/ecvl" - -######################### -#### INTERMEDIATE Stage #### -######################### -FROM base as prepare_install - -# install missing rsync utility -RUN export DEBIAN_FRONTEND=noninteractive \ - && apt-get update -y -q \ - && apt-get install -y --no-install-recommends rsync \ - && apt-get clean - -# create a temp directory -RUN mkdir /tmp/local - -# make a temporary copy of libraries -COPY --from=toolkit /usr/local/etc /tmp/local/etc -COPY --from=toolkit /usr/local/include /tmp/local/include -COPY --from=toolkit /usr/local/lib /tmp/local/lib -COPY --from=toolkit /usr/local/share /tmp/local/share -COPY --from=toolkit /usr/local/src/ecvl/build/install_manifest.txt /tmp/local/ecvl_manifest.txt -COPY --from=toolkit /usr/local/src/eddl/build/install_manifest.txt /tmp/local/eddl_manifest.txt - -# change working directory -WORKDIR /tmp/local - -# merge existing system directories with those containing libraries -RUN sed -e 's+/usr/local/++' *_manifest.txt | \ - while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done - -###################### -#### TARGET Stage #### -###################### -FROM base - -# copy libraries to the target paths -COPY --from=prepare_install /usr/local/etc /usr/local/etc -COPY --from=prepare_install /usr/local/include /usr/local/include -COPY --from=prepare_install /usr/local/lib /usr/local/lib -COPY --from=prepare_install /usr/local/share /usr/local/share \ No newline at end of file diff --git a/pylibs/develop.Dockerfile b/pylibs/pyecvl-toolkit.Dockerfile similarity index 54% rename from pylibs/develop.Dockerfile rename to pylibs/pyecvl-toolkit.Dockerfile index 4f5b567..dbf9ef0 100644 --- a/pylibs/develop.Dockerfile +++ b/pylibs/pyecvl-toolkit.Dockerfile @@ -1,42 +1,21 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base - # set metadata LABEL website="https://github.com/deephealthproject/" LABEL description="DeepHealth European Distributed Deep Learning Library" LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" - -ARG eddl_src="/usr/local/src/eddl" +# set paths ARG ecvl_src="/usr/local/src/ecvl" - -ARG pyeddl_src_origin="pyeddl" ARG pyecvl_src_origin="pyecvl" ARG pyeddl_src_target="/usr/local/src/pyeddl" ARG pyecvl_src_target="/usr/local/src/pyecvl" # Run git submodule update [--init] --recursive first -COPY ${pyeddl_src_origin} ${pyeddl_src_target} COPY ${pyecvl_src_origin} ${pyecvl_src_target} -RUN \ - echo "\nInstalling software requirements..." >&2 \ - && apt-get -y update && apt-get -y install --no-install-recommends \ - python3-dev python3-pip \ - && apt-get clean \ - && python3 -m pip install --upgrade --no-cache-dir \ - setuptools pip numpy pybind11 pytest - -RUN \ - cd ${pyeddl_src_target} \ - && echo "\nLinking eddl library..." >&2 \ - && rm -r third_party/eddl \ - && ln -s ${eddl_src} third_party/ \ - && echo "\nInstalling pyeddl module..." >&2 \ - && python3 setup.py install \ - && rm -rf build/temp.* - +# build & install RUN \ cd ${pyecvl_src_target} \ && echo "\nLinking ecvl library..." >&2 \ @@ -45,5 +24,5 @@ RUN \ && ln -s ${ecvl_src} third_party/ecvl \ && ln -s ${pyeddl_src_target} third_party/pyeddl \ && echo "\nInstalling pyecvl module..." >&2 \ - && python3 setup.py install \ + && python3 setup.py install --record install.log \ && rm -rf build/temp.* \ No newline at end of file diff --git a/pylibs/pyecvl.Dockerfile b/pylibs/pyecvl.Dockerfile new file mode 100644 index 0000000..7474948 --- /dev/null +++ b/pylibs/pyecvl.Dockerfile @@ -0,0 +1,27 @@ +# base image to start from +ARG BASE_IMAGE +ARG TOOLKIT_IMAGE + +# set toolkit as intermediate stage +FROM ${TOOLKIT_IMAGE} as intermediate_stage + +ARG pyecvl_src="/usr/local/src/pyecvl" + +WORKDIR ${pyecvl_src} + +# merge existing system directories with those containing libraries +RUN sed -e 's+/usr/local/++g' install.log | \ + while IFS= read -r line; do echo ">>> $line" ; rsync --relative "/usr/local/./${line}/" "/intermediate_path/" || exit ; done + +# prepare target image +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" + +# Run git submodule update [--init] --recursive first +COPY --from=intermediate_stage /intermediate_path/bin/* /usr/local/bin/ +COPY --from=intermediate_stage /intermediate_path/lib/python3.6/dist-packages/* /usr/local/lib/python3.6/dist-packages/ + diff --git a/pylibs/pyeddl-toolkit.Dockerfile b/pylibs/pyeddl-toolkit.Dockerfile new file mode 100644 index 0000000..28b9b8f --- /dev/null +++ b/pylibs/pyeddl-toolkit.Dockerfile @@ -0,0 +1,26 @@ +ARG BASE_IMAGE + +# base image +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" + +ARG eddl_src="/usr/local/src/eddl" + +ARG pyeddl_src_origin="pyeddl" +ARG pyeddl_src_target="/usr/local/src/pyeddl" + +# Run git submodule update [--init] --recursive first +COPY ${pyeddl_src_origin} ${pyeddl_src_target} + +RUN \ + cd ${pyeddl_src_target} \ + && echo "\nLinking eddl library..." >&2 \ + && rm -r third_party/eddl \ + && ln -s ${eddl_src} third_party/ \ + && echo "\nInstalling pyeddl module..." >&2 \ + && python3 setup.py install --record install.log \ + && rm -rf build/temp.* diff --git a/pylibs/pyeddl.Dockerfile b/pylibs/pyeddl.Dockerfile new file mode 100644 index 0000000..45f5d05 --- /dev/null +++ b/pylibs/pyeddl.Dockerfile @@ -0,0 +1,27 @@ +# base image to start from +ARG BASE_IMAGE +ARG TOOLKIT_IMAGE + +# set toolkit as intermediate stage +FROM ${TOOLKIT_IMAGE} as intermediate_stage + +ARG pyeddl_src="/usr/local/src/pyeddl" + +WORKDIR ${pyeddl_src} + +# merge existing system directories with those containing libraries +RUN sed -e 's+/usr/local/++g' install.log | \ + while IFS= read -r line; do echo ">>> $line" ; rsync --relative "/usr/local/./${line}/" "/intermediate_path/" || exit ; done + +# prepare target image +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" + +# Run git submodule update [--init] --recursive first +COPY --from=intermediate_stage /intermediate_path/bin/* /usr/local/bin/ +COPY --from=intermediate_stage /intermediate_path/lib/python3.6/dist-packages/* /usr/local/lib/python3.6/dist-packages/ + diff --git a/pylibs/pylibs-base-toolkit.Dockerfile b/pylibs/pylibs-base-toolkit.Dockerfile new file mode 100644 index 0000000..6fb78ee --- /dev/null +++ b/pylibs/pylibs-base-toolkit.Dockerfile @@ -0,0 +1,15 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" + +# software requirements +RUN \ + echo "\nInstalling software requirements..." >&2 \ + && apt-get -y update && apt-get -y install --no-install-recommends \ + python3-dev python3-pip \ + && apt-get clean \ + && python3 -m pip install --upgrade --no-cache-dir \ + setuptools pip numpy pybind11 pytest \ No newline at end of file diff --git a/pylibs/pylibs-base.Dockerfile b/pylibs/pylibs-base.Dockerfile new file mode 100644 index 0000000..0bf42b5 --- /dev/null +++ b/pylibs/pylibs-base.Dockerfile @@ -0,0 +1,16 @@ +# base image to start from +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" + +# Install software requirements +RUN \ + echo "\nInstalling software requirements..." >&2 \ + && apt-get -y update && apt-get -y install --no-install-recommends \ + python3-dev python3-pip \ + && apt-get clean \ + && python3 -m pip install --upgrade --no-cache-dir \ + setuptools pip numpy pybind11 pytest \ No newline at end of file diff --git a/pylibs/pylibs-toolkit.Dockerfile b/pylibs/pylibs-toolkit.Dockerfile new file mode 100644 index 0000000..4101275 --- /dev/null +++ b/pylibs/pylibs-toolkit.Dockerfile @@ -0,0 +1,7 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" diff --git a/pylibs/pylibs.Dockerfile b/pylibs/pylibs.Dockerfile new file mode 100644 index 0000000..b223178 --- /dev/null +++ b/pylibs/pylibs.Dockerfile @@ -0,0 +1,8 @@ +# base image to start from +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as base + +# set metadata +LABEL website="https://github.com/deephealthproject/" +LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" diff --git a/pylibs/runtime.Dockerfile b/pylibs/runtime.Dockerfile deleted file mode 100644 index 8ebe492..0000000 --- a/pylibs/runtime.Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# base image to start from -ARG BASE_IMAGE -# pylibs-toolkit image -ARG TOOLKIT_IMAGE - -FROM ${TOOLKIT_IMAGE} as toolkit_image - -FROM ${BASE_IMAGE} as base - -# set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" - - -ARG eddl_src="/usr/local/src/eddl" -ARG ecvl_src="/usr/local/src/ecvl" - -ARG pyeddl_src_origin="pyeddl" -ARG pyecvl_src_origin="pyecvl" -ARG pyeddl_src_target="/usr/local/src/pyeddl" -ARG pyecvl_src_target="/usr/local/src/pyecvl" - -# Run git submodule update [--init] --recursive first -COPY --from=toolkit_image ${pyeddl_src_target} ${pyeddl_src_target} -COPY --from=toolkit_image ${pyecvl_src_target} ${pyecvl_src_target} - -RUN \ - echo "\nInstalling software requirements..." >&2 \ - && apt-get -y update && apt-get -y install --no-install-recommends \ - python3-dev python3-pip \ - && apt-get clean \ - && python3 -m pip install --upgrade --no-cache-dir \ - setuptools pip numpy pybind11 pytest \ - && cd ${pyeddl_src_target} \ - && echo "\nInstalling pyeddl module..." >&2 \ - && python3 setup.py install \ - && cd ${pyecvl_src_target} \ - && echo "\nInstalling pyecvl module..." >&2 \ - && python3 setup.py install \ No newline at end of file From 81472d0c655086faed67907d5b331d31531c929c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 7 Feb 2020 11:47:52 +0100 Subject: [PATCH 002/200] Support fine grained control over Docker images --- Makefile | 442 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 370 insertions(+), 72 deletions(-) diff --git a/Makefile b/Makefile index 2d307f0..519e85f 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,12 @@ DOCKER_IMAGE_TAG_EXTRA := ${DOCKER_IMAGE_TAG_EXTRA} # set default Docker image TAG DOCKER_IMAGE_TAG := $(or ${DOCKER_IMAGE_TAG},${BUILD_NUMBER}) +# set default Base images +DOCKER_BASE_IMAGE_SKIP_PULL := $(or ${DOCKER_BASE_IMAGE_SKIP_PULL},true) +DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) +DOCKER_NVIDIA_DEVELOP_IMAGE := $(or ${DOCKER_NVIDIA_DEVELOP_IMAGE},nvidia/cuda:10.1-devel) +DOCKER_NVIDIA_RUNTIME_IMAGE := $(or ${DOCKER_NVIDIA_RUNTIME_IMAGE},nvidia/cuda:10.1-runtime) + # current path CURRENT_PATH := $(PWD) @@ -82,26 +88,27 @@ endif # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) +# define build_image $(eval image := $(1)) $(eval target := $(2)) $(eval labels := $(3)) $(eval base := $(if $(4), --build-arg BASE_IMAGE=$(4))) $(eval toolkit := $(if $(5), --build-arg TOOLKIT_IMAGE=$(5))) - $(eval image_name := ${DOCKER_IMAGE_PREFIX}${image}${${target}_suffix}) + $(eval extra_tag := $(if $(6), -t ${image_name}:${6})) + $(eval image_name := ${DOCKER_IMAGE_PREFIX}${target}${${target}_suffix}) $(eval latest_tags := $(shell if [ "${push_latest_tags}" == "true" ]; then echo "-t ${image_name}:latest"; fi)) @echo "Building Docker image '${image_name}'..." cd ${image} \ && docker build ${BUILD_CACHE_OPT} \ -f ${target}.Dockerfile \ ${base} ${toolkit} \ - -t ${image_name}:${DOCKER_IMAGE_TAG} ${latest_tags} ${labels} . + -t ${image_name}:${DOCKER_IMAGE_TAG} ${extra_tag} ${latest_tags} ${labels} . endef define push_image $(eval image := $(1)) - $(eval target := $(2)) - $(eval image_name := ${DOCKER_IMAGE_PREFIX}${image}${${target}_suffix}) + $(eval image_name := ${DOCKER_IMAGE_PREFIX}${image}) $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) $(eval full_tag := ${full_image_name}:$(DOCKER_IMAGE_TAG)) $(eval latest_tag := ${full_image_name}:latest) @@ -131,26 +138,32 @@ define clone_repository && cd "${1}" \ && if [ -n "${4}" ]; then git reset --hard ${4} -- ; fi \ && if [ ${5} == true ]; then git submodule update --init --recursive ; fi \ + && cd - \ else \ echo "Using existing ${1} repository..." ; \ fi endef -define clean_build - $(eval lib := $(1)) # libs or pylibs - @echo "Removing $(lib)/{eddl,ecvl}..." - @rm -rf $(lib)/{*eddl,*ecvl} - @echo "Removing sources... DONE" - @echo "Stopping docker containers... " - # We'd use xargs --no-run-if-empty if we only wanted to work on Linux, but we also care - # about Mac OSX so we ignore an error in the following line (which will happen if xargs - # is called without any input on stdin) - @docker ps -a | grep -E "(${DOCKER_IMAGE_PREFIX})?$(lib)-(runtime|develop)" | awk '{print $$1}' | xargs docker rm -f || true - @echo "Stopping docker containers... DONE" - @echo "Removing docker images... " - @docker images | grep -E "(${DOCKER_IMAGE_PREFIX})?$(lib)-(runtime|develop)" | awk '{print $$3}' | xargs docker rmi -f || true - @echo "Removing docker images... DONE" +define clean_sources + $(eval path := $(1)) + @printf "Removing sources '$(path)'... " + @rm -rf $(path) + @printf "DONE\n" +endef + + +define clean_image + $(eval image := $(1)) + @printf "Stopping docker containers instances of image '$(image)'... " + @docker ps -a | grep -E "^$(image)\s" | awk '{print $$1}' | xargs docker rm -f || true + @printf "DONE\n" + @printf "Removing docker image '$(image)'... " + @docker images | grep -E "^$(image)\s" | awk '{print $$1 ":" $$2}' | xargs docker rmi -f || true + @printf "DONE\n" + @printf "Removing unused docker image... " + @docker image prune -f + @printf "DONE\n" endef @@ -166,32 +179,46 @@ help: ## Show help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) libs_folder: - $(info Creating ${LOCAL_LIBS_PATH} folder...) - @mkdir -p ${LOCAL_LIBS_PATH} - -ecvl_folder: libs_folder - $(call clone_repository,${ECVL_LIB_PATH},${ECVL_REPOSITORY},${ECVL_BRANCH},${ECVL_REVISION},true) + $(if $(wildcard ${LOCAL_LIBS_PATH}),, \ + $(info Creating ${LOCAL_LIBS_PATH} folder...) ; \ + @mkdir -p ${LOCAL_LIBS_PATH} ; \ + ) eddl_folder: libs_folder - $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) + $(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ + $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ + ) + +ecvl_folder: libs_folder + $(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ + $(call clone_repository,${ECVL_LIB_PATH},${ECVL_REPOSITORY},${ECVL_BRANCH},${ECVL_REVISION},true) ; \ + ) pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} -pyecvl_folder: pylibs_folder - $(call clone_repository,${PYECVL_LIB_PATH},${PYECVL_REPOSITORY},${PYECVL_BRANCH},${PYECVL_REVISION},false) - @echo "Copying revision '${ECVL_REVISION}' of ECVL library..." - @rm -rf ${PYECVL_LIB_PATH}/third_party/ecvl - @cp -a ${CURRENT_PATH}/${ECVL_LIB_PATH} ${CURRENT_PATH}/${PYECVL_LIB_PATH}/third_party/ecvl - -pyeddl_folder: pylibs_folder - $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) - @echo "Copying revision '${EDDL_REVISION}' of EDDL library..." - @rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl - @cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/eddl - -apply_pyeddl_patches: - # TODO: remove this patch when not required +pyeddl_folder: pylibs_folder eddl_folder + $(if $(wildcard ${PYEDDL_LIB_PATH}),$(info Using existing '${PYEDDL_LIB_PATH}' repository), \ + $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) ; \ + echo "Copying revision '${EDDL_REVISION}' of EDDL library..." ; \ + if [ -n "${EDDL_REVISION}" ]; then \ + rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl ; \ + cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/ ; \ + fi \ + ) + +pyecvl_folder: pylibs_folder ecvl_folder + $(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ + $(call clone_repository,${PYECVL_LIB_PATH},${PYECVL_REPOSITORY},${PYECVL_BRANCH},${PYECVL_REVISION},false) ; \ + echo "Copying revision '${ECVL_REVISION}' of ECVL library..."; \ + if [ -n "${ECVL_REVISION}" ]; then \ + rm -rf ${PYECVL_LIB_PATH}/third_party/ecvl ; \ + cp -a ${ECVL_LIB_PATH} ${CURRENT_PATH}/${PYECVL_LIB_PATH}/third_party/ ; \ + fi \ + ) + +# TODO: remove this patch when not required +apply_pyeddl_patches: @echo "Applying patches to the EDDL repository..." $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) cd ${EDDL_LIB_PATH} && git apply ../../${PYEDDL_LIB_PATH}/eddl_0.3.patch || true @@ -199,24 +226,116 @@ apply_pyeddl_patches: # @rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl # @cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/eddl +# # TODO: remove this patch when not required +apply_pyecvl_patches: + + +##################################################################################################################################### +############# Build Docker images ############# +##################################################################################################################################### # Targets to build container images -build: _build ## Build and tag all Docker images +build: _build ## Build libs+pylibs Docker images _build: \ build_libs \ build_pylibs -build_libs: build_libs_toolkit ## Build and tag 'libs' image - $(call build_image,libs,runtime,\ + +############# libs-toolkit ############# + +_build_libs_base_toolkit: + $(eval base_image := libs-base-toolkit:${DOCKER_BASE_IMAGE_VERSION_TAG}) + $(eval images := $(shell docker images -q ${base_image})) + $(if ${images},\ + @echo "Using existing image '${base_image}'..."; \ + if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ + echo "Pulling the latest version of '${base_image}'..."; \ + docker pull -q ${base_image} ; fi ; , \ + $(call build_image,libs,libs-base-toolkit,,$(DOCKER_NVIDIA_DEVELOP_IMAGE))\ + ) + +build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image + $(call build_image,libs,eddl-toolkit,\ + --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) + +build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image + $(call build_image,libs,ecvl-toolkit,\ + --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),eddl-toolkit:$(DOCKER_IMAGE_TAG)) + +build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image + $(call build_image,libs,libs-toolkit,\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),libs-toolkit:$(DOCKER_IMAGE_TAG)) + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),ecvl-toolkit:$(DOCKER_IMAGE_TAG)) + + -build_libs_toolkit: ecvl_folder eddl_folder apply_pyeddl_patches ## Build and tag 'libs-toolkit' image - $(call build_image,libs,develop,\ +############# libs ############# + +_build_libs_base: + $(eval base_image := libs-base:${DOCKER_BASE_IMAGE_VERSION_TAG}) + $(eval images := $(shell docker images -q ${base_image})) + $(if ${images},\ + @echo "Using existing image '${base_image}'..."; \ + if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ + echo "Pulling the latest version of '${base_image}'..."; \ + docker pull -q ${base_image} ; fi ; , \ + $(call build_image,libs,libs-base,,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) \ + ) + +build_eddl: _build_libs_base build_libs_toolkit ## Build 'eddl' image + $(call build_image,libs,eddl,\ + --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}),libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),libs-toolkit:$(DOCKER_IMAGE_TAG)) + +build_ecvl: build_eddl ## Build 'ecvl' image + $(call build_image,libs,ecvl,\ + --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),eddl:$(DOCKER_IMAGE_TAG),libs-toolkit:$(DOCKER_IMAGE_TAG)) + +build_libs: build_ecvl ## Build 'libs' image + $(call build_image,libs,libs,\ + --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),ecvl:$(DOCKER_IMAGE_TAG)) + + + +############# pylibs-toolkit ############# + +_build_pylibs_base_toolkit: build_libs_toolkit + $(eval base_image := pylibs-toolkit.base:${DOCKER_BASE_IMAGE_VERSION_TAG}) + $(eval images := $(shell docker images -q ${base_image})) + $(if ${images},\ + @echo "Using existing image '${base_image}'..."; \ + if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ + echo "Pulling the latest version of '${base_image}'..."; \ + docker pull -q ${base_image} ; fi ; , \ + $(call build_image,pylibs,pylibs-base-toolkit,,libs-toolkit:$(DOCKER_IMAGE_TAG)) \ + ) + +build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit ## Build 'pyeddl-toolkit' image + $(call build_image,pylibs,pyeddl-toolkit,\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -224,10 +343,12 @@ build_libs_toolkit: ecvl_folder eddl_folder apply_pyeddl_patches ## Build and ta --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ - ) + --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ + --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ + --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pylibs-base-toolkit:$(DOCKER_IMAGE_TAG)) -build_pylibs: build_pylibs_toolkit ## Build and tag 'pylibs' image - $(call build_image,pylibs,runtime,\ +build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image + $(call build_image,pylibs,pyecvl-toolkit,\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -240,10 +361,10 @@ build_pylibs: build_pylibs_toolkit ## Build and tag 'pylibs' image --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),libs:$(DOCKER_IMAGE_TAG),pylibs-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyeddl-toolkit:$(DOCKER_IMAGE_TAG)) -build_pylibs_toolkit: pyeddl_folder pyecvl_folder ## Build and tag 'pylibs-toolkit' image - $(call build_image,pylibs,develop,\ +build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image + $(call build_image,pylibs,pylibs-toolkit,\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -256,37 +377,138 @@ build_pylibs_toolkit: pyeddl_folder pyecvl_folder ## Build and tag 'pylibs-toolk --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),libs-toolkit:$(DOCKER_IMAGE_TAG)) - -# Docker push + --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyecvl-toolkit:$(DOCKER_IMAGE_TAG)) + + + +############# pylibs ############# + +_build_pylibs_base: _build_libs_base + $(eval base_image := pylibs-base:${DOCKER_BASE_IMAGE_VERSION_TAG}) + $(eval images := $(shell docker images -q ${base_image})) + $(if ${images},\ + @echo "Using existing image '${base_image}'..."; \ + if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ + echo "Pulling the latest version of '${base_image}'..."; \ + docker pull -q ${base_image} ; fi ; , \ + $(call build_image,pylibs,pylibs-base,,libs:$(DOCKER_IMAGE_TAG)) \ + ) + +build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image + $(call build_image,pylibs,pyeddl,\ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ + --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ + --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pylibs-base:$(DOCKER_IMAGE_TAG),pyeddl-toolkit:$(DOCKER_IMAGE_TAG)) + +build_pyecvl: build_pyeddl build_pyecvl_toolkit ## Build 'pyecvl' image + $(call build_image,pylibs,pyecvl,\ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label PYECVL_REPOSITORY=${PYECVL_REPOSITORY} \ + --label PYECVL_BRANCH=${PYECVL_BRANCH} \ + --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ + --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ + --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ + --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyeddl:$(DOCKER_IMAGE_TAG),pyecvl-toolkit:$(DOCKER_IMAGE_TAG)) + +build_pylibs: build_pyecvl ## Build 'pylibs' image + $(call build_image,pylibs,pylibs,\ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label PYECVL_REPOSITORY=${PYECVL_REPOSITORY} \ + --label PYECVL_BRANCH=${PYECVL_BRANCH} \ + --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ + --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ + --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ + --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyecvl:$(DOCKER_IMAGE_TAG)) + +############################################################################################################################ +### Push Docker images +############################################################################################################################ push: _push ## Push all built images _push: \ push_libs_toolkit push_libs \ push_pylibs_toolkit push_pylibs push_libs: repo-login ## Push 'libs' images - $(call push_image,libs,runtime) + $(call push_image,libs) + +push_eddl: repo-login ## Push 'eddl' images + $(call push_image,eddl) + +push_ecvl: repo-login ## Push 'ecvl' images + $(call push_image,ecvl) push_libs_toolkit: repo-login ## Push 'libs-toolkit' images - $(call push_image,libs,develop) + $(call push_image,libs-toolkit) + +push_eddl_toolkit: repo-login ## Push 'eddl-toolkit' images + $(call push_image,eddl-toolkit) + +push_ecvl_toolkit: repo-login ## Push 'ecvl-toolkit' images + $(call push_image,ecvl-toolkit) push_pylibs: repo-login ## Push 'pylibs' images - $(call push_image,pylibs,runtime) + $(call push_image,pylibs) + +push_pyeddl: repo-login ## Push 'pyeddl' images + $(call push_image,pyeddl) + +push_pyecvl: repo-login ## Push 'pyecvl' images + $(call push_image,pyecvl) push_pylibs_toolkit: repo-login ## Push 'pylibs-toolkit' images - $(call push_image,pylibs,develop) + $(call push_image,pylibs-toolkit) -# Docker publish +push_pyeddl_toolkit: repo-login ## Push 'pyeddl-toolkit' images + $(call push_image,pyeddl-toolkit) + +push_pyecvl_toolkit: repo-login ## Push 'pyeddl-toolkit' images + $(call push_image,pyecvl-toolkit) + +############################################################################################################################ +### Piblish Docker images +############################################################################################################################ publish: build push ## Publish all built images to a Docker Registry (e.g., DockerHub) publish_libs: build_libs push_libs ## Publish 'libs' images +publish_eddl: build_eddl push_eddl ## Publish 'eddl' images + +publish_ecvl: build_ecvl push_ecvl ## Publish 'ecvl' images + publish_libs_toolkit: build_libs_toolkit push_libs_toolkit ## Publish 'libs-toolkit' images +publish_eddl_toolkit: build_eddl_toolkit push_eddl_toolkit ## Publish 'eddl-toolkit' images + +publish_ecvl_toolkit: build_ecvl_toolkit push_ecvl_toolkit ## Publish 'ecvl-toolkit' images + publish_pylibs: build_pylibs push_pylibs ## Publish 'pylibs' images +publish_pyeddl: build_pyeddl push_pyeddl ## Publish 'pyeddl' images + +publish_pyecvl: build_pyecvl push_pyecvl ## Publish 'pyecvl' images + publish_pylibs_toolkit: build_pylibs_toolkit push_pylibs_toolkit ## Publish 'pylibs-toolkit' images +publish_pyeddl_toolkit: build_pyeddl_toolkit push_pyeddl_toolkit ## Publish 'pyeddl-toolkit' images + +publish_pyecvl_toolkit: build_pyecvl_toolkit push_pyecvl_toolkit ## Publish 'pyecvl-toolkit' images + # login to the Docker HUB repository repo-login: ## Login to the Docker Registry @if [[ ${DOCKER_LOGIN_DONE} == false ]]; then \ @@ -300,23 +522,99 @@ repo-login: ## Login to the Docker Registry version: ## Output the current version of this Makefile @echo $(VERSION) -clean: clean_libs clean_pylibs -clean_libs: - $(call clean_build,libs) +############################################################################################################################ +### Clean sources +############################################################################################################################ +clean_eddl_sources: + $(call clean_sources,libs/eddl) + +clean_ecvl_sources: + $(call clean_sources,libs/ecvl) + +clean_pyeddl_sources: + $(call clean_sources,pylibs/pyeddl) + +clean_pyecvl_sources: + $(call clean_sources,pylibs/pyecvl) + +clean_libs_sources: clean_eddl_sources clean_ecvl_sources + +clean_pylibs_sources: clean_pyeddl_sources clean_pyecvl_sources + +clean_sources: clean_pylibs_sources clean_libs_sources + + +############################################################################################################################ +### Clean Docker images +############################################################################################################################ +clean_base_images: + $(call clean_image,libs-base) + $(call clean_image,pylibs-base) + $(call clean_image,libs-base-toolkit) + $(call clean_image,pylibs-base-toolkit) + +clean_eddl_images: + $(call clean_image,eddl) + $(call clean_image,eddl-toolkit) + +clean_ecvl_images: + $(call clean_image,ecvl) + $(call clean_image,ecvl-toolkit) + +clean_libs_images: clean_ecvl_images clean_eddl_images + $(call clean_image,libs) + $(call clean_image,libs-toolkit) + +clean_pyeddl_images: + $(call clean_image,pyeddl) + $(call clean_image,pyeddl-toolkit) + +clean_pyecvl_images: + $(call clean_image,pyecvl) + $(call clean_image,pyecvl-toolkit) + +clean_pylibs_images: clean_pyecvl_images clean_pyeddl_images + $(call clean_image,pylibs) + $(call clean_image,pylibs-toolkit) + +clean_images: clean_pylibs_images clean_libs_images clean_base_images + + +############################################################################################################################ +### Clean Docker images +############################################################################################################################ +clean: clean_images clean_sources -clean_pylibs: - $(call clean_build,pylibs) -.PHONY: help clean clean_libs clean_pylibs apply_libs_patches \ - build _build build_libs_toolkit build_libs \ - build_pylibs_toolkit build_pylibs \ - ecvl_folder eddl_folder pyecvl_folder pyeddl_folder \ +.PHONY: help \ + libs_folder eddl_folder ecvl_folder pylibs_folder pyeddl_folder pyecvl_folder \ + apply_pyeddl_patches apply_pyecvl_patches \ + clean clean_libs clean_pylibs apply_libs_patches \ + build _build \ + _build_libs_base_toolkit \ + build_eddl_toolkit build_ecvl_toolkit build_libs_toolkit \ + _build_libs_base build_eddl build_ecvl build_libs \ + _build_pylibs_base_toolkit _build_pylibs_base \ + build_pyeddl_toolkit build_pyecvl_toolkit build_pylibs_toolkit\ + _build_pylibs_base build_pyeddl build_pyecvl build_pylibs \ repo-login \ - push \ - _push push_libs_toolkit push_libs \ - push_pylibs_toolkit push_pylibs \ + push _push \ + push_libs push_eddl push_ecvl \ + push_libs_toolkit push_eddl_toolkit push_ecvl_toolkit \ + push_pylibs push_pyeddl push_pyecvl \ + push_pylibs_toolkit push_pyeddl_toolkit push_pyecvl_toolkit \ publish \ - publish_libs_toolkit publish_libs \ - publish_pylibs_toolkit publish_pylibs \ No newline at end of file + publish_libs publish_eddl publish_ecvl \ + publish_libs_toolkit publish_eddl_toolkit publish_ecvl_toolkit \ + publish_pylibs publish_pyeddl publish_pyecvl \ + publish_pylibs_toolkit publish_pyeddl_toolkit publish_pyecvl_toolkit \ + clean_sources \ + clean_eddl_sources clean_ecvl_sources \ + clean_pyeddl_sources clean_pyecvl_sources \ + clean \ + clean_images \ + clean_base_images \ + clean_eddl_images clean_ecvl_images clean_libs_images \ + clean_pyeddl_images clean_pyecvl_images clean_pylibs_images \ No newline at end of file From 72e5922ddcd1a892f6c514faaee07476487f5ee3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 7 Feb 2020 12:24:03 +0100 Subject: [PATCH 003/200] Commend DOCKER_PASSWORD --- settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index f0e8929..e0d049b 100644 --- a/settings.sh +++ b/settings.sh @@ -1,6 +1,6 @@ # set docker user credentials DOCKER_USER=deephealth -DOCKER_PASSWORD="" +#DOCKER_PASSWORD="" # use DockerHub as default registry DOCKER_REGISTRY=registry.hub.docker.com From fadff0a1fbbe37511784847055254eed78c58808 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 7 Feb 2020 13:00:06 +0100 Subject: [PATCH 004/200] Fix missing images --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 519e85f..2655d5d 100644 --- a/Makefile +++ b/Makefile @@ -237,7 +237,9 @@ apply_pyecvl_patches: build: _build ## Build libs+pylibs Docker images _build: \ build_libs \ - build_pylibs + build_libs_toolkit \ + build_pylibs \ + build_pylibs_toolkit ############# libs-toolkit ############# From cc679101f0e570599d632d731028475d28358c9b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 7 Feb 2020 13:00:15 +0100 Subject: [PATCH 005/200] Update login procedure --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2655d5d..aa2c7d4 100644 --- a/Makefile +++ b/Makefile @@ -515,7 +515,7 @@ publish_pyecvl_toolkit: build_pyecvl_toolkit push_pyecvl_toolkit ## Publish 'pye repo-login: ## Login to the Docker Registry @if [[ ${DOCKER_LOGIN_DONE} == false ]]; then \ echo "Logging into Docker registry ${DOCKER_REGISTRY}..." ; \ - echo ${DOCKER_PASSWORD} | docker login ${DOCKER_REGISTRY} -u ${DOCKER_USER} --password-stdin ; \ + docker login ${DOCKER_REGISTRY} -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ; \ DOCKER_LOGIN_DONE=true ;\ else \ echo "Logging into Docker registry already done" ; \ From e3854cd3d0d41f1ccad820254351c1c6dd819406 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 7 Feb 2020 13:00:33 +0100 Subject: [PATCH 006/200] Disable default DOCKER_USER from settings --- Jenkinsfile | 1 + settings.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b2e49b..91b430c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,6 +41,7 @@ pipeline { registryCredential = 'dockerhub-deephealthproject' // Skip DockerHub DOCKER_LOGIN_DONE = true + DOCKER_USER=deephealth } stages { diff --git a/settings.sh b/settings.sh index e0d049b..de79a3b 100644 --- a/settings.sh +++ b/settings.sh @@ -1,5 +1,5 @@ # set docker user credentials -DOCKER_USER=deephealth +#DOCKER_USER=deephealth #DOCKER_PASSWORD="" # use DockerHub as default registry From 6e00841893ee30c6580c657b538774c1f6d6f3f4 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 11:44:51 +0100 Subject: [PATCH 007/200] Test Upstream data extraction --- Jenkinsfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 91b430c..4bdd34e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,8 @@ +UPSTREAM_GIT_REPO = "" +UPSTREAM_GIT_BRANCH = "" +UPSTREAM_GIT_REVISION = "" +UPSTREAM_PROJECT_DATA = "" + pipeline { agent { node { label 'docker && linux && !gpu' } @@ -49,6 +54,24 @@ pipeline { steps { sh 'git fetch --tags' sh 'printenv' + script { + currentBuild.upstreamBuilds?.each { b -> + echo b.getFullProjectName() + var upstream_data = b.getBuildVariables() + echo upstream_data["GIT_URL"] + echo upstream_data["GIT_COMMIT"] + echo upstream_data["GIT_BRANCH"] + b.getBuildVariables().each { + key, value -> L:{ + println "$key -- $value" + if ( "$key" == "GIT_BRANCH"){ + myVar = "$value" + echo "$value --- $myVar" + } + } + } + } + } } } From fb4ef4591b65213d7374fa1a65a4f7cdd665e731 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 11:51:31 +0100 Subject: [PATCH 008/200] Fix DOCKER_USER --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4bdd34e..f1c151a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,7 @@ pipeline { registryCredential = 'dockerhub-deephealthproject' // Skip DockerHub DOCKER_LOGIN_DONE = true - DOCKER_USER=deephealth + DOCKER_USER = "deephealth" } stages { From e1c84e7d8d6eb9f8e984f797ab8c43d577ea12b6 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 12:02:42 +0100 Subject: [PATCH 009/200] Fix var declaration --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f1c151a..5333e72 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,7 +57,7 @@ pipeline { script { currentBuild.upstreamBuilds?.each { b -> echo b.getFullProjectName() - var upstream_data = b.getBuildVariables() + upstream_data = b.getBuildVariables() echo upstream_data["GIT_URL"] echo upstream_data["GIT_COMMIT"] echo upstream_data["GIT_BRANCH"] From dc54d278b1cc22eabb536fa1b10aa189874a0289 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 12:11:41 +0100 Subject: [PATCH 010/200] Test var set --- Jenkinsfile | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5333e72..88e959a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -56,11 +56,11 @@ pipeline { sh 'printenv' script { currentBuild.upstreamBuilds?.each { b -> - echo b.getFullProjectName() upstream_data = b.getBuildVariables() - echo upstream_data["GIT_URL"] - echo upstream_data["GIT_COMMIT"] - echo upstream_data["GIT_BRANCH"] + UPSTREAM_GIT_REPO = upstream_data["GIT_URL"] + UPSTREAM_GIT_BRANCH = upstream_data["GIT_BRANCH"] + UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] + UPSTREAM_PROJECT_DATA = upstream_data b.getBuildVariables().each { key, value -> L:{ println "$key -- $value" @@ -75,6 +75,19 @@ pipeline { } } + stage('Use configured variable') { + when { + expression { return "$UPSTREAM_PROJECT_DATA" != "" } + } + + steps { + sh "echo ${UPSTREAM_GIT_REPO}" + sh "echo ${UPSTREAM_GIT_BRANCH}" + sh "echo ${UPSTREAM_GIT_COMMIT}" + sh "echo ${UPSTREAM_PROJECT_DATA}" + } + } + stage('Build') { parallel { From 788f0ef54e024b11ffaf6849e3ce9ef3a9d2984f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 12:46:52 +0100 Subject: [PATCH 011/200] Update REPO_TAG --- Jenkinsfile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 88e959a..db512c2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,6 +3,8 @@ UPSTREAM_GIT_BRANCH = "" UPSTREAM_GIT_REVISION = "" UPSTREAM_PROJECT_DATA = "" +REPO_TAG = "" + pipeline { agent { node { label 'docker && linux && !gpu' } @@ -61,15 +63,8 @@ pipeline { UPSTREAM_GIT_BRANCH = upstream_data["GIT_BRANCH"] UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] UPSTREAM_PROJECT_DATA = upstream_data - b.getBuildVariables().each { - key, value -> L:{ - println "$key -- $value" - if ( "$key" == "GIT_BRANCH"){ - myVar = "$value" - echo "$value --- $myVar" - } - } - } + + REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() } } } @@ -85,6 +80,7 @@ pipeline { sh "echo ${UPSTREAM_GIT_BRANCH}" sh "echo ${UPSTREAM_GIT_COMMIT}" sh "echo ${UPSTREAM_PROJECT_DATA}" + sh "echo ${REPO_TAG}" } } From 459bae17f73f01043f5ac5f58ae18e6486a465d6 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 13:11:06 +0100 Subject: [PATCH 012/200] Update evn --- Jenkinsfile | 75 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index db512c2..55f8453 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,36 @@ + +// ECVL Settings +ECVL_REPOSITORY = "https://github.com/deephealthproject/ecvl.git" +ECVL_BRANCH = "master" +ECVL_REVISION = "" +// PyECVL Settings +PYECVL_REPOSITORY = "https://github.com/deephealthproject/pyecvl.git" +PYECVL_BRANCH = "master" +PYECVL_REVISION = "" +// EDDL Settings +EDDL_REPOSITORY = "https://github.com/deephealthproject/eddl.git" +EDDL_BRANCH = "master" +EDDL_REVISION = "" +// PyEDDL Settings +PYEDDL_REPOSITORY = "https://github.com/deephealthproject/pyeddl.git" +PYEDDL_BRANCH = "master" +PYEDDL_REVISION = "" +// Extract additional info +REPO_TAG = "" +// Docker Settings +DOCKER_IMAGE_LATEST = "" +DOCKER_IMAGE_TAG = "" +DOCKER_IMAGE_TAG_EXTRA = "" +DOCKER_REPOSITORY_OWNER = "dhealth" +// Upstream project data UPSTREAM_GIT_REPO = "" UPSTREAM_GIT_BRANCH = "" UPSTREAM_GIT_REVISION = "" UPSTREAM_PROJECT_DATA = "" -REPO_TAG = "" - +//////////////////////////////////////////////////////////////////////////////////////////// +// Pipeline Definition +//////////////////////////////////////////////////////////////////////////////////////////// pipeline { agent { node { label 'docker && linux && !gpu' } @@ -20,30 +46,7 @@ pipeline { EDDL_SRC = "${BASE_SRC}/eddl" PYECVL_SRC = "${BASE_SRC}/pyecvl" PYEDDL_SRC = "${BASE_SRC}/pyeddl" - // ECVL Settings - ECVL_REPOSITORY = "https://github.com/deephealthproject/ecvl.git" - ECVL_BRANCH = "master" - ECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${ECVL_REPOSITORY} ${ECVL_BRANCH} | awk '{print \$1}'").trim() - // PyECVL Settings - PYECVL_REPOSITORY = "https://github.com/deephealthproject/pyecvl.git" - PYECVL_BRANCH = "master" - PYECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYECVL_REPOSITORY} ${PYECVL_BRANCH} | awk '{print \$1}'").trim() - // EDDL Settings - EDDL_REPOSITORY = "https://github.com/deephealthproject/eddl.git" - EDDL_BRANCH = "master" - EDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${EDDL_REPOSITORY} ${EDDL_BRANCH} | awk '{print \$1}'").trim() - // PyEDDL Settings - PYEDDL_REPOSITORY = "https://github.com/deephealthproject/pyeddl.git" - PYEDDL_BRANCH = "master" - PYEDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYEDDL_REPOSITORY} ${PYEDDL_BRANCH} | awk '{print \$1}'").trim() - // Extract additional info - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${BRANCH_NAME} | sed 's+/+-+g'").trim() - REPO_TAG = sh(returnStdout: true, script: "tag=\$(git tag -l --points-at HEAD); if [[ -n \${tag} ]]; then echo \${tag}; else git rev-parse --short HEAD --short; fi").trim() - // Docker Settings - DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() - DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" - DOCKER_REPOSITORY_OWNER = "dhealth" + // Docker credentials registryCredential = 'dockerhub-deephealthproject' // Skip DockerHub @@ -54,8 +57,17 @@ pipeline { stage('Configure') { steps { + // Load tags sh 'git fetch --tags' - sh 'printenv' + // Set defaults + ECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${ECVL_REPOSITORY} ${ECVL_BRANCH} | awk '{print \$1}'").trim() + PYECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYECVL_REPOSITORY} ${PYECVL_BRANCH} | awk '{print \$1}'").trim() + EDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${EDDL_REPOSITORY} ${EDDL_BRANCH} | awk '{print \$1}'").trim() + PYEDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYEDDL_REPOSITORY} ${PYEDDL_BRANCH} | awk '{print \$1}'").trim() + REPO_TAG = sh(returnStdout: true, script: "tag=\$(git tag -l --points-at HEAD); if [[ -n \${tag} ]]; then echo \${tag}; else git rev-parse --short HEAD --short; fi").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${BRANCH_NAME} | sed 's+/+-+g'").trim() + DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() + // Extract upstream project script { currentBuild.upstreamBuilds?.each { b -> upstream_data = b.getBuildVariables() @@ -63,10 +75,17 @@ pipeline { UPSTREAM_GIT_BRANCH = upstream_data["GIT_BRANCH"] UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] UPSTREAM_PROJECT_DATA = upstream_data - + // overwrite repo tag using the upstream repo REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed 's+/+-+g'").trim() + DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() } } + // + DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" + DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" + // Print current environment (just for debug) + sh 'printenv' } } From f4ff4678d39b063c2fc176602d670e162591d1f3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 13:13:34 +0100 Subject: [PATCH 013/200] Update environment --- Jenkinsfile | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 55f8453..3aae55c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,16 +59,18 @@ pipeline { steps { // Load tags sh 'git fetch --tags' - // Set defaults - ECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${ECVL_REPOSITORY} ${ECVL_BRANCH} | awk '{print \$1}'").trim() - PYECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYECVL_REPOSITORY} ${PYECVL_BRANCH} | awk '{print \$1}'").trim() - EDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${EDDL_REPOSITORY} ${EDDL_BRANCH} | awk '{print \$1}'").trim() - PYEDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYEDDL_REPOSITORY} ${PYEDDL_BRANCH} | awk '{print \$1}'").trim() - REPO_TAG = sh(returnStdout: true, script: "tag=\$(git tag -l --points-at HEAD); if [[ -n \${tag} ]]; then echo \${tag}; else git rev-parse --short HEAD --short; fi").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${BRANCH_NAME} | sed 's+/+-+g'").trim() - DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() - // Extract upstream project + + script { + // Set defaults + ECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${ECVL_REPOSITORY} ${ECVL_BRANCH} | awk '{print \$1}'").trim() + PYECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYECVL_REPOSITORY} ${PYECVL_BRANCH} | awk '{print \$1}'").trim() + EDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${EDDL_REPOSITORY} ${EDDL_BRANCH} | awk '{print \$1}'").trim() + PYEDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYEDDL_REPOSITORY} ${PYEDDL_BRANCH} | awk '{print \$1}'").trim() + REPO_TAG = sh(returnStdout: true, script: "tag=\$(git tag -l --points-at HEAD); if [[ -n \${tag} ]]; then echo \${tag}; else git rev-parse --short HEAD --short; fi").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${BRANCH_NAME} | sed 's+/+-+g'").trim() + DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() + // Extract upstream project currentBuild.upstreamBuilds?.each { b -> upstream_data = b.getBuildVariables() UPSTREAM_GIT_REPO = upstream_data["GIT_URL"] @@ -81,7 +83,7 @@ pipeline { DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() } } - // + // Define Docker Image TAG DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" // Print current environment (just for debug) From 6c69121f0c35666b84549bccc77161af67adddc1 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 13:14:44 +0100 Subject: [PATCH 014/200] Fix var --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3aae55c..6594547 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,10 +82,10 @@ pipeline { NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed 's+/+-+g'").trim() DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() } + // Define Docker Image TAG + DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" + DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" } - // Define Docker Image TAG - DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" // Print current environment (just for debug) sh 'printenv' } From 7dce5ac1b7fb5d8dbfe2d8c919be19902768f711 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 13:18:00 +0100 Subject: [PATCH 015/200] Add debug prints --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 6594547..9156b4f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,6 +102,10 @@ pipeline { sh "echo ${UPSTREAM_GIT_COMMIT}" sh "echo ${UPSTREAM_PROJECT_DATA}" sh "echo ${REPO_TAG}" + sh "echo ${NORMALIZED_BRANCH_NAME}" + sh "echo ${DOCKER_IMAGE_LATEST}" + sh "echo ${DOCKER_IMAGE_TAG}" + sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" } } From 9d20d75e5c8a406a9b006befd98e216012a54224 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 13:23:25 +0100 Subject: [PATCH 016/200] Fix normalized branch name --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9156b4f..ca75ff7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -79,7 +79,7 @@ pipeline { UPSTREAM_PROJECT_DATA = upstream_data // overwrite repo tag using the upstream repo REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed 's+/+-+g'").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() } // Define Docker Image TAG From 0dc89dd934a77efd6308ba6c8da4060cc56b891c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 15:21:54 +0100 Subject: [PATCH 017/200] Add Switch --- Jenkinsfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ca75ff7..3930c7b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,6 +77,15 @@ pipeline { UPSTREAM_GIT_BRANCH = upstream_data["GIT_BRANCH"] UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] UPSTREAM_PROJECT_DATA = upstream_data + test = "git@github.com:kikkomep/dtests.git" + // TODO: set revisions + switch(${UPSTREAM_GIT_REPO}) + case ${ECVL_REPOSITORY} + echo "ECVL REPOSITORY !!!" + case ${test} + echo "Test REPOSITORY" + + // overwrite repo tag using the upstream repo REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() From 173ec91cf5d3dd4806632951c5ba4b895693401a Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 10 Feb 2020 15:26:45 +0100 Subject: [PATCH 018/200] Fix switch syntax --- Jenkinsfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3930c7b..7830106 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -79,11 +79,16 @@ pipeline { UPSTREAM_PROJECT_DATA = upstream_data test = "git@github.com:kikkomep/dtests.git" // TODO: set revisions - switch(${UPSTREAM_GIT_REPO}) - case ${ECVL_REPOSITORY} - echo "ECVL REPOSITORY !!!" - case ${test} - echo "Test REPOSITORY" + switch(UPSTREAM_GIT_REPO){ + case ECVL_REPOSITORY: + ECVL_REVISION = UPSTREAM_GIT_COMMIT + echo "$ECVL_REVISION $UPSTREAM_GIT_COMMIT" + case test: + ECVL_REVISION = UPSTREAM_GIT_COMMIT + echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" + default: + echo "Default repo" + } // overwrite repo tag using the upstream repo From c5daa4b458c73e790ed197eb8ee6305cc9d6c729 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 15:51:57 +0100 Subject: [PATCH 019/200] Fix bad white-space --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aa2c7d4..b87c356 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ EDDL_REVISION := ${EDDL_REVISION} # PyEDDL repository PYEDDL_REPOSITORY := $(or ${PYEDDL_REPOSITORY},https://github.com/deephealthproject/pyeddl.git) PYEDDL_BRANCH := $(or ${PYEDDL_BRANCH},master) -PYEDDL_REVISION := ${PYEDDL_REVISION} +PYEDDL_REVISION := ${PYEDDL_REVISION} # config file CONFIG_FILE ?= settings.sh From 56bef29f4300b9423448d4b7accb83a8f3bd21fa Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 17:08:07 +0100 Subject: [PATCH 020/200] Improve clone of repository dependencies --- Makefile | 86 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index b87c356..565c5d0 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ endef # 4 --> REVISION # 5 --> RECURSIVE SUBMODULE CLONE (true|false) define clone_repository - @if [ ! -d ${1} ]; then \ + if [ ! -d ${1} ]; then \ git clone --branch "${3}" ${2} ${1} \ && cd "${1}" \ && if [ -n "${4}" ]; then git reset --hard ${4} -- ; fi \ @@ -185,37 +185,87 @@ libs_folder: ) eddl_folder: libs_folder - $(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ + @$(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ ) -ecvl_folder: libs_folder + +define clone_ecvl $(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ $(call clone_repository,${ECVL_LIB_PATH},${ECVL_REPOSITORY},${ECVL_BRANCH},${ECVL_REVISION},true) ; \ ) +endef + +ecvl_folder: libs_folder + $(call clone_ecvl) pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} -pyeddl_folder: pylibs_folder eddl_folder +define pyeddl_shallow_clone $(if $(wildcard ${PYEDDL_LIB_PATH}),$(info Using existing '${PYEDDL_LIB_PATH}' repository), \ $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) ; \ - echo "Copying revision '${EDDL_REVISION}' of EDDL library..." ; \ - if [ -n "${EDDL_REVISION}" ]; then \ - rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl ; \ - cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/ ; \ - fi \ ) +endef + +define pyeddl_clone_dependencies + $(eval EDDL_REVISION = $(shell if [[ ! -n "${EDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYEDDL_LIB_PATH} && git submodule status -- third_party/eddl | sed -E 's/-//; s/ .*//'; else echo ${EDDL_REVISION}; fi)) + @echo "EDDL_REVISION: ${EDDL_REVISION}" + @if [[ -d ${EDDL_LIB_PATH} ]]; then \ + echo "Using existing '${EDDL_LIB_PATH}' repository" ; \ + else \ + $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ + printf "Copying revision '${EDDL_REVISION}' of EDDL library... " ; \ + rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl && cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/eddl ; \ + printf "DONE\n" ; \ + fi +endef + +_pyeddl_shallow_clone: pylibs_folder + @$(call pyeddl_shallow_clone) + +pyeddl_folder: _pyeddl_shallow_clone + $(call pyeddl_clone_dependencies) -pyecvl_folder: pylibs_folder ecvl_folder - $(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ +define pyecvl_shallow_clone + @$(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ $(call clone_repository,${PYECVL_LIB_PATH},${PYECVL_REPOSITORY},${PYECVL_BRANCH},${PYECVL_REVISION},false) ; \ - echo "Copying revision '${ECVL_REVISION}' of ECVL library..."; \ - if [ -n "${ECVL_REVISION}" ]; then \ - rm -rf ${PYECVL_LIB_PATH}/third_party/ecvl ; \ - cp -a ${ECVL_LIB_PATH} ${CURRENT_PATH}/${PYECVL_LIB_PATH}/third_party/ ; \ - fi \ ) +endef + +define pyecvl_resolve_dependencies + $(eval PYEDDL_REVISION = $(shell if [[ ! -n "${PYEDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/pyeddl | sed -E 's/-//; s/ .*//'; else echo ${PYEDDL_REVISION}; fi)) + $(eval ECVL_REVISION = $(shell if [[ ! -n "${ECVL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/ecvl | sed -E 's/-//; s/ .*//'; else echo ${ECVL_REVISION}; fi)) + @if [[ -d ${PYEDDL_LIB_PATH} ]]; then \ + echo "Using existing '${PYEDDL_LIB_PATH}' repository" ; \ + else \ + $(call pyeddl_shallow_clone) \ + printf "Copying revision '${PYEDDL_REVISION}' of PYEDDL library... " ; \ + rm -rf ${PYECVL_LIB_PATH}/third_party/pyeddl && cp -a ${PYEDDL_LIB_PATH} ${PYECVL_LIB_PATH}/third_party/pyeddl ; \ + printf "DONE\n" ; \ + fi + @if [[ -d ${ECVL_LIB_PATH} ]]; then \ + echo "Using existing '${ECVL_LIB_PATH}' repository" ; \ + else \ + echo "Using ECVL revision '${ECVL_REVISION}'" ; \ + $(call clone_ecvl) \ + printf "Copying revision '${ECVL_REVISION}' of ECVL library... " ; \ + rm -rf ${PYECVL_LIB_PATH}/third_party/ecvl && cp -a ${ECVL_LIB_PATH} ${PYECVL_LIB_PATH}/third_party/ecvl ; \ + printf "DONE\n" ; \ + fi +endef + +_pyecvl_shallow_clone: pylibs_folder + $(call pyecvl_shallow_clone) + +_pyecvl_first_level_dependencies: _pyecvl_shallow_clone + $(call pyecvl_resolve_dependencies) + +_pyecvl_second_level_dependencies: _pyecvl_first_level_dependencies + $(call pyeddl_clone_dependencies) + +pyecvl_folder: _pyecvl_second_level_dependencies + # TODO: remove this patch when not required apply_pyeddl_patches: @@ -591,7 +641,9 @@ clean: clean_images clean_sources .PHONY: help \ - libs_folder eddl_folder ecvl_folder pylibs_folder pyeddl_folder pyecvl_folder \ + libs_folder eddl_folder ecvl_folder pylibs_folder \ + pyeddl_folder _pyeddl_shallow_clone \ + pyecvl_folder _pyeddl_shallow_clone _pyecvl_first_level_dependencies _pyecvl_second_level_dependencies \ apply_pyeddl_patches apply_pyecvl_patches \ clean clean_libs clean_pylibs apply_libs_patches \ build _build \ From bfc62d7306c51613b9de6daf0b64fd53a7d321c0 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 17:21:40 +0100 Subject: [PATCH 021/200] Set upstream Git Repository/revision/branch --- Jenkinsfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7830106..ab0718f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,17 +80,24 @@ pipeline { test = "git@github.com:kikkomep/dtests.git" // TODO: set revisions switch(UPSTREAM_GIT_REPO){ + case EDDL_REPOSITORY: + EDDL_BRANCH = UPSTREAM_GIT_BRANCH + EDDL_REVISION = UPSTREAM_GIT_COMMIT case ECVL_REPOSITORY: + ECVL_BRANCH = UPSTREAM_GIT_BRANCH ECVL_REVISION = UPSTREAM_GIT_COMMIT - echo "$ECVL_REVISION $UPSTREAM_GIT_COMMIT" + case PYEDDL_REPOSITORY: + PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH + PYEDDL_REVISION = UPSTREAM_GIT_COMMIT + case PYECVL_REPOSITORY: + PYECVL_BRANCH = UPSTREAM_GIT_BRANCH + PYECVL_REVISION = UPSTREAM_GIT_COMMIT case test: ECVL_REVISION = UPSTREAM_GIT_COMMIT echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" default: echo "Default repo" } - - // overwrite repo tag using the upstream repo REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() From 6401c661987096795952e44b1e8518ef9e88753f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 17:21:57 +0100 Subject: [PATCH 022/200] Refine test constraint --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ab0718f..ac3081e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -177,6 +177,12 @@ pipeline { parallel { stage('Test EDDL') { + when { + anyOf { + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } ; + not { triggeredBy 'UpstreamCause' } + } + } agent { docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } } From 570ab8999d1626dfaae07624751fb0cc62abe8fb Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 17:44:07 +0100 Subject: [PATCH 023/200] Define stage 'EDDL Build' --- Jenkinsfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ac3081e..c8ed556 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -169,6 +169,25 @@ pipeline { } } } + + stage('EDDL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + } + } + steps { + script { + sh 'CONFIG_FILE="" make build_eddl' + // docker.withRegistry( '', registryCredential ) { + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' + // } + } + } + } + } } From e1e47828a7c59d7084108e68cca62a4f8821f4c3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 17:51:20 +0100 Subject: [PATCH 024/200] Disable Develop Build (test) --- Jenkinsfile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8ed556..9a861e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -152,23 +152,23 @@ pipeline { } } - stage('Development Build') { - when { - allOf { - not { branch "master" } ; - triggeredBy 'UpstreamCause' - } - } - steps { - script { - sh 'CONFIG_FILE="" make build' - docker.withRegistry( '', registryCredential ) { - sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - } - } - } - } + // stage('Development Build') { + // when { + // allOf { + // not { branch "master" } ; + // triggeredBy 'UpstreamCause' + // } + // } + // steps { + // script { + // sh 'CONFIG_FILE="" make build' + // docker.withRegistry( '', registryCredential ) { + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' + // } + // } + // } + // } stage('EDDL Build') { when { From 344267a7edf0671c330e4a0b4042ba26979f3137 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 18:42:47 +0100 Subject: [PATCH 025/200] Fix image dependencies --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 565c5d0..209e404 100644 --- a/Makefile +++ b/Makefile @@ -344,14 +344,14 @@ _build_libs_base: $(call build_image,libs,libs-base,,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) \ ) -build_eddl: _build_libs_base build_libs_toolkit ## Build 'eddl' image +build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image $(call build_image,libs,eddl,\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}),libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),libs-toolkit:$(DOCKER_IMAGE_TAG)) + --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}),libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(DOCKER_IMAGE_TAG)) -build_ecvl: build_eddl ## Build 'ecvl' image +build_ecvl: _build_libs_base build_ecvl_toolkit## Build 'ecvl' image $(call build_image,libs,ecvl,\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -359,7 +359,7 @@ build_ecvl: build_eddl ## Build 'ecvl' image --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),eddl:$(DOCKER_IMAGE_TAG),libs-toolkit:$(DOCKER_IMAGE_TAG)) + --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),eddl:$(DOCKER_IMAGE_TAG),ecvl-toolkit:$(DOCKER_IMAGE_TAG)) build_libs: build_ecvl ## Build 'libs' image $(call build_image,libs,libs,\ From 61ad895f5556bfc7a56badaee450b3b4a8a64bf3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 19:13:26 +0100 Subject: [PATCH 026/200] Fix dependency for pylibs-base Docker image --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 209e404..2f07212 100644 --- a/Makefile +++ b/Makefile @@ -443,7 +443,7 @@ _build_pylibs_base: _build_libs_base if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ echo "Pulling the latest version of '${base_image}'..."; \ docker pull -q ${base_image} ; fi ; , \ - $(call build_image,pylibs,pylibs-base,,libs:$(DOCKER_IMAGE_TAG)) \ + $(call build_image,pylibs,pylibs-base,,libs-base:$(DOCKER_IMAGE_TAG)) \ ) build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image From 57462c9b26a5e1dff9fb92cea22674b3d29dc4fa Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 19:14:06 +0100 Subject: [PATCH 027/200] Add stages to build partial Docker images --- Jenkinsfile | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9a861e0..44a84f7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -188,6 +188,63 @@ pipeline { } } + stage('PyEDDL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + } + } + steps { + script { + sh 'CONFIG_FILE="" make build_pyeddl' + // docker.withRegistry( '', registryCredential ) { + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' + // } + } + } + } + + stage('ECVL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + } + } + steps { + script { + sh 'CONFIG_FILE="" make build_ecvl' + // docker.withRegistry( '', registryCredential ) { + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' + // } + } + } + } + + stage('PyECVL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + } + } + steps { + script { + sh 'CONFIG_FILE="" make build_pyecvl' + // docker.withRegistry( '', registryCredential ) { + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' + // } + } + } + } + + + + } } From 6ccf4b4b630d5dd785748bc0a0cdf44d81d8af83 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 19:14:23 +0100 Subject: [PATCH 028/200] Add stages to test partial Docker images --- Jenkinsfile | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 44a84f7..4aed282 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -267,27 +267,45 @@ pipeline { } } - stage('Test ECVL') { + stage('Test PyEDDL') { + when { + anyOf { + expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } ; + not { triggeredBy 'UpstreamCause' } + } + } agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } + docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } } steps { - sh 'cd ${ECVL_SRC}/build && ctest -C Debug -VV' + sh 'cd ${PYEDDL_SRC} && pytest tests' + sh 'cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py' + sh 'cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1' } } - stage('Test PyEDDL') { + stage('Test ECVL') { + when { + anyOf { + expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } ; + not { triggeredBy 'UpstreamCause' } + } + } agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } + docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } } steps { - sh 'cd ${PYEDDL_SRC} && pytest tests' - sh 'cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py' - sh 'cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1' + sh 'cd ${ECVL_SRC}/build && ctest -C Debug -VV' } } stage('Test PyECVL') { + when { + anyOf { + expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } ; + not { triggeredBy 'UpstreamCause' } + } + } agent { docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } } From 54c10d86e42b67e9f36d1c7cdde0a2231478a2fe Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 19:14:40 +0100 Subject: [PATCH 029/200] Add stages to push partial Docker images --- Jenkinsfile | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4aed282..f1aa8e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -377,6 +377,89 @@ pipeline { } } } + + + stage('Publish EDDL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + } + } + steps { + script { + docker.withRegistry( '', registryCredential ) { + sh ''' + echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" + CONFIG_FILE="" make push_eddl_toolkit + CONFIG_FILE="" make push_eddl + ''' + } + } + } + } + + stage('Publish PyEDDL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } + } + } + steps { + script { + docker.withRegistry( '', registryCredential ) { + sh ''' + echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" + CONFIG_FILE="" make push_pyeddl_toolkit + CONFIG_FILE="" make push_pyeddl + ''' + } + } + } + } + + stage('Publish ECVL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } + } + } + steps { + script { + docker.withRegistry( '', registryCredential ) { + sh ''' + echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" + CONFIG_FILE="" make push_ecvl_toolkit + CONFIG_FILE="" make push_ecvl + ''' + } + } + } + } + + stage('Publish PyECVL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } + } + } + steps { + script { + docker.withRegistry( '', registryCredential ) { + sh ''' + echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" + CONFIG_FILE="" make push_ecvl_toolkit + CONFIG_FILE="" make push_ecvl + ''' + } + } + } + } + + } } } From 7591662a9730e2d7086e85c2faa42420fc523130 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 11 Feb 2020 19:44:35 +0100 Subject: [PATCH 030/200] Fix conditions to build partial images --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f1aa8e3..befdfbb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -192,7 +192,7 @@ pipeline { when { allOf { triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } } } steps { @@ -210,7 +210,7 @@ pipeline { when { allOf { triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } } } steps { @@ -228,7 +228,7 @@ pipeline { when { allOf { triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } } } steps { From 45ec63702ea97c3354c1234ff56f459a48cb9c1b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 12:55:19 +0100 Subject: [PATCH 031/200] Differentiate tags by libs --- Jenkinsfile | 55 +++++++------ Makefile | 220 +++++++++++++++++++++++++++++++--------------------- 2 files changed, 162 insertions(+), 113 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index befdfbb..7bb9b64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -78,34 +78,41 @@ pipeline { UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] UPSTREAM_PROJECT_DATA = upstream_data test = "git@github.com:kikkomep/dtests.git" - // TODO: set revisions - switch(UPSTREAM_GIT_REPO){ - case EDDL_REPOSITORY: - EDDL_BRANCH = UPSTREAM_GIT_BRANCH - EDDL_REVISION = UPSTREAM_GIT_COMMIT - case ECVL_REPOSITORY: - ECVL_BRANCH = UPSTREAM_GIT_BRANCH - ECVL_REVISION = UPSTREAM_GIT_COMMIT - case PYEDDL_REPOSITORY: - PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH - PYEDDL_REVISION = UPSTREAM_GIT_COMMIT - case PYECVL_REPOSITORY: - PYECVL_BRANCH = UPSTREAM_GIT_BRANCH - PYECVL_REVISION = UPSTREAM_GIT_COMMIT - case test: - ECVL_REVISION = UPSTREAM_GIT_COMMIT - echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" - default: - echo "Default repo" - } - // overwrite repo tag using the upstream repo - REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() - DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() } + + // overwrite repo tag using the upstream repo + REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() + DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() + // Define Docker Image TAG DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" + + // TODO: set revisions + switch(UPSTREAM_GIT_REPO){ + case EDDL_REPOSITORY: + EDDL_BRANCH = UPSTREAM_GIT_BRANCH + EDDL_REVISION = UPSTREAM_GIT_COMMIT + EDDL_IMAGE_TAG = DOCKER_IMAGE_TAG + case ECVL_REPOSITORY: + ECVL_BRANCH = UPSTREAM_GIT_BRANCH + ECVL_REVISION = UPSTREAM_GIT_COMMIT + ECVL_IMAGE_TAG = DOCKER_IMAGE_TAG + case PYEDDL_REPOSITORY: + PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH + PYEDDL_REVISION = UPSTREAM_GIT_COMMIT + PYEDDL_IMAGE_TAG = DOCKER_IMAGE_TAG + case PYECVL_REPOSITORY: + PYECVL_BRANCH = UPSTREAM_GIT_BRANCH + PYECVL_REVISION = UPSTREAM_GIT_COMMIT + PYECVL_IMAGE_TAG = DOCKER_IMAGE_TAG + case test: + ECVL_REVISION = UPSTREAM_GIT_COMMIT + echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" + default: + echo "Default repo" + } } // Print current environment (just for debug) sh 'printenv' diff --git a/Makefile b/Makefile index 2f07212..f3862a0 100644 --- a/Makefile +++ b/Makefile @@ -31,10 +31,15 @@ DOCKER_IMAGE_TAG := $(or ${DOCKER_IMAGE_TAG},${BUILD_NUMBER}) # set default Base images DOCKER_BASE_IMAGE_SKIP_PULL := $(or ${DOCKER_BASE_IMAGE_SKIP_PULL},true) -DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) DOCKER_NVIDIA_DEVELOP_IMAGE := $(or ${DOCKER_NVIDIA_DEVELOP_IMAGE},nvidia/cuda:10.1-devel) DOCKER_NVIDIA_RUNTIME_IMAGE := $(or ${DOCKER_NVIDIA_RUNTIME_IMAGE},nvidia/cuda:10.1-runtime) +DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) +EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) +ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) +PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) +PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) + # current path CURRENT_PATH := $(PWD) @@ -88,34 +93,48 @@ endif # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) -# +#$(if docker images -q ${image_name}:${tag} > /dev/null || docker images -q ${full_tag} > /dev/null, define build_image $(eval image := $(1)) $(eval target := $(2)) - $(eval labels := $(3)) - $(eval base := $(if $(4), --build-arg BASE_IMAGE=$(4))) - $(eval toolkit := $(if $(5), --build-arg TOOLKIT_IMAGE=$(5))) - $(eval extra_tag := $(if $(6), -t ${image_name}:${6})) + $(eval tag := $(3)) + $(eval labels := $(4)) + $(eval base := $(if $(5), --build-arg BASE_IMAGE=$(5))) + $(eval toolkit := $(if $(6), --build-arg TOOLKIT_IMAGE=$(6))) + $(eval extra_tags := $(if $(7), -t ${image_name}:${7})) $(eval image_name := ${DOCKER_IMAGE_PREFIX}${target}${${target}_suffix}) + $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) $(eval latest_tags := $(shell if [ "${push_latest_tags}" == "true" ]; then echo "-t ${image_name}:latest"; fi)) + $(eval tagged_image := ${image_name}:${tag}) @echo "Building Docker image '${image_name}'..." - cd ${image} \ - && docker build ${BUILD_CACHE_OPT} \ - -f ${target}.Dockerfile \ - ${base} ${toolkit} \ - -t ${image_name}:${DOCKER_IMAGE_TAG} ${extra_tag} ${latest_tags} ${labels} . + $(eval images := $(shell docker images -q ${tagged_image})) + $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag})) + $(if ${images},\ + echo "Docker image exists: ${images}", \ + $(if ${exists}, \ + echo "Pulling image '${full_image_name}:${tag}'..."; + docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ + echo "Building Docker image '${image_name}'..." ; \ + cd ${image} \ + && docker build ${BUILD_CACHE_OPT} \ + -f ${target}.Dockerfile \ + ${base} ${toolkit} \ + -t ${image_name}:${tag} ${extra_tags} ${latest_tags} ${labels} . \ + ) + ) endef define push_image $(eval image := $(1)) + $(eval tag := $(or $(2),${DOCKER_IMAGE_TAG})) $(eval image_name := ${DOCKER_IMAGE_PREFIX}${image}) $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) - $(eval full_tag := ${full_image_name}:$(DOCKER_IMAGE_TAG)) + $(eval full_tag := ${full_image_name}:$(tag)) $(eval latest_tag := ${full_image_name}:latest) $(eval tags := ${DOCKER_IMAGE_TAG_EXTRA}) @echo "Tagging images... " - docker tag ${image_name}:$(DOCKER_IMAGE_TAG) ${full_tag} - @if [ ${push_latest_tags} == true ]; then docker tag ${image_name}:$(DOCKER_IMAGE_TAG) ${latest_tag}; fi + docker tag ${image_name}:$(tag) ${full_tag} + @if [ ${push_latest_tags} == true ]; then docker tag ${image_name}:$(tag) ${latest_tag}; fi @echo "Pushing Docker image '${image_name}'..." docker push ${full_tag} @if [ ${push_latest_tags} == true ]; then docker push ${latest_tag}; fi @@ -170,7 +189,9 @@ endef # 1: library path # 2: actual revision define get_revision -$(shell if [[ -z "${2}" ]]; then cd ${1} && git rev-parse HEAD; else echo "${2}" ; fi) + $(eval tag := $(shell cd ${1} && git tag -l --points-at HEAD)) \ + $(eval head := $(shell cd ${1} && git rev-parse --short HEAD | sed -E 's/-//; s/ .*//')) \ + $(strip $(shell if [[ -n "${2}" ]]; then echo ${2}; elif [[ -n "${tag}" ]]; then echo ${tag}; else echo ${head}; fi)) endef .DEFAULT_GOAL := help @@ -184,11 +205,14 @@ libs_folder: @mkdir -p ${LOCAL_LIBS_PATH} ; \ ) -eddl_folder: libs_folder +_eddl_folder: libs_folder @$(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ ) +eddl_folder: _eddl_folder + $(eval EDDL_REVISION := $(call get_revision,libs/eddl,${EDDL_REVISION})) + define clone_ecvl $(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ @@ -196,9 +220,12 @@ define clone_ecvl ) endef -ecvl_folder: libs_folder +_ecvl_folder: libs_folder $(call clone_ecvl) +ecvl_folder: _ecvl_folder + $(eval ECVL_REVISION := $(call get_revision,libs/ecvl,${ECVL_REVISION})) + pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} @@ -209,7 +236,7 @@ define pyeddl_shallow_clone endef define pyeddl_clone_dependencies - $(eval EDDL_REVISION = $(shell if [[ ! -n "${EDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYEDDL_LIB_PATH} && git submodule status -- third_party/eddl | sed -E 's/-//; s/ .*//'; else echo ${EDDL_REVISION}; fi)) + $(eval EDDL_REVISION = $(shell if [[ ! -n "${EDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYEDDL_LIB_PATH} && git submodule status -- third_party/eddl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${EDDL_REVISION}; fi)) @echo "EDDL_REVISION: ${EDDL_REVISION}" @if [[ -d ${EDDL_LIB_PATH} ]]; then \ echo "Using existing '${EDDL_LIB_PATH}' repository" ; \ @@ -218,7 +245,7 @@ define pyeddl_clone_dependencies printf "Copying revision '${EDDL_REVISION}' of EDDL library... " ; \ rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl && cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/eddl ; \ printf "DONE\n" ; \ - fi + fi endef _pyeddl_shallow_clone: pylibs_folder @@ -226,6 +253,7 @@ _pyeddl_shallow_clone: pylibs_folder pyeddl_folder: _pyeddl_shallow_clone $(call pyeddl_clone_dependencies) + $(eval PYEDDL_REVISION := $(call get_revision,pylibs/pyeddl,${PYEDDL_REVISION})) define pyecvl_shallow_clone @$(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ @@ -234,8 +262,8 @@ define pyecvl_shallow_clone endef define pyecvl_resolve_dependencies - $(eval PYEDDL_REVISION = $(shell if [[ ! -n "${PYEDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/pyeddl | sed -E 's/-//; s/ .*//'; else echo ${PYEDDL_REVISION}; fi)) - $(eval ECVL_REVISION = $(shell if [[ ! -n "${ECVL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/ecvl | sed -E 's/-//; s/ .*//'; else echo ${ECVL_REVISION}; fi)) + $(eval PYEDDL_REVISION = $(shell if [[ ! -n "${PYEDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/pyeddl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${PYEDDL_REVISION}; fi)) + $(eval ECVL_REVISION = $(shell if [[ ! -n "${ECVL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/ecvl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${ECVL_REVISION}; fi)) @if [[ -d ${PYEDDL_LIB_PATH} ]]; then \ echo "Using existing '${PYEDDL_LIB_PATH}' repository" ; \ else \ @@ -265,16 +293,14 @@ _pyecvl_second_level_dependencies: _pyecvl_first_level_dependencies $(call pyeddl_clone_dependencies) pyecvl_folder: _pyecvl_second_level_dependencies + $(eval PYECVL_REVISION := $(call get_revision,pylibs/pyecvl,${PYECVL_REVISION})) # TODO: remove this patch when not required -apply_pyeddl_patches: +apply_pyeddl_patches: @echo "Applying patches to the EDDL repository..." $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) cd ${EDDL_LIB_PATH} && git apply ../../${PYEDDL_LIB_PATH}/eddl_0.3.patch || true - # @echo "Copying revision '${EDDL_REVISION}' of EDDL library..." - # @rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl - # @cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/eddl # # TODO: remove this patch when not required apply_pyecvl_patches: @@ -302,32 +328,34 @@ _build_libs_base_toolkit: if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ echo "Pulling the latest version of '${base_image}'..."; \ docker pull -q ${base_image} ; fi ; , \ - $(call build_image,libs,libs-base-toolkit,,$(DOCKER_NVIDIA_DEVELOP_IMAGE))\ + $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_DEVELOP_IMAGE))\ ) -build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image - $(call build_image,libs,eddl-toolkit,\ +build_eddl_toolkit: eddl_folder _build_libs_base_toolkit ## Build 'eddl-toolkit' image + $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call build_image,libs,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) + --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image - $(call build_image,libs,ecvl-toolkit,\ + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call build_image,libs,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),eddl-toolkit:$(DOCKER_IMAGE_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image - $(call build_image,libs,libs-toolkit,\ + $(call build_image,libs,libs-toolkit,${DOCKER_IMAGE_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),ecvl-toolkit:$(DOCKER_IMAGE_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) @@ -341,35 +369,37 @@ _build_libs_base: if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ echo "Pulling the latest version of '${base_image}'..."; \ docker pull -q ${base_image} ; fi ; , \ - $(call build_image,libs,libs-base,,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) \ + $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) \ ) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image - $(call build_image,libs,eddl,\ + $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call build_image,libs,eddl,${EDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}),libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(DOCKER_IMAGE_TAG)) + --label EDDL_REVISION=${EDDL_REVISION},libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) build_ecvl: _build_libs_base build_ecvl_toolkit## Build 'ecvl' image - $(call build_image,libs,ecvl,\ + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call build_image,libs,ecvl,${ECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),eddl:$(DOCKER_IMAGE_TAG),ecvl-toolkit:$(DOCKER_IMAGE_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},eddl:$(DOCKER_IMAGE_TAG),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_libs: build_ecvl ## Build 'libs' image - $(call build_image,libs,libs,\ + $(call build_image,libs,libs,${DOCKER_IMAGE_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}),ecvl:$(DOCKER_IMAGE_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},ecvl:$(ECVL_IMAGE_VERSION_TAG)) @@ -383,53 +413,55 @@ _build_pylibs_base_toolkit: build_libs_toolkit if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ echo "Pulling the latest version of '${base_image}'..."; \ docker pull -q ${base_image} ; fi ; , \ - $(call build_image,pylibs,pylibs-base-toolkit,,libs-toolkit:$(DOCKER_IMAGE_TAG)) \ + $(call build_image,pylibs,pylibs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-toolkit:$(DOCKER_IMAGE_TAG)) \ ) build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit ## Build 'pyeddl-toolkit' image - $(call build_image,pylibs,pyeddl-toolkit,\ + $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call build_image,pylibs,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label ECVL_REVISION=${ECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pylibs-base-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(DOCKER_IMAGE_TAG)) build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image - $(call build_image,pylibs,pyecvl-toolkit,\ + $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call build_image,pylibs,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label ECVL_REVISION=${ECVL_REVISION} \ --label PYECVL_REPOSITORY=${PYECVL_REPOSITORY} \ --label PYECVL_BRANCH=${PYECVL_BRANCH} \ - --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ + --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyeddl-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image - $(call build_image,pylibs,pylibs-toolkit,\ + $(call build_image,pylibs,pylibs-toolkit,${DOCKER_IMAGE_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label ECVL_REVISION=${ECVL_REVISION} \ --label PYECVL_REPOSITORY=${PYECVL_REPOSITORY} \ --label PYECVL_BRANCH=${PYECVL_BRANCH} \ - --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ + --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyecvl-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) @@ -443,50 +475,52 @@ _build_pylibs_base: _build_libs_base if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ echo "Pulling the latest version of '${base_image}'..."; \ docker pull -q ${base_image} ; fi ; , \ - $(call build_image,pylibs,pylibs-base,,libs-base:$(DOCKER_IMAGE_TAG)) \ + $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-base:$(DOCKER_IMAGE_TAG)) \ ) build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image - $(call build_image,pylibs,pyeddl,\ + $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call build_image,pylibs,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},\ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label ECVL_REVISION=${ECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pylibs-base:$(DOCKER_IMAGE_TAG),pyeddl-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_IMAGE_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) build_pyecvl: build_pyeddl build_pyecvl_toolkit ## Build 'pyecvl' image - $(call build_image,pylibs,pyecvl,\ + $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call build_image,pylibs,pyecvl,${PYECVL_IMAGE_VERSION_TAG},\ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label ECVL_REVISION=${ECVL_REVISION} \ --label PYECVL_REPOSITORY=${PYECVL_REPOSITORY} \ --label PYECVL_BRANCH=${PYECVL_BRANCH} \ - --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ + --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyeddl:$(DOCKER_IMAGE_TAG),pyecvl-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl:$(PYEDDL_IMAGE_VERSION_TAG),pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) build_pylibs: build_pyecvl ## Build 'pylibs' image - $(call build_image,pylibs,pylibs,\ + $(call build_image,pylibs,pylibs,${DOCKER_IMAGE_TAG},\ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=$(call get_revision,${EDDL_LIB_PATH},${EDDL_REVISION}) \ + --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=$(call get_revision,${ECVL_LIB_PATH},${ECVL_REVISION}) \ + --label ECVL_REVISION=${ECVL_REVISION} \ --label PYECVL_REPOSITORY=${PYECVL_REPOSITORY} \ --label PYECVL_BRANCH=${PYECVL_BRANCH} \ - --label PYECVL_REVISION=$(call get_revision,${PYECVL_LIB_PATH},${PYECVL_REVISION}) \ + --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=$(call get_revision,${PYEDDL_LIB_PATH},${PYEDDL_REVISION}),pyecvl:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl:$(PYECVL_IMAGE_VERSION_TAG)) ############################################################################################################################ ### Push Docker images @@ -499,38 +533,46 @@ _push: \ push_libs: repo-login ## Push 'libs' images $(call push_image,libs) -push_eddl: repo-login ## Push 'eddl' images - $(call push_image,eddl) +push_eddl: repo-login eddl_folder ## Push 'eddl' images + $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call push_image,eddl,${EDDL_IMAGE_VERSION_TAG}) -push_ecvl: repo-login ## Push 'ecvl' images - $(call push_image,ecvl) +push_ecvl: repo-login ecvl_folder ## Push 'ecvl' images + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG}) push_libs_toolkit: repo-login ## Push 'libs-toolkit' images $(call push_image,libs-toolkit) -push_eddl_toolkit: repo-login ## Push 'eddl-toolkit' images - $(call push_image,eddl-toolkit) +push_eddl_toolkit: repo-login eddl_folder ## Push 'eddl-toolkit' images + $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call push_image,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG}) -push_ecvl_toolkit: repo-login ## Push 'ecvl-toolkit' images - $(call push_image,ecvl-toolkit) +push_ecvl_toolkit: repo-login ecvl_folder ## Push 'ecvl-toolkit' images + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG}) push_pylibs: repo-login ## Push 'pylibs' images $(call push_image,pylibs) -push_pyeddl: repo-login ## Push 'pyeddl' images - $(call push_image,pyeddl) +push_pyeddl: repo-login pyeddl_folder ## Push 'pyeddl' images + $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG}) -push_pyecvl: repo-login ## Push 'pyecvl' images - $(call push_image,pyecvl) +push_pyecvl: repo-login pyecvl_folder ## Push 'pyecvl' images + $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG}) push_pylibs_toolkit: repo-login ## Push 'pylibs-toolkit' images $(call push_image,pylibs-toolkit) -push_pyeddl_toolkit: repo-login ## Push 'pyeddl-toolkit' images - $(call push_image,pyeddl-toolkit) +push_pyeddl_toolkit: repo-login pyeddl_folder ## Push 'pyeddl-toolkit' images + $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG}) -push_pyecvl_toolkit: repo-login ## Push 'pyeddl-toolkit' images - $(call push_image,pyecvl-toolkit) +push_pyecvl_toolkit: repo-login pyecvl_folder ## Push 'pyeddl-toolkit' images + $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call push_image,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG}) ############################################################################################################################ ### Piblish Docker images From 883dab5e5ed6a1674cf0ea63e529f24cece40e20 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 12:58:07 +0100 Subject: [PATCH 032/200] Update settings --- settings.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index de79a3b..a1a5aa6 100644 --- a/settings.sh +++ b/settings.sh @@ -1,3 +1,8 @@ +# +DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" +DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" +DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) + # set docker user credentials #DOCKER_USER=deephealth #DOCKER_PASSWORD="" @@ -33,7 +38,7 @@ EDDL_REVISION=0.3 # PyEDDL repository PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git PYEDDL_BRANCH=master -PYEDDL_REVISION=0.2.0 +PYEDDL_REVISION=0.3.0 # date.time as build number #DOCKER_IMAGE_TAG=0.1.2 From 87c3cfd435b6b5bf12b8e78b38c14c382a57a6c8 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 14:39:03 +0100 Subject: [PATCH 033/200] Restore patch --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f3862a0..6be931b 100644 --- a/Makefile +++ b/Makefile @@ -347,7 +347,7 @@ build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image --label ECVL_BRANCH=${ECVL_BRANCH} \ --label ECVL_REVISION=${ECVL_REVISION},eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) -build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image +build_libs_toolkit: build_ecvl_toolkit apply_pyeddl_patches ## Build 'libs-toolkit' image $(call build_image,libs,libs-toolkit,${DOCKER_IMAGE_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ From 3ad14f8ca561347d4910865d49864449bad41539 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 14:52:11 +0100 Subject: [PATCH 034/200] Fix base image version --- settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index a1a5aa6..9f7a189 100644 --- a/settings.sh +++ b/settings.sh @@ -1,7 +1,7 @@ # DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) +DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 # set docker user credentials #DOCKER_USER=deephealth From 45c69802c8e69c7c9581f64c9134a70560ba6cdd Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 15:04:34 +0100 Subject: [PATCH 035/200] Update cleanup --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7bb9b64..f92c1be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -492,9 +492,8 @@ pipeline { cleanup { // sh 'make clean' deleteDir() /* clean up our workspace */ - sh 'docker images' - sh 'docker image prune -f' - sh 'if [ "$(docker images | grep -E \"(l|pyl)ibs([[:space:]]|-toolkit)\")" ]; then docker images | grep -E "(l|pyl)ibs([[:space:]]|-toolkit)" | awk \'{print $3}\' | uniq | xargs docker rmi -f; fi;' + sh 'make clean_sources' + sh 'make clean_images' } } } \ No newline at end of file From e4e56d8226c6a47d3f4cd65f6c1c6ee61a31d4d4 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 15:29:51 +0100 Subject: [PATCH 036/200] Fix patch --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6be931b..c95405a 100644 --- a/Makefile +++ b/Makefile @@ -331,7 +331,7 @@ _build_libs_base_toolkit: $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_DEVELOP_IMAGE))\ ) -build_eddl_toolkit: eddl_folder _build_libs_base_toolkit ## Build 'eddl-toolkit' image +build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call build_image,libs,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ @@ -347,7 +347,7 @@ build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image --label ECVL_BRANCH=${ECVL_BRANCH} \ --label ECVL_REVISION=${ECVL_REVISION},eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) -build_libs_toolkit: build_ecvl_toolkit apply_pyeddl_patches ## Build 'libs-toolkit' image +build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image $(call build_image,libs,libs-toolkit,${DOCKER_IMAGE_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ From 3df4678b7b30c43a9b3be4f8eabab9c98be3e2e3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 15:43:48 +0100 Subject: [PATCH 037/200] Fix Docker image base --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index f92c1be..06ef2a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -88,6 +88,7 @@ pipeline { // Define Docker Image TAG DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" + DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" // TODO: set revisions switch(UPSTREAM_GIT_REPO){ From 33ccee9242e4d7bc828ab7e427914a6b7a3c3509 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 15:53:01 +0100 Subject: [PATCH 038/200] Fix cleanup --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 06ef2a9..3884c3b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -490,11 +490,10 @@ pipeline { failure { echo 'I failed :(' } - cleanup { - // sh 'make clean' - deleteDir() /* clean up our workspace */ + cleanup { sh 'make clean_sources' sh 'make clean_images' + deleteDir() /* clean up our workspace */ } } } \ No newline at end of file From 188ba8e8205201ffd6a385ef1fbecc0ff451f7a3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 15:53:16 +0100 Subject: [PATCH 039/200] Test Build 34 --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3884c3b..46e6e42 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,6 +80,8 @@ pipeline { test = "git@github.com:kikkomep/dtests.git" } + BUILD_NUMBER = "34" + // overwrite repo tag using the upstream repo REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() From 632c19d819832230904f18e0d457c907ba6ed44c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 16:07:07 +0100 Subject: [PATCH 040/200] Fix base image --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 46e6e42..d026724 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -92,6 +92,8 @@ pipeline { DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" + DOCKER_IMAGE_TAG = "34" + // TODO: set revisions switch(UPSTREAM_GIT_REPO){ case EDDL_REPOSITORY: From 93d8e9bf282ca4ee017586332449646b78e6972a Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 16:11:49 +0100 Subject: [PATCH 041/200] Disable cleanup --- Jenkinsfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d026724..9cb461d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -494,10 +494,5 @@ pipeline { failure { echo 'I failed :(' } - cleanup { - sh 'make clean_sources' - sh 'make clean_images' - deleteDir() /* clean up our workspace */ - } } } \ No newline at end of file From 1b27f0aa04066f27f50842ff73379d2785423e97 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 16:44:34 +0100 Subject: [PATCH 042/200] Print debug messages --- Jenkinsfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9cb461d..e755ae7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -117,7 +117,7 @@ pipeline { echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" default: echo "Default repo" - } + } } // Print current environment (just for debug) sh 'printenv' @@ -191,6 +191,15 @@ pipeline { } steps { script { + sh "echo ${UPSTREAM_GIT_REPO}" + sh "echo ${UPSTREAM_GIT_BRANCH}" + sh "echo ${UPSTREAM_GIT_COMMIT}" + sh "echo ${UPSTREAM_PROJECT_DATA}" + sh "echo ${REPO_TAG}" + sh "echo ${NORMALIZED_BRANCH_NAME}" + sh "echo ${DOCKER_IMAGE_LATEST}" + sh "echo ${DOCKER_IMAGE_TAG}" + sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" sh 'CONFIG_FILE="" make build_eddl' // docker.withRegistry( '', registryCredential ) { // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' From f2745bc2d3cfd8f19bbe52c7fa3a46adbd70fd47 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 17:06:48 +0100 Subject: [PATCH 043/200] Fix image tag name --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e755ae7..b8c0d76 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,19 +99,19 @@ pipeline { case EDDL_REPOSITORY: EDDL_BRANCH = UPSTREAM_GIT_BRANCH EDDL_REVISION = UPSTREAM_GIT_COMMIT - EDDL_IMAGE_TAG = DOCKER_IMAGE_TAG + EDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG case ECVL_REPOSITORY: ECVL_BRANCH = UPSTREAM_GIT_BRANCH ECVL_REVISION = UPSTREAM_GIT_COMMIT - ECVL_IMAGE_TAG = DOCKER_IMAGE_TAG + ECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG case PYEDDL_REPOSITORY: PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH PYEDDL_REVISION = UPSTREAM_GIT_COMMIT - PYEDDL_IMAGE_TAG = DOCKER_IMAGE_TAG + PYEDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG case PYECVL_REPOSITORY: PYECVL_BRANCH = UPSTREAM_GIT_BRANCH PYECVL_REVISION = UPSTREAM_GIT_COMMIT - PYECVL_IMAGE_TAG = DOCKER_IMAGE_TAG + PYECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG case test: ECVL_REVISION = UPSTREAM_GIT_COMMIT echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" From 482543b172396e1c486b80091453dc37a296818b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 17:43:18 +0100 Subject: [PATCH 044/200] Other messages --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index b8c0d76..4ae6d2e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -139,6 +139,7 @@ pipeline { sh "echo ${DOCKER_IMAGE_LATEST}" sh "echo ${DOCKER_IMAGE_TAG}" sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" + sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" } } @@ -200,6 +201,7 @@ pipeline { sh "echo ${DOCKER_IMAGE_LATEST}" sh "echo ${DOCKER_IMAGE_TAG}" sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" + sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" sh 'CONFIG_FILE="" make build_eddl' // docker.withRegistry( '', registryCredential ) { // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' From f5b0f2ac3c925d5cf31844fceaaf7d80759b1293 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 20:54:28 +0100 Subject: [PATCH 045/200] Fix missing var declaration --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4ae6d2e..fef2d3b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,25 +3,31 @@ ECVL_REPOSITORY = "https://github.com/deephealthproject/ecvl.git" ECVL_BRANCH = "master" ECVL_REVISION = "" +ECVL_IMAGE_VERSION_TAG = "" // PyECVL Settings PYECVL_REPOSITORY = "https://github.com/deephealthproject/pyecvl.git" PYECVL_BRANCH = "master" PYECVL_REVISION = "" +PYECVL_IMAGE_VERSION_TAG = "" // EDDL Settings EDDL_REPOSITORY = "https://github.com/deephealthproject/eddl.git" EDDL_BRANCH = "master" EDDL_REVISION = "" +EDDL_IMAGE_VERSION_TAG = "" // PyEDDL Settings PYEDDL_REPOSITORY = "https://github.com/deephealthproject/pyeddl.git" PYEDDL_BRANCH = "master" PYEDDL_REVISION = "" +PYEDDL_IMAGE_VERSION_TAG = "" // Extract additional info REPO_TAG = "" +NORMALIZED_BRANCH_NAME = "" // Docker Settings DOCKER_IMAGE_LATEST = "" DOCKER_IMAGE_TAG = "" DOCKER_IMAGE_TAG_EXTRA = "" DOCKER_REPOSITORY_OWNER = "dhealth" +DOCKER_BASE_IMAGE_VERSION_TAG = "" // Upstream project data UPSTREAM_GIT_REPO = "" UPSTREAM_GIT_BRANCH = "" From 3b8cc27fad4cf4ab66e620013c30bcedc12e7b29 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 20:59:22 +0100 Subject: [PATCH 046/200] Fix info message --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c95405a..45a1bce 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ define build_image $(eval images := $(shell docker images -q ${tagged_image})) $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag})) $(if ${images},\ - echo "Docker image exists: ${images}", \ + echo "Docker image '${tagged_image}' exists (id: ${images})", \ $(if ${exists}, \ echo "Pulling image '${full_image_name}:${tag}'..."; docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ From 1dc53e1d30e025a671170dc0bd518186d7805f55 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 21:07:52 +0100 Subject: [PATCH 047/200] Fix scope --- Jenkinsfile | 79 +++++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fef2d3b..ca1c619 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -84,45 +84,46 @@ pipeline { UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] UPSTREAM_PROJECT_DATA = upstream_data test = "git@github.com:kikkomep/dtests.git" - } - - BUILD_NUMBER = "34" - - // overwrite repo tag using the upstream repo - REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() - DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() - - // Define Docker Image TAG - DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" - DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" - - DOCKER_IMAGE_TAG = "34" - - // TODO: set revisions - switch(UPSTREAM_GIT_REPO){ - case EDDL_REPOSITORY: - EDDL_BRANCH = UPSTREAM_GIT_BRANCH - EDDL_REVISION = UPSTREAM_GIT_COMMIT - EDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case ECVL_REPOSITORY: - ECVL_BRANCH = UPSTREAM_GIT_BRANCH - ECVL_REVISION = UPSTREAM_GIT_COMMIT - ECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case PYEDDL_REPOSITORY: - PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH - PYEDDL_REVISION = UPSTREAM_GIT_COMMIT - PYEDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case PYECVL_REPOSITORY: - PYECVL_BRANCH = UPSTREAM_GIT_BRANCH - PYECVL_REVISION = UPSTREAM_GIT_COMMIT - PYECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case test: - ECVL_REVISION = UPSTREAM_GIT_COMMIT - echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" - default: - echo "Default repo" + + + BUILD_NUMBER = "34" + + // overwrite repo tag using the upstream repo + REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() + DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() + + // Define Docker Image TAG + DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" + DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" + DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" + + DOCKER_IMAGE_TAG = "34" + + // TODO: set revisions + switch(UPSTREAM_GIT_REPO){ + case EDDL_REPOSITORY: + EDDL_BRANCH = UPSTREAM_GIT_BRANCH + EDDL_REVISION = UPSTREAM_GIT_COMMIT + EDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG + case ECVL_REPOSITORY: + ECVL_BRANCH = UPSTREAM_GIT_BRANCH + ECVL_REVISION = UPSTREAM_GIT_COMMIT + ECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG + case PYEDDL_REPOSITORY: + PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH + PYEDDL_REVISION = UPSTREAM_GIT_COMMIT + PYEDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG + case PYECVL_REPOSITORY: + PYECVL_BRANCH = UPSTREAM_GIT_BRANCH + PYECVL_REVISION = UPSTREAM_GIT_COMMIT + PYECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG + case test: + ECVL_REVISION = UPSTREAM_GIT_COMMIT + echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" + default: + echo "Default repo" + } } } // Print current environment (just for debug) From 6e1fec0eed973a23825876d03994139a56d26713 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 21:11:14 +0100 Subject: [PATCH 048/200] Update base image tag --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca1c619..3d46e0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -98,8 +98,6 @@ pipeline { DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" - DOCKER_IMAGE_TAG = "34" - // TODO: set revisions switch(UPSTREAM_GIT_REPO){ case EDDL_REPOSITORY: From beb3fc7597c26a8fba49dcaa6e870b61b770c3a9 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 21:34:47 +0100 Subject: [PATCH 049/200] Use shared function to build base images --- Makefile | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 45a1bce..f282e34 100644 --- a/Makefile +++ b/Makefile @@ -321,15 +321,7 @@ _build: \ ############# libs-toolkit ############# _build_libs_base_toolkit: - $(eval base_image := libs-base-toolkit:${DOCKER_BASE_IMAGE_VERSION_TAG}) - $(eval images := $(shell docker images -q ${base_image})) - $(if ${images},\ - @echo "Using existing image '${base_image}'..."; \ - if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ - echo "Pulling the latest version of '${base_image}'..."; \ - docker pull -q ${base_image} ; fi ; , \ - $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_DEVELOP_IMAGE))\ - ) + $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_DEVELOP_IMAGE)) build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) @@ -362,15 +354,7 @@ build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image ############# libs ############# _build_libs_base: - $(eval base_image := libs-base:${DOCKER_BASE_IMAGE_VERSION_TAG}) - $(eval images := $(shell docker images -q ${base_image})) - $(if ${images},\ - @echo "Using existing image '${base_image}'..."; \ - if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ - echo "Pulling the latest version of '${base_image}'..."; \ - docker pull -q ${base_image} ; fi ; , \ - $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) \ - ) + $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) @@ -406,15 +390,7 @@ build_libs: build_ecvl ## Build 'libs' image ############# pylibs-toolkit ############# _build_pylibs_base_toolkit: build_libs_toolkit - $(eval base_image := pylibs-toolkit.base:${DOCKER_BASE_IMAGE_VERSION_TAG}) - $(eval images := $(shell docker images -q ${base_image})) - $(if ${images},\ - @echo "Using existing image '${base_image}'..."; \ - if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ - echo "Pulling the latest version of '${base_image}'..."; \ - docker pull -q ${base_image} ; fi ; , \ - $(call build_image,pylibs,pylibs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-toolkit:$(DOCKER_IMAGE_TAG)) \ - ) + $(call build_image,pylibs,pylibs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-toolkit:$(DOCKER_IMAGE_TAG)) build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit ## Build 'pyeddl-toolkit' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) @@ -468,15 +444,7 @@ build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image ############# pylibs ############# _build_pylibs_base: _build_libs_base - $(eval base_image := pylibs-base:${DOCKER_BASE_IMAGE_VERSION_TAG}) - $(eval images := $(shell docker images -q ${base_image})) - $(if ${images},\ - @echo "Using existing image '${base_image}'..."; \ - if [ "${DOCKER_BASE_IMAGE_SKIP_PULL}" != "true" ]; then \ - echo "Pulling the latest version of '${base_image}'..."; \ - docker pull -q ${base_image} ; fi ; , \ - $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-base:$(DOCKER_IMAGE_TAG)) \ - ) + $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-base:$(DOCKER_IMAGE_TAG)) build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) From 6051ce2a3581484d9d89917d4e909a3add02cb27 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 22:02:20 +0100 Subject: [PATCH 050/200] Multiline --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3d46e0e..d960266 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -89,8 +89,10 @@ pipeline { BUILD_NUMBER = "34" // overwrite repo tag using the upstream repo - REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++'").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() + REPO_TAG = sh(returnStdout: true, script: ''' + git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++' + ''').trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g').trim() DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() // Define Docker Image TAG From 3b131fa0d0ef4c1e9a1111152b0c77059fa0368e Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 22:37:42 +0100 Subject: [PATCH 051/200] Update Jenkinsfile --- Jenkinsfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d960266..e766cd9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -89,15 +89,13 @@ pipeline { BUILD_NUMBER = "34" // overwrite repo tag using the upstream repo - REPO_TAG = sh(returnStdout: true, script: ''' - git ls-remote --tags ${UPSTREAM_GIT_REPO} | grep ${UPSTREAM_GIT_COMMIT} | awk '{print \$2}' | sed -e 's+refs/tags/++' - ''').trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g').trim() + REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | sed -nE 's+(${UPSTREAM_GIT_COMMIT})[[:space:]]*refs/tags/([[:alnum:]]{1,})+\2+p'").trim() + NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() // Define Docker Image TAG DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" + DOCKER_IMAGE_TAG_EXTRA = sh(returnStdout: true, script: 'if [ -n "${REPO_TAG}" ]; then echo "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}"; fi').trim() DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" // TODO: set revisions From a1d7a5cfc0c34f1f62cd7634c18bee9d6294df32 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 23:04:09 +0100 Subject: [PATCH 052/200] Update REPO TAG --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e766cd9..86d6eff 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -95,7 +95,7 @@ pipeline { // Define Docker Image TAG DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = sh(returnStdout: true, script: 'if [ -n "${REPO_TAG}" ]; then echo "${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}"; fi').trim() + DOCKER_IMAGE_TAG_EXTRA = sh(returnStdout: true, script: "TAG=${REPO_TAG:-${UPSTREAM_GIT_COMMIT}}; echo \"${TAG} ${TAG}_build${BUILD_NUMBER}\"").trim() DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" // TODO: set revisions From e1506da6568679bd5e938b7fd3eb84bf0cc2900b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 23:25:10 +0100 Subject: [PATCH 053/200] Update image tag --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 86d6eff..08a4acd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { upstream_data = b.getBuildVariables() UPSTREAM_GIT_REPO = upstream_data["GIT_URL"] UPSTREAM_GIT_BRANCH = upstream_data["GIT_BRANCH"] - UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"] + UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"].substring(0,7) UPSTREAM_PROJECT_DATA = upstream_data test = "git@github.com:kikkomep/dtests.git" @@ -94,8 +94,9 @@ pipeline { DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() // Define Docker Image TAG - DOCKER_IMAGE_TAG = "${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = sh(returnStdout: true, script: "TAG=${REPO_TAG:-${UPSTREAM_GIT_COMMIT}}; echo \"${TAG} ${TAG}_build${BUILD_NUMBER}\"").trim() + TAG = sh(returnStdout: true, script: "if [ -n '${REPO_TAG}' ]; then echo ${REPO_TAG}; else echo ${UPSTREAM_GIT_COMMIT}; fi").trim() + DOCKER_IMAGE_TAG = "${TAG}_build${BUILD_NUMBER}" + DOCKER_IMAGE_TAG_EXTRA = "${TAG} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" // TODO: set revisions From 8586db5228f217c6ae72052f47f8451fcdc7a0d6 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 23:39:14 +0100 Subject: [PATCH 054/200] Move image version tag --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08a4acd..0e3d4fe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ DOCKER_IMAGE_LATEST = "" DOCKER_IMAGE_TAG = "" DOCKER_IMAGE_TAG_EXTRA = "" DOCKER_REPOSITORY_OWNER = "dhealth" -DOCKER_BASE_IMAGE_VERSION_TAG = "" +DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" // Upstream project data UPSTREAM_GIT_REPO = "" UPSTREAM_GIT_BRANCH = "" @@ -97,8 +97,7 @@ pipeline { TAG = sh(returnStdout: true, script: "if [ -n '${REPO_TAG}' ]; then echo ${REPO_TAG}; else echo ${UPSTREAM_GIT_COMMIT}; fi").trim() DOCKER_IMAGE_TAG = "${TAG}_build${BUILD_NUMBER}" DOCKER_IMAGE_TAG_EXTRA = "${TAG} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" - + // TODO: set revisions switch(UPSTREAM_GIT_REPO){ case EDDL_REPOSITORY: From 253cc843b02e5aca3d6c800c0ee7c2afaefcd721 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 12 Feb 2020 23:42:49 +0100 Subject: [PATCH 055/200] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e3d4fe..4c586f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -207,7 +207,7 @@ pipeline { sh "echo ${DOCKER_IMAGE_TAG}" sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" - sh 'CONFIG_FILE="" make build_eddl' + sh "CONFIG_FILE='' make build_eddl" // docker.withRegistry( '', registryCredential ) { // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' From 15e000faf4a56805b7e02bd7330408febb2543fb Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 00:04:37 +0100 Subject: [PATCH 056/200] Update stages --- Jenkinsfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c586f9..8d9ce8f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,6 +58,7 @@ pipeline { // Skip DockerHub DOCKER_LOGIN_DONE = true DOCKER_USER = "deephealth" + DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" } stages { @@ -131,7 +132,7 @@ pipeline { stage('Use configured variable') { when { - expression { return "$UPSTREAM_PROJECT_DATA" != "" } + expression { return "${UPSTREAM_PROJECT_DATA}" != "" } } steps { @@ -148,6 +149,7 @@ pipeline { } } + stage('Build') { parallel { @@ -195,6 +197,11 @@ pipeline { expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } } } + environment{ + EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" + EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" + EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" + } steps { script { sh "echo ${UPSTREAM_GIT_REPO}" @@ -215,6 +222,7 @@ pipeline { } } } + stage('PyEDDL Build') { when { @@ -280,7 +288,7 @@ pipeline { parallel { - stage('Test EDDL') { + stage('Test EDDL') { when { anyOf { expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } ; From dbd6c30d4e80222aea8b43c0ab81f515cc0e6a34 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 00:32:01 +0100 Subject: [PATCH 057/200] Update test --- Jenkinsfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8d9ce8f..2cec93b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -295,8 +295,13 @@ pipeline { not { triggeredBy 'UpstreamCause' } } } + environment{ + EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" + EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" + EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" + } agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } + docker { image 'libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } } steps { sh 'cd ${EDDL_SRC}/build && ctest -C Debug -VV' From 1ed803e074ffbf5dbbab14974bca8d26dc0f456b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 00:39:01 +0100 Subject: [PATCH 058/200] Conditional --- Jenkinsfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2cec93b..f822dfe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -291,8 +291,8 @@ pipeline { stage('Test EDDL') { when { anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } ; - not { triggeredBy 'UpstreamCause' } + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "" } } } environment{ @@ -301,7 +301,7 @@ pipeline { EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" } agent { - docker { image 'libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } + docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } } steps { sh 'cd ${EDDL_SRC}/build && ctest -C Debug -VV' @@ -311,8 +311,8 @@ pipeline { stage('Test PyEDDL') { when { anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } ; - not { triggeredBy 'UpstreamCause' } + expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "" } } } agent { @@ -328,8 +328,8 @@ pipeline { stage('Test ECVL') { when { anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } ; - not { triggeredBy 'UpstreamCause' } + expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "" } } } agent { @@ -343,8 +343,8 @@ pipeline { stage('Test PyECVL') { when { anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } ; - not { triggeredBy 'UpstreamCause' } + expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "" } } } agent { From 5fe08fbe9acec2e17838e473982d6db692a9a71f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 00:46:58 +0100 Subject: [PATCH 059/200] Test with different agent --- Jenkinsfile | 109 ++++++++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f822dfe..66f2dd3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -300,66 +300,67 @@ pipeline { EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" } - agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } - } + // agent { + // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } + // } steps { - sh 'cd ${EDDL_SRC}/build && ctest -C Debug -VV' + sh 'docker run --rm libs-toolkit:${EDDL_IMAGE_VERSION_TAG} -- cd ${EDDL_SRC}/build && ctest -C Debug -VV' } } - stage('Test PyEDDL') { - when { - anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } - expression { return "${UPSTREAM_GIT_REPO}" == "" } - } - } - agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } - } - steps { - sh 'cd ${PYEDDL_SRC} && pytest tests' - sh 'cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py' - sh 'cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1' - } - } + // stage('Test PyEDDL') { + // when { + // anyOf { + // expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } + // expression { return "${UPSTREAM_GIT_REPO}" == "" } + // } + // } + // agent { + // docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } + // } + // steps { + // sh 'cd ${PYEDDL_SRC} && pytest tests' + // sh 'cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py' + // sh 'cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1' + // } + // } - stage('Test ECVL') { - when { - anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } - expression { return "${UPSTREAM_GIT_REPO}" == "" } - } - } - agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } - } - steps { - sh 'cd ${ECVL_SRC}/build && ctest -C Debug -VV' - } - } + // stage('Test ECVL') { + // when { + // anyOf { + // expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } + // expression { return "${UPSTREAM_GIT_REPO}" == "" } + // } + // } + // agent { + // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } + // } + // steps { + // sh 'cd ${ECVL_SRC}/build && ctest -C Debug -VV' + // } + // } + + // stage('Test PyECVL') { + // when { + // anyOf { + // expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } + // expression { return "${UPSTREAM_GIT_REPO}" == "" } + // } + // } + // agent { + // docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } + // } + // steps { + // sh 'cd ${PYECVL_SRC} && pytest tests' + // sh 'cd ${PYECVL_SRC}/examples && python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml"' + // sh 'cd ${PYECVL_SRC}/examples && python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml"' + // sh 'cd ${PYECVL_SRC}/examples && python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/data/isic_dicom/ISIC_0000008.dcm"' + // sh 'cd ${PYECVL_SRC}/examples && python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg"' + // sh 'cd ${PYECVL_SRC}/examples && python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi"' + // sh 'cd ${PYECVL_SRC}/examples && python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg test_mod.jpg"' + // } + // } - stage('Test PyECVL') { - when { - anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } - expression { return "${UPSTREAM_GIT_REPO}" == "" } - } - } - agent { - docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } - } - steps { - sh 'cd ${PYECVL_SRC} && pytest tests' - sh 'cd ${PYECVL_SRC}/examples && python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml"' - sh 'cd ${PYECVL_SRC}/examples && python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml"' - sh 'cd ${PYECVL_SRC}/examples && python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/data/isic_dicom/ISIC_0000008.dcm"' - sh 'cd ${PYECVL_SRC}/examples && python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg"' - sh 'cd ${PYECVL_SRC}/examples && python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi"' - sh 'cd ${PYECVL_SRC}/examples && python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg test_mod.jpg"' - } - } } } From a46ce1723266f9566d6e41cfc8faa24619dcccee Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 01:32:26 +0100 Subject: [PATCH 060/200] Update pipeline --- Jenkinsfile | 392 +++++++--------------------------------------------- 1 file changed, 52 insertions(+), 340 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 66f2dd3..6f5d8f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -149,361 +149,73 @@ pipeline { } } - - stage('Build') { - + stage("Docker images"){ + parallel { - - stage('Master Build') { - when { - allOf { - branch 'master' ; - not { triggeredBy 'UpstreamCause' } - } - } - steps { - script { - sh 'make build' - docker.withRegistry( '', registryCredential ) { - sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - } - } - } - } - - // stage('Development Build') { - // when { - // allOf { - // not { branch "master" } ; - // triggeredBy 'UpstreamCause' - // } - // } - // steps { - // script { - // sh 'CONFIG_FILE="" make build' - // docker.withRegistry( '', registryCredential ) { - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - // } - // } - // } - // } - - stage('EDDL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } - } - } - environment{ - EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" - EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" - EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" - } - steps { - script { - sh "echo ${UPSTREAM_GIT_REPO}" - sh "echo ${UPSTREAM_GIT_BRANCH}" - sh "echo ${UPSTREAM_GIT_COMMIT}" - sh "echo ${UPSTREAM_PROJECT_DATA}" - sh "echo ${REPO_TAG}" - sh "echo ${NORMALIZED_BRANCH_NAME}" - sh "echo ${DOCKER_IMAGE_LATEST}" - sh "echo ${DOCKER_IMAGE_TAG}" - sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" - sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" - sh "CONFIG_FILE='' make build_eddl" - // docker.withRegistry( '', registryCredential ) { - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - // } - } - } - } - - stage('PyEDDL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } - } - } - steps { - script { - sh 'CONFIG_FILE="" make build_pyeddl' - // docker.withRegistry( '', registryCredential ) { - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - // } - } - } - } - - stage('ECVL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } - } - } - steps { - script { - sh 'CONFIG_FILE="" make build_ecvl' - // docker.withRegistry( '', registryCredential ) { - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - // } - } - } - } - - stage('PyECVL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } - } - } - steps { - script { - sh 'CONFIG_FILE="" make build_pyecvl' - // docker.withRegistry( '', registryCredential ) { - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - // } - } - } - } - - - - - } - } - - stage('Test') { - - parallel { - - stage('Test EDDL') { - when { - anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } - expression { return "${UPSTREAM_GIT_REPO}" == "" } - } - } - environment{ - EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" - EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" - EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" - } - // agent { - // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } - // } - steps { - sh 'docker run --rm libs-toolkit:${EDDL_IMAGE_VERSION_TAG} -- cd ${EDDL_SRC}/build && ctest -C Debug -VV' - } - } - - // stage('Test PyEDDL') { - // when { - // anyOf { - // expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } - // expression { return "${UPSTREAM_GIT_REPO}" == "" } - // } - // } - // agent { - // docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } - // } - // steps { - // sh 'cd ${PYEDDL_SRC} && pytest tests' - // sh 'cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py' - // sh 'cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1' - // } - // } - - // stage('Test ECVL') { - // when { - // anyOf { - // expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } - // expression { return "${UPSTREAM_GIT_REPO}" == "" } - // } - // } - // agent { - // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${DOCKER_IMAGE_TAG}' } - // } - // steps { - // sh 'cd ${ECVL_SRC}/build && ctest -C Debug -VV' - // } - // } - - // stage('Test PyECVL') { - // when { - // anyOf { - // expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } - // expression { return "${UPSTREAM_GIT_REPO}" == "" } - // } - // } - // agent { - // docker { image '${DOCKER_REPOSITORY_OWNER}/pylibs-toolkit:${DOCKER_IMAGE_TAG}' } - // } - // steps { - // sh 'cd ${PYECVL_SRC} && pytest tests' - // sh 'cd ${PYECVL_SRC}/examples && python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml"' - // sh 'cd ${PYECVL_SRC}/examples && python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml"' - // sh 'cd ${PYECVL_SRC}/examples && python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/data/isic_dicom/ISIC_0000008.dcm"' - // sh 'cd ${PYECVL_SRC}/examples && python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg"' - // sh 'cd ${PYECVL_SRC}/examples && python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi"' - // sh 'cd ${PYECVL_SRC}/examples && python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg test_mod.jpg"' - // } - // } - - } - } - - stage('Publish') { - - parallel { - - stage('Publish Master Build') { - when { - allOf { - branch 'master'; - not { triggeredBy 'UpstreamCause' } - } - } - steps { - script { - docker.withRegistry( '', registryCredential ) { - sh ''' - tag=$(git tag -l --points-at HEAD); - if [ -n "${tag}" ]; then - REPO_TAG="${tag}" - else - REPO_TAG=$(git rev-parse --short HEAD --short) - fi - DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_TAG_EXTRA} ${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" - echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" - make push - ''' + stage("EDDL"){ + stages { + stage('EDDL Build') { + when { + allOf { + triggeredBy 'UpstreamCause' ; + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + } } - } - } - } - - stage('Publish Development Build') { - when { - allOf { - not { branch "master" }; - triggeredBy 'UpstreamCause' - } - } - steps { - script { - docker.withRegistry( '', registryCredential ) { - sh ''' - tag=$(git tag -l --points-at HEAD); - if [ -n "${tag}" ]; then - REPO_TAG="${tag}" - else - REPO_TAG=$(git rev-parse --short HEAD --short) - fi - DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_TAG_EXTRA} ${REPO_TAG} ${REPO_TAG}_build${BUILD_NUMBER}" - echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" - CONFIG_FILE="" make push - ''' + environment{ + EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" + EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" + EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" } - } - } - } - - - stage('Publish EDDL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } - } - } - steps { - script { - docker.withRegistry( '', registryCredential ) { - sh ''' - echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" - CONFIG_FILE="" make push_eddl_toolkit - CONFIG_FILE="" make push_eddl - ''' + steps { + script { + sh "echo ${UPSTREAM_GIT_REPO}" + sh "echo ${UPSTREAM_GIT_BRANCH}" + sh "echo ${UPSTREAM_GIT_COMMIT}" + sh "echo ${UPSTREAM_PROJECT_DATA}" + sh "echo ${REPO_TAG}" + sh "echo ${NORMALIZED_BRANCH_NAME}" + sh "echo ${DOCKER_IMAGE_LATEST}" + sh "echo ${DOCKER_IMAGE_TAG}" + sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" + sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" + sh "CONFIG_FILE='' make build_eddl" + // docker.withRegistry( '', registryCredential ) { + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' + // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' + // } + } } } - } - } - - stage('Publish PyEDDL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${PYEDDL_REPOSITORY}" } - } - } - steps { - script { - docker.withRegistry( '', registryCredential ) { - sh ''' - echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" - CONFIG_FILE="" make push_pyeddl_toolkit - CONFIG_FILE="" make push_pyeddl - ''' + stage('Test EDDL') { + when { + anyOf { + expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + expression { return "${UPSTREAM_GIT_REPO}" == "" } + } } - } - } - } - - stage('Publish ECVL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${ECVL_REPOSITORY}" } - } - } - steps { - script { - docker.withRegistry( '', registryCredential ) { - sh ''' - echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" - CONFIG_FILE="" make push_ecvl_toolkit - CONFIG_FILE="" make push_ecvl - ''' + environment{ + EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" + EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" + EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" } - } - } - } - - stage('Publish PyECVL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${PYECVL_REPOSITORY}" } - } - } - steps { - script { - docker.withRegistry( '', registryCredential ) { - sh ''' - echo "Pushing tags: ${DOCKER_IMAGE_TAG_EXTRA}" - CONFIG_FILE="" make push_ecvl_toolkit - CONFIG_FILE="" make push_ecvl - ''' + // agent { + // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } + // } + steps { + // sh 'docker run --rm libs-toolkit:${EDDL_IMAGE_VERSION_TAG} -- cd ${EDDL_SRC}/build && ctest -C Debug -VV' + sh "echo 'Testing libs-toolkit:${EDDL_IMAGE_VERSION_TAG}'" } } } } - + } + } + + } post { From 8de85d9cc10f14e7030fedffdda3befb153570a1 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 01:37:02 +0100 Subject: [PATCH 061/200] Comment env --- Jenkinsfile | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6f5d8f0..a74a216 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -154,6 +154,11 @@ pipeline { parallel { stage("EDDL"){ + environment{ + EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" + EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" + EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" + } stages { stage('EDDL Build') { when { @@ -162,13 +167,9 @@ pipeline { expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } } } - environment{ - EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" - EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" - EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" - } + steps { - script { + sh "echo ${UPSTREAM_GIT_REPO}" sh "echo ${UPSTREAM_GIT_BRANCH}" sh "echo ${UPSTREAM_GIT_COMMIT}" @@ -184,27 +185,27 @@ pipeline { // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' // } - } + } } stage('Test EDDL') { - when { - anyOf { - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } - expression { return "${UPSTREAM_GIT_REPO}" == "" } - } - } - environment{ - EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" - EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" - EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" - } + // when { + // anyOf { + // expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } + // expression { return "${UPSTREAM_GIT_REPO}" == "" } + // } + // } + // environment{ + // EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" + // EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" + // EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" + // } // agent { // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } // } steps { - // sh 'docker run --rm libs-toolkit:${EDDL_IMAGE_VERSION_TAG} -- cd ${EDDL_SRC}/build && ctest -C Debug -VV' - sh "echo 'Testing libs-toolkit:${EDDL_IMAGE_VERSION_TAG}'" + sh "echo 'Testing eddl-toolkit:${EDDL_IMAGE_VERSION_TAG}'" + sh 'docker run --rm eddl-toolkit:${EDDL_IMAGE_VERSION_TAG} /bin/bash -c "cd ${EDDL_SRC}/build && ctest -C Debug -VV"' } } } From 1968800418fa4584fcfaafe555b2b7b8368d0f57 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 02:05:43 +0100 Subject: [PATCH 062/200] Listen all EDDL upstream branches --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a74a216..3e5c6f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } triggers{ upstream( - upstreamProjects: 'DeepHealth/eddl/master,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', + upstreamProjects: 'DeepHealth/eddl,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', threshold: hudson.model.Result.SUCCESS) } environment { From d4415a19f05e3f239711e1e00d04ce3decd6abe9 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 02:14:27 +0100 Subject: [PATCH 063/200] Allow all branches --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e5c6f9..a74a216 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } triggers{ upstream( - upstreamProjects: 'DeepHealth/eddl,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', + upstreamProjects: 'DeepHealth/eddl/master,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', threshold: hudson.model.Result.SUCCESS) } environment { From 56c34fe88365b1a32f1d1f8c36bdde1c11803d13 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 02:41:37 +0100 Subject: [PATCH 064/200] Update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a74a216..3e5c6f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } triggers{ upstream( - upstreamProjects: 'DeepHealth/eddl/master,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', + upstreamProjects: 'DeepHealth/eddl,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', threshold: hudson.model.Result.SUCCESS) } environment { From 692c12b8e1ec41c140b9c795d94c1d06b0e30e03 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 02:46:52 +0100 Subject: [PATCH 065/200] Test with prova --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e5c6f9..87d025b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } triggers{ upstream( - upstreamProjects: 'DeepHealth/eddl,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', + upstreamProjects: 'DeepHealth/prova/master,DeepHealth/eddl/master,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', threshold: hudson.model.Result.SUCCESS) } environment { From fc68c9ea7e3a66452786770b5a59fc25dcf9b038 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 03:04:56 +0100 Subject: [PATCH 066/200] All branches test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 87d025b..3e5c6f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } triggers{ upstream( - upstreamProjects: 'DeepHealth/prova/master,DeepHealth/eddl/master,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', + upstreamProjects: 'DeepHealth/eddl,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', threshold: hudson.model.Result.SUCCESS) } environment { From 597562c3effce9adbdccf2ba57ff3290af14a362 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 16:52:39 +0100 Subject: [PATCH 067/200] Remove white-space --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f282e34..5485d5a 100644 --- a/Makefile +++ b/Makefile @@ -205,7 +205,7 @@ libs_folder: @mkdir -p ${LOCAL_LIBS_PATH} ; \ ) -_eddl_folder: libs_folder +_eddl_folder: libs_folder @$(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ ) From 93f72867d1ac94aa4b039c7219c5eac9fe2b787a Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 17:15:22 +0100 Subject: [PATCH 068/200] Debug --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5485d5a..f2846be 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,7 @@ define clone_repository && cd "${1}" \ && if [ -n "${4}" ]; then git reset --hard ${4} -- ; fi \ && if [ ${5} == true ]; then git submodule update --init --recursive ; fi \ - && cd - \ + && cd - ; \ else \ echo "Using existing ${1} repository..." ; \ fi @@ -206,12 +206,12 @@ libs_folder: ) _eddl_folder: libs_folder - @$(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ + $(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ ) eddl_folder: _eddl_folder - $(eval EDDL_REVISION := $(call get_revision,libs/eddl,${EDDL_REVISION})) + #$(eval EDDL_REVISION := $(call get_revision,libs/eddl,${EDDL_REVISION})) define clone_ecvl From 9e1a91b722583ed0428af765538f06cd53dba5e2 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 17:33:59 +0100 Subject: [PATCH 069/200] Restore revision --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f2846be..32d40f1 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ _eddl_folder: libs_folder ) eddl_folder: _eddl_folder - #$(eval EDDL_REVISION := $(call get_revision,libs/eddl,${EDDL_REVISION})) + $(eval EDDL_REVISION := $(call get_revision,libs/eddl,${EDDL_REVISION})) define clone_ecvl From bb096796f13d4e0d4ad5efd84c4811b0af80bdee Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 17:59:07 +0100 Subject: [PATCH 070/200] Set repository owner --- settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index 9f7a189..a2d83e9 100644 --- a/settings.sh +++ b/settings.sh @@ -11,7 +11,7 @@ DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 DOCKER_REGISTRY=registry.hub.docker.com # set Docker repository -#DOCKER_REPOSITORY_OWNER=dhealth +DOCKER_REPOSITORY_OWNER=dhealth DOCKER_IMAGE_PREFIX= # latest tag settings From 574184aa40cadf7104715e2ffc82b62d14ad3e97 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 18:02:23 +0100 Subject: [PATCH 071/200] Comment DOCKER_REGISTRY property --- settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index a2d83e9..5b91115 100644 --- a/settings.sh +++ b/settings.sh @@ -8,7 +8,7 @@ DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 #DOCKER_PASSWORD="" # use DockerHub as default registry -DOCKER_REGISTRY=registry.hub.docker.com +#DOCKER_REGISTRY=registry.hub.docker.com # set Docker repository DOCKER_REPOSITORY_OWNER=dhealth From 7e84883e51ec78f193ba13bf11aa39e3734937bb Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 18:24:04 +0100 Subject: [PATCH 072/200] Fix login procedure --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 32d40f1..f1fe535 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ DOCKER_USER := $(or ${DOCKER_USER},${USER}) DOCKER_PASSWORD := ${DOCKER_PASSWORD} # use DockerHub as default registry -DOCKER_REGISTRY := $(or ${DOCKER_REGISTRY},registry.hub.docker.com) +DOCKER_REGISTRY := $(or ${DOCKER_REGISTRY},) # set Docker repository DOCKER_REPOSITORY_OWNER := $(or ${DOCKER_REPOSITORY_OWNER},${DOCKER_USER}) @@ -572,15 +572,18 @@ publish_pyeddl_toolkit: build_pyeddl_toolkit push_pyeddl_toolkit ## Publish 'pye publish_pyecvl_toolkit: build_pyecvl_toolkit push_pyecvl_toolkit ## Publish 'pyecvl-toolkit' images # login to the Docker HUB repository -repo-login: ## Login to the Docker Registry +_repo-login: ## Login to the Docker Registry @if [[ ${DOCKER_LOGIN_DONE} == false ]]; then \ echo "Logging into Docker registry ${DOCKER_REGISTRY}..." ; \ - docker login ${DOCKER_REGISTRY} -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ; \ - DOCKER_LOGIN_DONE=true ;\ + echo ${DOCKER_PASSWORD} | docker login ${DOCKER_REGISTRY} --username ${DOCKER_USER} --password-stdin \ else \ echo "Logging into Docker registry already done" ; \ fi +repo-login: _repo-login ## Login to the Docker Registry + $(eval DOCKER_LOGIN_DONE := true) + + version: ## Output the current version of this Makefile @echo $(VERSION) From 97c5daf5b4692c19c4ebb4855a55ece00e8c5622 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 18:43:46 +0100 Subject: [PATCH 073/200] Do not login by default --- settings.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/settings.sh b/settings.sh index 5b91115..371b0c7 100644 --- a/settings.sh +++ b/settings.sh @@ -3,6 +3,8 @@ DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 +DOCKER_LOGIN_DONE=true + # set docker user credentials #DOCKER_USER=deephealth #DOCKER_PASSWORD="" From 1224d92e7877e22d96a8f8dfca38897ea15c7558 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 23:17:35 +0100 Subject: [PATCH 074/200] Fix dependencies --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index f1fe535..c3ac19c 100644 --- a/Makefile +++ b/Makefile @@ -373,7 +373,7 @@ build_ecvl: _build_libs_base build_ecvl_toolkit## Build 'ecvl' image --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=${ECVL_REVISION},eddl:$(DOCKER_IMAGE_TAG),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},eddl:$(EDDL_IMAGE_VERSION_TAG),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_libs: build_ecvl ## Build 'libs' image $(call build_image,libs,libs,${DOCKER_IMAGE_TAG},\ @@ -389,10 +389,10 @@ build_libs: build_ecvl ## Build 'libs' image ############# pylibs-toolkit ############# -_build_pylibs_base_toolkit: build_libs_toolkit - $(call build_image,pylibs,pylibs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-toolkit:$(DOCKER_IMAGE_TAG)) +_build_pylibs_base_toolkit: build_ecvl_toolkit + $(call build_image,pylibs,pylibs-base-toolkit,${ECVL_IMAGE_VERSION_TAG},,ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) -build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit ## Build 'pyeddl-toolkit' image +build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call build_image,pylibs,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ @@ -404,7 +404,7 @@ build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit ## Build 'pyeddl- --label ECVL_REVISION=${ECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(DOCKER_IMAGE_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) @@ -443,8 +443,8 @@ build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image ############# pylibs ############# -_build_pylibs_base: _build_libs_base - $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,libs-base:$(DOCKER_IMAGE_TAG)) +_build_pylibs_base: build_ecvl + $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,ecvl:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) @@ -457,7 +457,7 @@ build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image --label ECVL_REVISION=${ECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_IMAGE_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) build_pyecvl: build_pyeddl build_pyecvl_toolkit ## Build 'pyecvl' image $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) From 394afda8a1ec6a855145e001ca80c5b639119d8a Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 13 Feb 2020 23:17:56 +0100 Subject: [PATCH 075/200] Update pyeddl revision to 0.3.0 --- settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index 371b0c7..e185cdf 100644 --- a/settings.sh +++ b/settings.sh @@ -35,7 +35,7 @@ PYECVL_REVISION=0.1.0 # EDDL repository EDDL_REPOSITORY=https://github.com/deephealthproject/eddl.git EDDL_BRANCH=master -EDDL_REVISION=0.3 +EDDL_REVISION=v0.3.1 # PyEDDL repository PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git From ed065ce0fe587775b1f3f9071b062bafd869962b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 00:05:14 +0100 Subject: [PATCH 076/200] Enable build of ECVL examples --- libs/ecvl-toolkit.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ecvl-toolkit.Dockerfile b/libs/ecvl-toolkit.Dockerfile index e55d8bc..1c2ee3f 100644 --- a/libs/ecvl-toolkit.Dockerfile +++ b/libs/ecvl-toolkit.Dockerfile @@ -22,12 +22,12 @@ RUN echo "\nBuilding ECVL library..." >&2 \ && mkdir build \ && cd build \ && cmake \ + -D ECVL_BUILD_EXAMPLES=ON \ -D ECVL_BUILD_GUI=OFF \ -D ECVL_WITH_OPENSLIDE=ON \ -D ECVL_DATASET_PARSER=ON \ -D ECVL_WITH_DICOM=ON \ -D ECVL_BUILD_EDDL=ON \ - -D EDDL_DIR=${EDDL_SRC}/build/install \ .. \ && make -j$(grep -c ^processor /proc/cpuinfo) \ && echo "\n Installing ECVL library..." >&2 \ From bb728a6c9d8a8f712a627c8d98e59c9728efa4ea Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 09:33:19 +0100 Subject: [PATCH 077/200] Add tests --- Makefile | 66 ++++++++++++++++++++++++++++++++++++++++++++ tests/test_ecvl.sh | 5 ++++ tests/test_eddl.sh | 5 ++++ tests/test_pyecvl.sh | 13 +++++++++ tests/test_pyeddl.sh | 7 +++++ 5 files changed, 96 insertions(+) create mode 100644 tests/test_ecvl.sh create mode 100644 tests/test_eddl.sh create mode 100644 tests/test_pyecvl.sh create mode 100644 tests/test_pyeddl.sh diff --git a/Makefile b/Makefile index c3ac19c..3d2e5a4 100644 --- a/Makefile +++ b/Makefile @@ -490,6 +490,72 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl:$(PYECVL_IMAGE_VERSION_TAG)) + +############################################################################################################################ +### Tests +############################################################################################################################ + +define test_image + $(eval image := $(1)) + $(eval test_script := $(2)) + $(eval toolkit_image := $(3)) + $(eval host_path := $(shell echo ${CURRENT_PATH}/$(4) | sed -e 's+[[:space:]]++g')) + $(eval container_path := $(5)) + $(eval container := $(shell if [[ -n "${toolkit_image}" ]]; then docker run -d ${toolkit_image} /bin/bash ; fi)) + echo "Test: ${test_script}' @ '${image}'..." ; \ + if [[ -n "${container}" ]]; then \ + docker cp ${container}:${container_path} ${host_path} ; \ + cat ${test_script} | ${DOCKER_RUN} -v ${host_path}:${container_path} ${image} /bin/sh ; \ + else \ + cat ${test_script} | ${DOCKER_RUN} ${image} /bin/sh ; \ + fi ; \ + docker container prune -f ; \ + echo "DONE" + +endef + +test_eddl: eddl_folder ## Test 'eddl' images + $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + @echo "No test available yet" + +test_eddl_toolkit: eddl_folder ## Test 'eddl' images + $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call test_image,eddl-toolkit:${EDDL_IMAGE_VERSION_TAG},tests/test_eddl.sh) + +test_ecvl: ecvl_folder ## Test 'ecvl' images + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + echo "No test available yet" + +test_ecvl_toolkit: ecvl_folder ## Test 'ecvl' images + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call test_image,ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG},tests/test_ecvl.sh) + +test_pyeddl: pyeddl_folder ## Test 'ecvl' images + $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call test_image,\ + pyeddl:${PYEDDL_IMAGE_VERSION_TAG},\ + tests/test_pyeddl.sh,\ + pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},\ + tests/pyeddl,/usr/local/src/pyeddl \ + ) + +test_pyeddl_toolkit: pyeddl_folder ## Test 'ecvl' images + $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call test_image,pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},tests/test_pyeddl.sh) + +test_pyecvl: pyecvl_folder ## Test 'ecvl' images + $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call test_image,\ + pyecvl:${PYECVL_IMAGE_VERSION_TAG},\ + tests/test_pyecvl.sh,\ + pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},\ + tests/pyecvl,/usr/local/src/pyecvl \ + ) + +test_pyecvl_toolkit: pyecvl_folder ## Test 'ecvl' images + $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) + ############################################################################################################################ ### Push Docker images ############################################################################################################################ diff --git a/tests/test_ecvl.sh b/tests/test_ecvl.sh new file mode 100644 index 0000000..00865cc --- /dev/null +++ b/tests/test_ecvl.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} + +cd ${ECVL_SRC}/build && ctest -C Debug -VV diff --git a/tests/test_eddl.sh b/tests/test_eddl.sh new file mode 100644 index 0000000..28c9507 --- /dev/null +++ b/tests/test_eddl.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +EDDL_SRC=${EDDL_SRC:-"/usr/local/src/eddl"} + +cd ${EDDL_SRC}/build && ctest -C Debug -VV diff --git a/tests/test_pyecvl.sh b/tests/test_pyecvl.sh new file mode 100644 index 0000000..09e3571 --- /dev/null +++ b/tests/test_pyecvl.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +PYECVL_SRC=${PYECVL_SRC:-"/usr/local/src/pyecvl"} + +cd ${PYECVL_SRC} && pytest tests + +cd ${PYECVL_SRC}/examples +python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml" +python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml" +python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/data/isic_dicom/ISIC_0000008.dcm" +python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg" +python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi" +python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg test_mod.jpg" \ No newline at end of file diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh new file mode 100644 index 0000000..8528f3e --- /dev/null +++ b/tests/test_pyeddl.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} + +cd ${PYEDDL_SRC} && pytest tests +cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py +cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1 From b03604137877b1c7c08dd59a67ed621b238060cd Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 11:02:25 +0100 Subject: [PATCH 078/200] Allow to disable Docker cache --- Makefile | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 3d2e5a4..c4e90db 100644 --- a/Makefile +++ b/Makefile @@ -78,8 +78,8 @@ include $(CONFIG_FILE) endif # set no cache option -DISABLE_CACHE ?= -BUILD_CACHE_OPT ?= +DISABLE_CACHE ?= +BUILD_CACHE_OPT ?= ifneq ("$(DISABLE_CACHE)", "") BUILD_CACHE_OPT = --no-cache endif @@ -93,6 +93,21 @@ endif # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) +# Arguments to execute tests with Docker +DOCKER_RUN := docker run -i --rm #-u 1000:1000 +ifeq (${GPU}, true) + DOCKER_RUN := ${DOCKER_RUN} --gpus 1 +endif + +define build_new_image + echo "Building Docker image '${image_name}'..." ; \ + cd ${image} \ + && docker build ${BUILD_CACHE_OPT} \ + -f ${target}.Dockerfile \ + ${base} ${toolkit} \ + -t ${image_name}:${tag} ${extra_tags} ${latest_tags} ${labels} . +endef + #$(if docker images -q ${image_name}:${tag} > /dev/null || docker images -q ${full_tag} > /dev/null, define build_image $(eval image := $(1)) @@ -109,17 +124,16 @@ define build_image @echo "Building Docker image '${image_name}'..." $(eval images := $(shell docker images -q ${tagged_image})) $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag})) - $(if ${images},\ - echo "Docker image '${tagged_image}' exists (id: ${images})", \ - $(if ${exists}, \ - echo "Pulling image '${full_image_name}:${tag}'..."; - docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ - echo "Building Docker image '${image_name}'..." ; \ - cd ${image} \ - && docker build ${BUILD_CACHE_OPT} \ - -f ${target}.Dockerfile \ - ${base} ${toolkit} \ - -t ${image_name}:${tag} ${extra_tags} ${latest_tags} ${labels} . \ + $(if ${DISABLE_CACHE},\ + echo "Cache disabled..." ; \ + $(call build_new_image), + $(if ${images},\ + echo "Docker image '${tagged_image}' exists (id: ${images})", \ + $(if ${exists}, \ + echo "Pulling image '${full_image_name}:${tag}'..."; + docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ + $(call build_new_image) + ) ) ) endef From 011adc9192444f35928da957aa4b4cca54cce819 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 11:05:16 +0100 Subject: [PATCH 079/200] Remove Jenkinsfile --- Jenkinsfile | 241 ---------------------------------------------------- 1 file changed, 241 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 3e5c6f9..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,241 +0,0 @@ - -// ECVL Settings -ECVL_REPOSITORY = "https://github.com/deephealthproject/ecvl.git" -ECVL_BRANCH = "master" -ECVL_REVISION = "" -ECVL_IMAGE_VERSION_TAG = "" -// PyECVL Settings -PYECVL_REPOSITORY = "https://github.com/deephealthproject/pyecvl.git" -PYECVL_BRANCH = "master" -PYECVL_REVISION = "" -PYECVL_IMAGE_VERSION_TAG = "" -// EDDL Settings -EDDL_REPOSITORY = "https://github.com/deephealthproject/eddl.git" -EDDL_BRANCH = "master" -EDDL_REVISION = "" -EDDL_IMAGE_VERSION_TAG = "" -// PyEDDL Settings -PYEDDL_REPOSITORY = "https://github.com/deephealthproject/pyeddl.git" -PYEDDL_BRANCH = "master" -PYEDDL_REVISION = "" -PYEDDL_IMAGE_VERSION_TAG = "" -// Extract additional info -REPO_TAG = "" -NORMALIZED_BRANCH_NAME = "" -// Docker Settings -DOCKER_IMAGE_LATEST = "" -DOCKER_IMAGE_TAG = "" -DOCKER_IMAGE_TAG_EXTRA = "" -DOCKER_REPOSITORY_OWNER = "dhealth" -DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" -// Upstream project data -UPSTREAM_GIT_REPO = "" -UPSTREAM_GIT_BRANCH = "" -UPSTREAM_GIT_REVISION = "" -UPSTREAM_PROJECT_DATA = "" - -//////////////////////////////////////////////////////////////////////////////////////////// -// Pipeline Definition -//////////////////////////////////////////////////////////////////////////////////////////// -pipeline { - agent { - node { label 'docker && linux && !gpu' } - } - triggers{ - upstream( - upstreamProjects: 'DeepHealth/eddl,DeepHealth/ecvl/master,DeepHealth/pyeddl/master,DeepHealth/pyecvl/master', - threshold: hudson.model.Result.SUCCESS) - } - environment { - BASE_SRC = "/usr/local/src" - ECVL_SRC = "${BASE_SRC}/ecvl" - EDDL_SRC = "${BASE_SRC}/eddl" - PYECVL_SRC = "${BASE_SRC}/pyecvl" - PYEDDL_SRC = "${BASE_SRC}/pyeddl" - - // Docker credentials - registryCredential = 'dockerhub-deephealthproject' - // Skip DockerHub - DOCKER_LOGIN_DONE = true - DOCKER_USER = "deephealth" - DOCKER_BASE_IMAGE_VERSION_TAG = "0.1.8" - } - stages { - - stage('Configure') { - steps { - // Load tags - sh 'git fetch --tags' - - - script { - // Set defaults - ECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${ECVL_REPOSITORY} ${ECVL_BRANCH} | awk '{print \$1}'").trim() - PYECVL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYECVL_REPOSITORY} ${PYECVL_BRANCH} | awk '{print \$1}'").trim() - EDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${EDDL_REPOSITORY} ${EDDL_BRANCH} | awk '{print \$1}'").trim() - PYEDDL_REVISION = sh(returnStdout: true, script: "git ls-remote ${PYEDDL_REPOSITORY} ${PYEDDL_BRANCH} | awk '{print \$1}'").trim() - REPO_TAG = sh(returnStdout: true, script: "tag=\$(git tag -l --points-at HEAD); if [[ -n \${tag} ]]; then echo \${tag}; else git rev-parse --short HEAD --short; fi").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${BRANCH_NAME} | sed 's+/+-+g'").trim() - DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() - // Extract upstream project - currentBuild.upstreamBuilds?.each { b -> - upstream_data = b.getBuildVariables() - UPSTREAM_GIT_REPO = upstream_data["GIT_URL"] - UPSTREAM_GIT_BRANCH = upstream_data["GIT_BRANCH"] - UPSTREAM_GIT_COMMIT = upstream_data["GIT_COMMIT"].substring(0,7) - UPSTREAM_PROJECT_DATA = upstream_data - test = "git@github.com:kikkomep/dtests.git" - - - BUILD_NUMBER = "34" - - // overwrite repo tag using the upstream repo - REPO_TAG = sh(returnStdout: true, script: "git ls-remote --tags ${UPSTREAM_GIT_REPO} | sed -nE 's+(${UPSTREAM_GIT_COMMIT})[[:space:]]*refs/tags/([[:alnum:]]{1,})+\2+p'").trim() - NORMALIZED_BRANCH_NAME = sh(returnStdout: true, script: "echo ${UPSTREAM_GIT_BRANCH} | sed -e 's+origin/++; s+/+-+g'").trim() - DOCKER_IMAGE_LATEST = sh(returnStdout: true, script: "if [ '${UPSTREAM_GIT_BRANCH}' = 'master' ]; then echo 'true'; else echo 'false'; fi").trim() - - // Define Docker Image TAG - TAG = sh(returnStdout: true, script: "if [ -n '${REPO_TAG}' ]; then echo ${REPO_TAG}; else echo ${UPSTREAM_GIT_COMMIT}; fi").trim() - DOCKER_IMAGE_TAG = "${TAG}_build${BUILD_NUMBER}" - DOCKER_IMAGE_TAG_EXTRA = "${TAG} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - - // TODO: set revisions - switch(UPSTREAM_GIT_REPO){ - case EDDL_REPOSITORY: - EDDL_BRANCH = UPSTREAM_GIT_BRANCH - EDDL_REVISION = UPSTREAM_GIT_COMMIT - EDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case ECVL_REPOSITORY: - ECVL_BRANCH = UPSTREAM_GIT_BRANCH - ECVL_REVISION = UPSTREAM_GIT_COMMIT - ECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case PYEDDL_REPOSITORY: - PYEDDL_BRANCH = UPSTREAM_GIT_BRANCH - PYEDDL_REVISION = UPSTREAM_GIT_COMMIT - PYEDDL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case PYECVL_REPOSITORY: - PYECVL_BRANCH = UPSTREAM_GIT_BRANCH - PYECVL_REVISION = UPSTREAM_GIT_COMMIT - PYECVL_IMAGE_VERSION_TAG = DOCKER_IMAGE_TAG - case test: - ECVL_REVISION = UPSTREAM_GIT_COMMIT - echo "Test REPOSITORY: $ECVL_REVISION $UPSTREAM_GIT_COMMIT" - default: - echo "Default repo" - } - } - } - // Print current environment (just for debug) - sh 'printenv' - } - } - - stage('Use configured variable') { - when { - expression { return "${UPSTREAM_PROJECT_DATA}" != "" } - } - - steps { - sh "echo ${UPSTREAM_GIT_REPO}" - sh "echo ${UPSTREAM_GIT_BRANCH}" - sh "echo ${UPSTREAM_GIT_COMMIT}" - sh "echo ${UPSTREAM_PROJECT_DATA}" - sh "echo ${REPO_TAG}" - sh "echo ${NORMALIZED_BRANCH_NAME}" - sh "echo ${DOCKER_IMAGE_LATEST}" - sh "echo ${DOCKER_IMAGE_TAG}" - sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" - sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" - } - } - - stage("Docker images"){ - - parallel { - - stage("EDDL"){ - environment{ - EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" - EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" - EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" - } - stages { - stage('EDDL Build') { - when { - allOf { - triggeredBy 'UpstreamCause' ; - expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } - } - } - - steps { - - sh "echo ${UPSTREAM_GIT_REPO}" - sh "echo ${UPSTREAM_GIT_BRANCH}" - sh "echo ${UPSTREAM_GIT_COMMIT}" - sh "echo ${UPSTREAM_PROJECT_DATA}" - sh "echo ${REPO_TAG}" - sh "echo ${NORMALIZED_BRANCH_NAME}" - sh "echo ${DOCKER_IMAGE_LATEST}" - sh "echo ${DOCKER_IMAGE_TAG}" - sh "echo ${DOCKER_IMAGE_TAG_EXTRA}" - sh "echo ${DOCKER_BASE_IMAGE_VERSION_TAG}" - sh "CONFIG_FILE='' make build_eddl" - // docker.withRegistry( '', registryCredential ) { - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_libs_toolkit' - // sh 'CONFIG_FILE="" DOCKER_IMAGE_TAG_EXTRA="" make push_pylibs_toolkit' - // } - - } - } - stage('Test EDDL') { - // when { - // anyOf { - // expression { return "${UPSTREAM_GIT_REPO}" == "${EDDL_REPOSITORY}" } - // expression { return "${UPSTREAM_GIT_REPO}" == "" } - // } - // } - // environment{ - // EDDL_BRANCH = "${UPSTREAM_GIT_BRANCH}" - // EDDL_REVISION = "${UPSTREAM_GIT_COMMIT}" - // EDDL_IMAGE_VERSION_TAG = "${DOCKER_IMAGE_TAG}" - // } - // agent { - // docker { image '${DOCKER_REPOSITORY_OWNER}/libs-toolkit:${EDDL_IMAGE_VERSION_TAG}' } - // } - steps { - sh "echo 'Testing eddl-toolkit:${EDDL_IMAGE_VERSION_TAG}'" - sh 'docker run --rm eddl-toolkit:${EDDL_IMAGE_VERSION_TAG} /bin/bash -c "cd ${EDDL_SRC}/build && ctest -C Debug -VV"' - } - } - } - } - - - } - - } - - - } - - post { - always { - echo 'One way or another, I have finished' - } - success { - echo "Docker images successfully build and published with tags: ${DOCKER_IMAGE_TAG} ${DOCKER_IMAGE_TAG_EXTRA}" - echo "Library revisions..." - echo "* ECVL revision: ${ECVL_REVISION}" - echo "* EDDL revision: ${EDDL_REVISION}" - echo "* PyECVL revision: ${PYECVL_REVISION}" - echo "* PyEDDL revision: ${PYEDDL_REVISION}" - } - unstable { - echo 'I am unstable :/' - } - failure { - echo 'I failed :(' - } - } -} \ No newline at end of file From a53d3d01e85bfec2dd662273f37f8792e6c8e5ca Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 11:38:54 +0100 Subject: [PATCH 080/200] Fix missing dependency --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c4e90db..26842d1 100644 --- a/Makefile +++ b/Makefile @@ -378,7 +378,7 @@ build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION},libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) -build_ecvl: _build_libs_base build_ecvl_toolkit## Build 'ecvl' image +build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call build_image,libs,ecvl,${ECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ From c37df5c47caa2030f2e0d0fbc068920e68ccac95 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 11:41:19 +0100 Subject: [PATCH 081/200] Fix missing .PHONY entries --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 26842d1..3fc1671 100644 --- a/Makefile +++ b/Makefile @@ -757,6 +757,8 @@ clean: clean_images clean_sources publish_libs_toolkit publish_eddl_toolkit publish_ecvl_toolkit \ publish_pylibs publish_pyeddl publish_pyecvl \ publish_pylibs_toolkit publish_pyeddl_toolkit publish_pyecvl_toolkit \ + test_eddl test_eddl_toolkit test_ecvl test_ecvl_toolkit test_pyeddl \ + test_pyeddl_toolkit test_pyecvl test_pyecvl_toolkit \ clean_sources \ clean_eddl_sources clean_ecvl_sources \ clean_pyeddl_sources clean_pyecvl_sources \ From 1244833a6f9e779a83d73031b5c2cee0786725d1 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 12:36:03 +0100 Subject: [PATCH 082/200] Rename settings file; add conf template --- Makefile | 2 +- build.conf | 46 +++++++++++++++++++++++++++++++++++++ settings.sh => release.conf | 0 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 build.conf rename settings.sh => release.conf (100%) diff --git a/Makefile b/Makefile index 3fc1671..252846e 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ PYEDDL_BRANCH := $(or ${PYEDDL_BRANCH},master) PYEDDL_REVISION := ${PYEDDL_REVISION} # config file -CONFIG_FILE ?= settings.sh +CONFIG_FILE ?= release.conf ifneq ($(wildcard $(CONFIG_FILE)),) include $(CONFIG_FILE) endif diff --git a/build.conf b/build.conf new file mode 100644 index 0000000..1b719b2 --- /dev/null +++ b/build.conf @@ -0,0 +1,46 @@ +# +DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" +DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" +DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 + +DOCKER_LOGIN_DONE=true + +# set docker user credentials +#DOCKER_USER=deephealth +#DOCKER_PASSWORD="" + +# use DockerHub as default registry +#DOCKER_REGISTRY=registry.hub.docker.com + +# set Docker repository +#DOCKER_REPOSITORY_OWNER=dhealth +#DOCKER_IMAGE_PREFIX= + +# latest tag settings +#DOCKER_IMAGE_LATEST=false + +# additional tags +#DOCKER_IMAGE_TAG_EXTRA= + +# ECVL repository +ECVL_REPOSITORY=https://github.com/deephealthproject/ecvl.git +#ECVL_BRANCH=master +#ECVL_REVISION=v0.1.0 + +# PyECVL +PYECVL_REPOSITORY=https://github.com/deephealthproject/pyecvl.git +#PYECVL_BRANCH=master +#PYECVL_REVISION=0.1.0 + +# EDDL repository +EDDL_REPOSITORY=https://github.com/deephealthproject/eddl.git +#EDDL_BRANCH=master +#EDDL_REVISION=v0.3.1 + +# PyEDDL repository +PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git +#PYEDDL_BRANCH=master +#PYEDDL_REVISION=0.3.0 + +# date.time as build number +#DOCKER_IMAGE_TAG=0.1.2 diff --git a/settings.sh b/release.conf similarity index 100% rename from settings.sh rename to release.conf From 834e0a0d43e49dd5c0fe38e8d59bdd1c3d9cec3f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 15:48:22 +0100 Subject: [PATCH 083/200] Support dynamic version number --- Makefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 252846e..1834809 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -# version -VERSION := 0.1 - # set bash as default interpreter SHELL := /bin/bash @@ -90,6 +87,19 @@ ifeq ("${DOCKER_IMAGE_LATEST}", "true") push_latest_tags = true endif +# 1: library path +# 2: actual revision +define get_version + $(eval tag := $(shell cd ${1} && git tag -l --points-at HEAD)) \ + $(eval rev := $(shell cd ${1} && git rev-parse --short HEAD | sed -E 's/-//; s/ .*//')) \ + $(eval branch := $(shell git rev-parse --abbrev-ref HEAD | sed -E 's+/+-+g; s/ .*//')) + if [[ -n "${tag}" ]]; then echo ${tag}; else echo ${branch}-${rev}; fi +endef + +# version +version: ## Output the current version of this Makefile + @$(call get_version,$(PWD)) + # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) @@ -664,10 +674,6 @@ repo-login: _repo-login ## Login to the Docker Registry $(eval DOCKER_LOGIN_DONE := true) -version: ## Output the current version of this Makefile - @echo $(VERSION) - - ############################################################################################################################ ### Clean sources ############################################################################################################################ From 8f4207acbb242889825dbf61b2c3585a8861c9b8 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 15:48:58 +0100 Subject: [PATCH 084/200] Update build and push targets to process all images --- Makefile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 1834809..c7f8191 100644 --- a/Makefile +++ b/Makefile @@ -334,13 +334,12 @@ apply_pyecvl_patches: ############# Build Docker images ############# ##################################################################################################################################### # Targets to build container images -build: _build ## Build libs+pylibs Docker images +build: _build ## Build all Docker images _build: \ - build_libs \ - build_libs_toolkit \ - build_pylibs \ - build_pylibs_toolkit - + build_eddl build_ecvl build_libs \ + build_eddl_toolkit build_ecvl_toolkit build_libs_toolkit \ + build_pyeddl build_pycvl build_pylibs \ + build_pyeddl_toolkit build_pyecvl_toolkit build_pylibs_toolkit ############# libs-toolkit ############# @@ -583,12 +582,15 @@ test_pyecvl_toolkit: pyecvl_folder ## Test 'ecvl' images ############################################################################################################################ ### Push Docker images ############################################################################################################################ -push: _push ## Push all built images +push: _push ## Push all images _push: \ - push_libs_toolkit push_libs \ - push_pylibs_toolkit push_pylibs - -push_libs: repo-login ## Push 'libs' images + push_libs_base push_libs_base_toolkit \ + push_libs push_libs_toolkit\ + push_eddl push_eddl_toolkit \ + push_ecvl push_ecvl_toolkit \ + push_pylibs push_pylibs_toolkit \ + push_pyeddl push_pyeddl_toolkit \ + push_pyecvcl push_pyecvl_toolkit $(call push_image,libs) push_eddl: repo-login eddl_folder ## Push 'eddl' images From c3910312fec4ed053dc5bdfcf307d95a9c15846f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 15:49:13 +0100 Subject: [PATCH 085/200] Update help messages --- Makefile | 76 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index c7f8191..224297f 100644 --- a/Makefile +++ b/Makefile @@ -591,80 +591,88 @@ _push: \ push_pylibs push_pylibs_toolkit \ push_pyeddl push_pyeddl_toolkit \ push_pyecvcl push_pyecvl_toolkit + +push_libs: docker_login ## Push 'libs' image $(call push_image,libs) -push_eddl: repo-login eddl_folder ## Push 'eddl' images +push_libs_base: docker_login ## Push 'lib-base' image + $(call push_image,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG}) + +push_eddl: docker_login eddl_folder ## Push 'eddl' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call push_image,eddl,${EDDL_IMAGE_VERSION_TAG}) -push_ecvl: repo-login ecvl_folder ## Push 'ecvl' images +push_ecvl: docker_login ecvl_folder ## Push 'ecvl' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG}) -push_libs_toolkit: repo-login ## Push 'libs-toolkit' images +push_libs_toolkit: docker_login ## Push 'libs-toolkit' image $(call push_image,libs-toolkit) -push_eddl_toolkit: repo-login eddl_folder ## Push 'eddl-toolkit' images +push_libs_base_toolkit: docker_login ## Push 'libs-base-toolkit' image + $(call push_image,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG}) + +push_eddl_toolkit: docker_login eddl_folder ## Push 'eddl-toolkit' images $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call push_image,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG}) -push_ecvl_toolkit: repo-login ecvl_folder ## Push 'ecvl-toolkit' images +push_ecvl_toolkit: docker_login ecvl_folder ## Push 'ecvl-toolkit' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG}) -push_pylibs: repo-login ## Push 'pylibs' images +push_pylibs: docker_login ## Push 'pylibs' images $(call push_image,pylibs) -push_pyeddl: repo-login pyeddl_folder ## Push 'pyeddl' images +push_pyeddl: docker_login pyeddl_folder ## Push 'pyeddl' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG}) -push_pyecvl: repo-login pyecvl_folder ## Push 'pyecvl' images +push_pyecvl: docker_login pyecvl_folder ## Push 'pyecvl' images $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG}) -push_pylibs_toolkit: repo-login ## Push 'pylibs-toolkit' images +push_pylibs_toolkit: docker_login ## Push 'pylibs-toolkit' images $(call push_image,pylibs-toolkit) -push_pyeddl_toolkit: repo-login pyeddl_folder ## Push 'pyeddl-toolkit' images +push_pyeddl_toolkit: docker_login pyeddl_folder ## Push 'pyeddl-toolkit' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG}) -push_pyecvl_toolkit: repo-login pyecvl_folder ## Push 'pyeddl-toolkit' images +push_pyecvl_toolkit: docker_login pyecvl_folder ## Push 'pyeddl-toolkit' images $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call push_image,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG}) ############################################################################################################################ ### Piblish Docker images ############################################################################################################################ -publish: build push ## Publish all built images to a Docker Registry (e.g., DockerHub) +publish: build push ## Publish all images to a Docker Registry (e.g., DockerHub) -publish_libs: build_libs push_libs ## Publish 'libs' images +publish_libs: build_libs push_libs ## Publish 'libs' image -publish_eddl: build_eddl push_eddl ## Publish 'eddl' images +publish_eddl: build_eddl push_eddl ## Publish 'eddl' image -publish_ecvl: build_ecvl push_ecvl ## Publish 'ecvl' images +publish_ecvl: build_ecvl push_ecvl ## Publish 'ecvl' image -publish_libs_toolkit: build_libs_toolkit push_libs_toolkit ## Publish 'libs-toolkit' images +publish_libs_toolkit: build_libs_toolkit push_libs_toolkit ## Publish 'libs-toolkit' image -publish_eddl_toolkit: build_eddl_toolkit push_eddl_toolkit ## Publish 'eddl-toolkit' images +publish_eddl_toolkit: build_eddl_toolkit push_eddl_toolkit ## Publish 'eddl-toolkit' image -publish_ecvl_toolkit: build_ecvl_toolkit push_ecvl_toolkit ## Publish 'ecvl-toolkit' images +publish_ecvl_toolkit: build_ecvl_toolkit push_ecvl_toolkit ## Publish 'ecvl-toolkit' image -publish_pylibs: build_pylibs push_pylibs ## Publish 'pylibs' images +publish_pylibs: build_pylibs push_pylibs ## Publish 'pylibs' image -publish_pyeddl: build_pyeddl push_pyeddl ## Publish 'pyeddl' images +publish_pyeddl: build_pyeddl push_pyeddl ## Publish 'pyeddl' image -publish_pyecvl: build_pyecvl push_pyecvl ## Publish 'pyecvl' images +publish_pyecvl: build_pyecvl push_pyecvl ## Publish 'pyecvl' image -publish_pylibs_toolkit: build_pylibs_toolkit push_pylibs_toolkit ## Publish 'pylibs-toolkit' images +publish_pylibs_toolkit: build_pylibs_toolkit push_pylibs_toolkit ## Publish 'pylibs-toolkit' image -publish_pyeddl_toolkit: build_pyeddl_toolkit push_pyeddl_toolkit ## Publish 'pyeddl-toolkit' images +publish_pyeddl_toolkit: build_pyeddl_toolkit push_pyeddl_toolkit ## Publish 'pyeddl-toolkit' image -publish_pyecvl_toolkit: build_pyecvl_toolkit push_pyecvl_toolkit ## Publish 'pyecvl-toolkit' images +publish_pyecvl_toolkit: build_pyecvl_toolkit push_pyecvl_toolkit ## Publish 'pyecvl-toolkit' image # login to the Docker HUB repository -_repo-login: ## Login to the Docker Registry +_docker_login: @if [[ ${DOCKER_LOGIN_DONE} == false ]]; then \ echo "Logging into Docker registry ${DOCKER_REGISTRY}..." ; \ echo ${DOCKER_PASSWORD} | docker login ${DOCKER_REGISTRY} --username ${DOCKER_USER} --password-stdin \ @@ -672,30 +680,30 @@ _repo-login: ## Login to the Docker Registry echo "Logging into Docker registry already done" ; \ fi -repo-login: _repo-login ## Login to the Docker Registry +docker-login: _docker-login ## Login to the Docker Registry $(eval DOCKER_LOGIN_DONE := true) ############################################################################################################################ ### Clean sources ############################################################################################################################ -clean_eddl_sources: +clean_eddl_sources: ## clean repository containing EDDL source code $(call clean_sources,libs/eddl) -clean_ecvl_sources: +clean_ecvl_sources: ## clean repository containing ECVL source code $(call clean_sources,libs/ecvl) -clean_pyeddl_sources: +clean_pyeddl_sources: ## clean repository containing PyEDDL source code $(call clean_sources,pylibs/pyeddl) -clean_pyecvl_sources: +clean_pyecvl_sources: ## clean repository containing PyECVL source code $(call clean_sources,pylibs/pyecvl) -clean_libs_sources: clean_eddl_sources clean_ecvl_sources +clean_libs_sources: clean_eddl_sources clean_ecvl_sources ## clean repository containing libs source code -clean_pylibs_sources: clean_pyeddl_sources clean_pyecvl_sources +clean_pylibs_sources: clean_pyeddl_sources clean_pyecvl_sources ## clean repository containing pylibs source code -clean_sources: clean_pylibs_sources clean_libs_sources +clean_sources: clean_pylibs_sources clean_libs_sources ## clean repository containing source code ############################################################################################################################ @@ -754,7 +762,7 @@ clean: clean_images clean_sources _build_pylibs_base_toolkit _build_pylibs_base \ build_pyeddl_toolkit build_pyecvl_toolkit build_pylibs_toolkit\ _build_pylibs_base build_pyeddl build_pyecvl build_pylibs \ - repo-login \ + _docker_login docker_login \ push _push \ push_libs push_eddl push_ecvl \ push_libs_toolkit push_eddl_toolkit push_ecvl_toolkit \ From d072b72694ca44f4058abaa787839cd20864738f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 16:16:47 +0100 Subject: [PATCH 086/200] Add target to test all images --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 224297f..9082af7 100644 --- a/Makefile +++ b/Makefile @@ -537,6 +537,12 @@ define test_image endef +tests: \ + test_eddl test_eddl_toolkit \ + test_ecvl test_ecvl_toolkit \ + test_pyeddl test_pyeddl_toolkit \ + test_pyecvl test_pyecvl_toolkit + test_eddl: eddl_folder ## Test 'eddl' images $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) @echo "No test available yet" From 97139acf312e407355ecff79a997f1e1163014cf Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 17:03:21 +0100 Subject: [PATCH 087/200] Test portable workaround for '--no-run-if-empty' --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9082af7..b5fe365 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,15 @@ # set bash as default interpreter SHELL := /bin/bash +# detect OS +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + XARGS_OPT = --no-run-if-empty +endif +ifeq ($(UNAME_S),Darwin) + XARGS_OPT = +endif + # date.time as build number BUILD_NUMBER := $(or ${BUILD_NUMBER},$(shell date '+%Y%m%d.%H%M%S')) @@ -199,10 +208,10 @@ endef define clean_image $(eval image := $(1)) @printf "Stopping docker containers instances of image '$(image)'... " - @docker ps -a | grep -E "^$(image)\s" | awk '{print $$1}' | xargs docker rm -f || true + @docker ps -a | grep -E "^$(image)\s" | awk '{print $$1}' | xargs ${XARGS_OPT} docker rm -f || true @printf "DONE\n" @printf "Removing docker image '$(image)'... " - @docker images | grep -E "^$(image)\s" | awk '{print $$1 ":" $$2}' | xargs docker rmi -f || true + @docker images | grep -E "^$(image)\s" | awk '{print $$1 ":" $$2}' | xargs ${XARGS_OPT} docker rmi -f || true @printf "DONE\n" @printf "Removing unused docker image... " @docker image prune -f From 63414956d5563710d80a78132ffb6c00d071fb0d Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 17:08:33 +0100 Subject: [PATCH 088/200] Clean all images with the target 'clean_images' --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b5fe365..4f3a13b 100644 --- a/Makefile +++ b/Makefile @@ -754,7 +754,10 @@ clean_pylibs_images: clean_pyecvl_images clean_pyeddl_images $(call clean_image,pylibs) $(call clean_image,pylibs-toolkit) -clean_images: clean_pylibs_images clean_libs_images clean_base_images +clean_images: \ + clean_pylibs_images clean_libs_images clean_base_images \ + clean_ecvl_images clean_eddl_images \ + clean_pyecvl_images clean_pylibs_images ############################################################################################################################ From 6bd909ed7205988781fb115567566d972f65a3e7 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 17:11:10 +0100 Subject: [PATCH 089/200] Check images also using the repository owner as prefix --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4f3a13b..01edc69 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,8 @@ define clean_image @docker ps -a | grep -E "^$(image)\s" | awk '{print $$1}' | xargs ${XARGS_OPT} docker rm -f || true @printf "DONE\n" @printf "Removing docker image '$(image)'... " - @docker images | grep -E "^$(image)\s" | awk '{print $$1 ":" $$2}' | xargs ${XARGS_OPT} docker rmi -f || true + @docker images | grep -E "^$(image)\s" | awk '{print $$1 ":" $$2}' | xargs ${XARGS_OPT} docker rmi -f || true + @docker images | grep -E "^${DOCKER_REPOSITORY_OWNER}/$(image)\s" | awk '{print $$1 ":" $$2}' | xargs ${XARGS_OPT} docker rmi -f || true @printf "DONE\n" @printf "Removing unused docker image... " @docker image prune -f From 25b65f112a4c079e5bee084703d626c624cc9d2c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 17:26:46 +0100 Subject: [PATCH 090/200] Fix typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 01edc69..d4c143f 100644 --- a/Makefile +++ b/Makefile @@ -348,7 +348,7 @@ build: _build ## Build all Docker images _build: \ build_eddl build_ecvl build_libs \ build_eddl_toolkit build_ecvl_toolkit build_libs_toolkit \ - build_pyeddl build_pycvl build_pylibs \ + build_pyeddl build_pyecvl build_pylibs \ build_pyeddl_toolkit build_pyecvl_toolkit build_pylibs_toolkit ############# libs-toolkit ############# From f0ef6a55a928f57f342d182e79af7bf5ebe9350d Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 14 Feb 2020 18:52:50 +0100 Subject: [PATCH 091/200] Add specific flag to disable image pull --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d4c143f..d34686a 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,9 @@ ifneq ($(wildcard $(CONFIG_FILE)),) include $(CONFIG_FILE) endif +# disable image pull +DISABLE_PULL ?= 0 + # set no cache option DISABLE_CACHE ?= BUILD_CACHE_OPT ?= @@ -127,7 +130,6 @@ define build_new_image -t ${image_name}:${tag} ${extra_tags} ${latest_tags} ${labels} . endef -#$(if docker images -q ${image_name}:${tag} > /dev/null || docker images -q ${full_tag} > /dev/null, define build_image $(eval image := $(1)) $(eval target := $(2)) @@ -144,13 +146,14 @@ define build_image $(eval images := $(shell docker images -q ${tagged_image})) $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag})) $(if ${DISABLE_CACHE},\ - echo "Cache disabled..." ; \ + @echo "Cache disabled..." ; \ $(call build_new_image), $(if ${images},\ - echo "Docker image '${tagged_image}' exists (id: ${images})", \ - $(if ${exists}, \ - echo "Pulling image '${full_image_name}:${tag}'..."; + @echo "Docker image '${tagged_image}' exists (id: ${images})", \ + $(if $(and ${exists},$(or $(findstring 0,${DISABLE_PULL}),$(findstring false,${DISABLE_PULL}))), \ + @echo "Pulling image '${full_image_name}:${tag}'..."; docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ + @echo "Image pull disabled..." ; \ $(call build_new_image) ) ) From 5e021bf6e32509a3b96f176281ad95664629d7b2 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sat, 15 Feb 2020 17:02:14 +0100 Subject: [PATCH 092/200] Make more robust parameter set --- Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d34686a..9bce807 100644 --- a/Makefile +++ b/Makefile @@ -85,17 +85,24 @@ endif # disable image pull DISABLE_PULL ?= 0 +_DO_NOT_PULL_DOCKER_IMAGES = 0 +ifeq ($(DISABLE_PULL),$(filter $(DISABLE_PULL),1 true TRUE)) +$(info Docker image pull disabled) +_DO_NOT_PULL_DOCKER_IMAGES = 1 +endif # set no cache option -DISABLE_CACHE ?= +DISABLE_CACHE ?= 0 BUILD_CACHE_OPT ?= -ifneq ("$(DISABLE_CACHE)", "") +ifeq ($(DISABLE_CACHE),$(filter $(DISABLE_CACHE),1 true TRUE)) +$(info Docker cache disabled) BUILD_CACHE_OPT = --no-cache +_DO_NOT_USE_DOCKER_CACHE = 1 endif # enable latest tags push_latest_tags = false -ifeq ("${DOCKER_IMAGE_LATEST}", "true") +ifeq ($(DOCKER_IMAGE_LATEST),$(filter $(DOCKER_IMAGE_LATEST),1 true TRUE)) push_latest_tags = true endif @@ -142,15 +149,13 @@ define build_image $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) $(eval latest_tags := $(shell if [ "${push_latest_tags}" == "true" ]; then echo "-t ${image_name}:latest"; fi)) $(eval tagged_image := ${image_name}:${tag}) - @echo "Building Docker image '${image_name}'..." $(eval images := $(shell docker images -q ${tagged_image})) $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag})) - $(if ${DISABLE_CACHE},\ - @echo "Cache disabled..." ; \ + $(if $(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},1),\ $(call build_new_image), $(if ${images},\ @echo "Docker image '${tagged_image}' exists (id: ${images})", \ - $(if $(and ${exists},$(or $(findstring 0,${DISABLE_PULL}),$(findstring false,${DISABLE_PULL}))), \ + $(if $(and ${exists},$(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},0)), \ @echo "Pulling image '${full_image_name}:${tag}'..."; docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ @echo "Image pull disabled..." ; \ From 7bd01f73de389fa22b86a2a661e14d18c03cf8dc Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sat, 15 Feb 2020 17:09:40 +0100 Subject: [PATCH 093/200] Suppress echo of some commands --- Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9bce807..ad96772 100644 --- a/Makefile +++ b/Makefile @@ -248,7 +248,7 @@ libs_folder: ) _eddl_folder: libs_folder - $(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ + @$(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ ) @@ -257,7 +257,7 @@ eddl_folder: _eddl_folder define clone_ecvl - $(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ + @$(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ $(call clone_repository,${ECVL_LIB_PATH},${ECVL_REPOSITORY},${ECVL_BRANCH},${ECVL_REVISION},true) ; \ ) endef @@ -272,7 +272,7 @@ pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} define pyeddl_shallow_clone - $(if $(wildcard ${PYEDDL_LIB_PATH}),$(info Using existing '${PYEDDL_LIB_PATH}' repository), \ + @$(if $(wildcard ${PYEDDL_LIB_PATH}),$(info Using existing '${PYEDDL_LIB_PATH}' repository), \ $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) ; \ ) endef @@ -341,7 +341,7 @@ pyecvl_folder: _pyecvl_second_level_dependencies # TODO: remove this patch when not required apply_pyeddl_patches: @echo "Applying patches to the EDDL repository..." - $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) + @$(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) cd ${EDDL_LIB_PATH} && git apply ../../${PYEDDL_LIB_PATH}/eddl_0.3.patch || true # # TODO: remove this patch when not required @@ -607,8 +607,7 @@ test_pyecvl_toolkit: pyecvl_folder ## Test 'ecvl' images ### Push Docker images ############################################################################################################################ push: _push ## Push all images -_push: \ - push_libs_base push_libs_base_toolkit \ +_push: push_libs_base push_libs_base_toolkit \ push_libs push_libs_toolkit\ push_eddl push_eddl_toolkit \ push_ecvl push_ecvl_toolkit \ From de1d0323e29872b09c6b214e7fca8644752f7427 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sat, 15 Feb 2020 18:00:53 +0100 Subject: [PATCH 094/200] Fix white-space --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ad96772..05431b5 100644 --- a/Makefile +++ b/Makefile @@ -607,10 +607,12 @@ test_pyecvl_toolkit: pyecvl_folder ## Test 'ecvl' images ### Push Docker images ############################################################################################################################ push: _push ## Push all images -_push: push_libs_base push_libs_base_toolkit \ + +_push: \ + push_libs_base push_libs_base_toolkit \ push_libs push_libs_toolkit\ push_eddl push_eddl_toolkit \ - push_ecvl push_ecvl_toolkit \ + push_ecvl push_ecvl_toolkit \ push_pylibs push_pylibs_toolkit \ push_pyeddl push_pyeddl_toolkit \ push_pyecvcl push_pyecvl_toolkit From 2d28f5658953b7f674fa2704cc3f9ad85b7255ae Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sat, 15 Feb 2020 18:15:39 +0100 Subject: [PATCH 095/200] Fix typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 05431b5..e77e27b 100644 --- a/Makefile +++ b/Makefile @@ -615,7 +615,7 @@ _push: \ push_ecvl push_ecvl_toolkit \ push_pylibs push_pylibs_toolkit \ push_pyeddl push_pyeddl_toolkit \ - push_pyecvcl push_pyecvl_toolkit + push_pyecvl push_pyecvl_toolkit push_libs: docker_login ## Push 'libs' image $(call push_image,libs) From 167cc09a2f5132fe2d2dc7f1897f52df2532c1dc Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sat, 15 Feb 2020 19:04:14 +0100 Subject: [PATCH 096/200] Fix container version --- Makefile | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index e77e27b..03b5fad 100644 --- a/Makefile +++ b/Makefile @@ -106,18 +106,14 @@ ifeq ($(DOCKER_IMAGE_LATEST),$(filter $(DOCKER_IMAGE_LATEST),1 true TRUE)) push_latest_tags = true endif -# 1: library path -# 2: actual revision -define get_version - $(eval tag := $(shell cd ${1} && git tag -l --points-at HEAD)) \ - $(eval rev := $(shell cd ${1} && git rev-parse --short HEAD | sed -E 's/-//; s/ .*//')) \ - $(eval branch := $(shell git rev-parse --abbrev-ref HEAD | sed -E 's+/+-+g; s/ .*//')) - if [[ -n "${tag}" ]]; then echo ${tag}; else echo ${branch}-${rev}; fi -endef +# extract info about repository revision +REPO_TAG := $(shell git tag -l --points-at HEAD) +REPO_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') +REPO_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') +REPO_VERSION := $(shell if [[ -n "${REPO_TAG}" ]]; then echo ${REPO_TAG}; else echo ${REPO_BRANCH}-${REPO_REVISION}; fi) -# version -version: ## Output the current version of this Makefile - @$(call get_version,$(PWD)) +# set container version equal to the repository version +CONTAINER_VERSION := $(REPO_VERSION) # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) @@ -238,6 +234,10 @@ endef .DEFAULT_GOAL := help +# version +version: ## Output the current version of this Makefile + @echo $(REPO_VERSION) + help: ## Show help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @@ -362,12 +362,13 @@ _build: \ ############# libs-toolkit ############# _build_libs_base_toolkit: - $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_DEVELOP_IMAGE)) + $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_DEVELOP_IMAGE)) build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call build_image,libs,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) @@ -375,14 +376,14 @@ build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call build_image,libs,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ --label ECVL_REVISION=${ECVL_REVISION},eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image $(call build_image,libs,libs-toolkit,${DOCKER_IMAGE_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -395,12 +396,13 @@ build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image ############# libs ############# _build_libs_base: - $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,$(DOCKER_NVIDIA_RUNTIME_IMAGE)) + $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE)) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call build_image,libs,eddl,${EDDL_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION},libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) @@ -408,7 +410,7 @@ build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call build_image,libs,ecvl,${ECVL_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -418,7 +420,7 @@ build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image build_libs: build_ecvl ## Build 'libs' image $(call build_image,libs,libs,${DOCKER_IMAGE_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -431,12 +433,13 @@ build_libs: build_ecvl ## Build 'libs' image ############# pylibs-toolkit ############# _build_pylibs_base_toolkit: build_ecvl_toolkit - $(call build_image,pylibs,pylibs-base-toolkit,${ECVL_IMAGE_VERSION_TAG},,ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + $(call build_image,pylibs,pylibs-base-toolkit,${ECVL_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call build_image,pylibs,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -450,7 +453,7 @@ build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patc build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call build_image,pylibs,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -466,7 +469,7 @@ build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolki build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image $(call build_image,pylibs,pylibs-toolkit,${DOCKER_IMAGE_TAG},\ - --label CONTAINER_VERSION=${DOCKER_IMAGE_TAG} \ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -485,11 +488,13 @@ build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image ############# pylibs ############# _build_pylibs_base: build_ecvl - $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},,ecvl:$(ECVL_IMAGE_VERSION_TAG)) + $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call build_image,pylibs,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -503,6 +508,7 @@ build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image build_pyecvl: build_pyeddl build_pyecvl_toolkit ## Build 'pyecvl' image $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call build_image,pylibs,pyecvl,${PYECVL_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ @@ -518,6 +524,7 @@ build_pyecvl: build_pyeddl build_pyecvl_toolkit ## Build 'pyecvl' image build_pylibs: build_pyecvl ## Build 'pylibs' image $(call build_image,pylibs,pylibs,${DOCKER_IMAGE_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ From c85d97fac827fe45665a4b695de8a76dfa188a28 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 09:37:22 +0100 Subject: [PATCH 097/200] Fix support for adding extra-tags on build --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 03b5fad..99112b9 100644 --- a/Makefile +++ b/Makefile @@ -126,11 +126,12 @@ endif define build_new_image echo "Building Docker image '${image_name}'..." ; \ + $(eval tags := $(filter-out undefined,$(foreach tag,$(extra_tags),-t $(image_name):$(tag)))) cd ${image} \ && docker build ${BUILD_CACHE_OPT} \ -f ${target}.Dockerfile \ ${base} ${toolkit} \ - -t ${image_name}:${tag} ${extra_tags} ${latest_tags} ${labels} . + -t ${image_name}:${tag} ${tags} ${latest_tags} ${labels} . endef define build_image @@ -140,7 +141,7 @@ define build_image $(eval labels := $(4)) $(eval base := $(if $(5), --build-arg BASE_IMAGE=$(5))) $(eval toolkit := $(if $(6), --build-arg TOOLKIT_IMAGE=$(6))) - $(eval extra_tags := $(if $(7), -t ${image_name}:${7})) + $(eval extra_tags := $(7)) $(eval image_name := ${DOCKER_IMAGE_PREFIX}${target}${${target}_suffix}) $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) $(eval latest_tags := $(shell if [ "${push_latest_tags}" == "true" ]; then echo "-t ${image_name}:latest"; fi)) From 24f388bee59c9e1fe846937f8f03b23583e8221e Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 09:40:56 +0100 Subject: [PATCH 098/200] Print tags info --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 99112b9..3b559aa 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,7 @@ ifeq (${GPU}, true) endif define build_new_image - echo "Building Docker image '${image_name}'..." ; \ + echo "Building Docker image '${image_name}' (tags: ${tag} ${extra_tags})..." ; \ $(eval tags := $(filter-out undefined,$(foreach tag,$(extra_tags),-t $(image_name):$(tag)))) cd ${image} \ && docker build ${BUILD_CACHE_OPT} \ @@ -372,7 +372,7 @@ build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) + --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG),,${EDDL_REVISION}) build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) From 87c18e6b9feb737b7fd9d6e1e59a5f61f0cc95a7 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 10:18:09 +0100 Subject: [PATCH 099/200] Fix dependency order --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3b559aa..893c33f 100644 --- a/Makefile +++ b/Makefile @@ -340,9 +340,8 @@ pyecvl_folder: _pyecvl_second_level_dependencies # TODO: remove this patch when not required -apply_pyeddl_patches: +apply_pyeddl_patches: pyeddl_folder @echo "Applying patches to the EDDL repository..." - @$(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) cd ${EDDL_LIB_PATH} && git apply ../../${PYEDDL_LIB_PATH}/eddl_0.3.patch || true # # TODO: remove this patch when not required @@ -492,7 +491,7 @@ _build_pylibs_base: build_ecvl $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl:$(ECVL_IMAGE_VERSION_TAG)) -build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image +build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call build_image,pylibs,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ @@ -506,7 +505,7 @@ build_pyeddl: _build_pylibs_base build_pyeddl_toolkit ## Build 'pyeddl' image --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) -build_pyecvl: build_pyeddl build_pyecvl_toolkit ## Build 'pyecvl' image +build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call build_image,pylibs,pyecvl,${PYECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ From 4c741ab8a915e76e1f73312a946a0b0639009178 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 10:52:46 +0100 Subject: [PATCH 100/200] Remove @ --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 893c33f..7f42c9a 100644 --- a/Makefile +++ b/Makefile @@ -249,7 +249,7 @@ libs_folder: ) _eddl_folder: libs_folder - @$(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ + $(if $(wildcard ${EDDL_LIB_PATH}),$(info Using existing '${EDDL_LIB_PATH}' repository), \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ ) @@ -258,7 +258,7 @@ eddl_folder: _eddl_folder define clone_ecvl - @$(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ + $(if $(wildcard ${ECVL_LIB_PATH}),$(info Using existing '${ECVL_LIB_PATH}' repository), \ $(call clone_repository,${ECVL_LIB_PATH},${ECVL_REPOSITORY},${ECVL_BRANCH},${ECVL_REVISION},true) ; \ ) endef @@ -273,15 +273,15 @@ pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} define pyeddl_shallow_clone - @$(if $(wildcard ${PYEDDL_LIB_PATH}),$(info Using existing '${PYEDDL_LIB_PATH}' repository), \ + $(if $(wildcard ${PYEDDL_LIB_PATH}),$(info Using existing '${PYEDDL_LIB_PATH}' repository), \ $(call clone_repository,${PYEDDL_LIB_PATH},${PYEDDL_REPOSITORY},${PYEDDL_BRANCH},${PYEDDL_REVISION},false) ; \ ) endef define pyeddl_clone_dependencies $(eval EDDL_REVISION = $(shell if [[ ! -n "${EDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYEDDL_LIB_PATH} && git submodule status -- third_party/eddl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${EDDL_REVISION}; fi)) - @echo "EDDL_REVISION: ${EDDL_REVISION}" - @if [[ -d ${EDDL_LIB_PATH} ]]; then \ + echo "EDDL_REVISION: ${EDDL_REVISION}" + if [[ -d ${EDDL_LIB_PATH} ]]; then \ echo "Using existing '${EDDL_LIB_PATH}' repository" ; \ else \ $(call clone_repository,${EDDL_LIB_PATH},${EDDL_REPOSITORY},${EDDL_BRANCH},${EDDL_REVISION},true) ; \ @@ -292,14 +292,14 @@ define pyeddl_clone_dependencies endef _pyeddl_shallow_clone: pylibs_folder - @$(call pyeddl_shallow_clone) + $(call pyeddl_shallow_clone) pyeddl_folder: _pyeddl_shallow_clone $(call pyeddl_clone_dependencies) $(eval PYEDDL_REVISION := $(call get_revision,pylibs/pyeddl,${PYEDDL_REVISION})) define pyecvl_shallow_clone - @$(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ + $(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ $(call clone_repository,${PYECVL_LIB_PATH},${PYECVL_REPOSITORY},${PYECVL_BRANCH},${PYECVL_REVISION},false) ; \ ) endef @@ -307,7 +307,7 @@ endef define pyecvl_resolve_dependencies $(eval PYEDDL_REVISION = $(shell if [[ ! -n "${PYEDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/pyeddl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${PYEDDL_REVISION}; fi)) $(eval ECVL_REVISION = $(shell if [[ ! -n "${ECVL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/ecvl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${ECVL_REVISION}; fi)) - @if [[ -d ${PYEDDL_LIB_PATH} ]]; then \ + if [[ -d ${PYEDDL_LIB_PATH} ]]; then \ echo "Using existing '${PYEDDL_LIB_PATH}' repository" ; \ else \ $(call pyeddl_shallow_clone) \ @@ -315,7 +315,7 @@ define pyecvl_resolve_dependencies rm -rf ${PYECVL_LIB_PATH}/third_party/pyeddl && cp -a ${PYEDDL_LIB_PATH} ${PYECVL_LIB_PATH}/third_party/pyeddl ; \ printf "DONE\n" ; \ fi - @if [[ -d ${ECVL_LIB_PATH} ]]; then \ + if [[ -d ${ECVL_LIB_PATH} ]]; then \ echo "Using existing '${ECVL_LIB_PATH}' repository" ; \ else \ echo "Using ECVL revision '${ECVL_REVISION}'" ; \ @@ -371,7 +371,7 @@ build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ - --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG),,${EDDL_REVISION}) + --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) From f4d34f3bd3d9e42911623206da12c0b2550486ef Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 11:25:25 +0100 Subject: [PATCH 101/200] Push always revision as tag --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 7f42c9a..9a587fc 100644 --- a/Makefile +++ b/Makefile @@ -165,18 +165,18 @@ endef define push_image $(eval image := $(1)) $(eval tag := $(or $(2),${DOCKER_IMAGE_TAG})) + $(eval extra_tags := $(filter-out $(tag),$(foreach t,$(3) ${DOCKER_IMAGE_TAG_EXTRA},$(t)))) $(eval image_name := ${DOCKER_IMAGE_PREFIX}${image}) $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) $(eval full_tag := ${full_image_name}:$(tag)) $(eval latest_tag := ${full_image_name}:latest) - $(eval tags := ${DOCKER_IMAGE_TAG_EXTRA}) @echo "Tagging images... " docker tag ${image_name}:$(tag) ${full_tag} @if [ ${push_latest_tags} == true ]; then docker tag ${image_name}:$(tag) ${latest_tag}; fi @echo "Pushing Docker image '${image_name}'..." docker push ${full_tag} @if [ ${push_latest_tags} == true ]; then docker push ${latest_tag}; fi - @for tag in $(tags); \ + @for tag in $(extra_tags); \ do \ img_tag=${full_image_name}:$$tag ; \ docker tag ${full_tag} $$img_tag ; \ @@ -632,11 +632,11 @@ push_libs_base: docker_login ## Push 'lib-base' image push_eddl: docker_login eddl_folder ## Push 'eddl' image $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - $(call push_image,eddl,${EDDL_IMAGE_VERSION_TAG}) + $(call push_image,eddl,${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) push_ecvl: docker_login ecvl_folder ## Push 'ecvl' image $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG}) + $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) push_libs_toolkit: docker_login ## Push 'libs-toolkit' image $(call push_image,libs-toolkit) @@ -646,33 +646,33 @@ push_libs_base_toolkit: docker_login ## Push 'libs-base-toolkit' image push_eddl_toolkit: docker_login eddl_folder ## Push 'eddl-toolkit' images $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - $(call push_image,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG}) + $(call push_image,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) push_ecvl_toolkit: docker_login ecvl_folder ## Push 'ecvl-toolkit' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG}) + $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) push_pylibs: docker_login ## Push 'pylibs' images $(call push_image,pylibs) push_pyeddl: docker_login pyeddl_folder ## Push 'pyeddl' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG}) + $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) push_pyecvl: docker_login pyecvl_folder ## Push 'pyecvl' images $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG}) + $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) push_pylibs_toolkit: docker_login ## Push 'pylibs-toolkit' images $(call push_image,pylibs-toolkit) push_pyeddl_toolkit: docker_login pyeddl_folder ## Push 'pyeddl-toolkit' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG}) + $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) push_pyecvl_toolkit: docker_login pyecvl_folder ## Push 'pyeddl-toolkit' images $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - $(call push_image,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG}) + $(call push_image,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) ############################################################################################################################ ### Piblish Docker images From d3a23d647274afe28269084b257548293140f1e5 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 17:19:27 +0100 Subject: [PATCH 102/200] Add explicit repo library TAG --- Makefile | 88 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 9a587fc..9404620 100644 --- a/Makefile +++ b/Makefile @@ -61,21 +61,25 @@ PYEDDL_LIB_PATH = ${LOCAL_PYLIBS_PATH}/pyeddl ECVL_REPOSITORY := $(or ${ECVL_REPOSITORY},https://github.com/deephealthproject/ecvl.git) ECVL_BRANCH := $(or ${ECVL_BRANCH},master) ECVL_REVISION := ${ECVL_REVISION} +ECVL_TAG := # PyECVL repository PYECVL_REPOSITORY := $(or ${PYECVL_REPOSITORY},https://github.com/deephealthproject/pyecvl.git) PYECVL_BRANCH := $(or ${PYECVL_BRANCH},master) PYECVL_REVISION := ${PYECVL_REVISION} +PYECVL_TAG := # EDDL repository EDDL_REPOSITORY := $(or ${EDDL_REPOSITORY},https://github.com/deephealthproject/eddl.git) EDDL_BRANCH := $(or ${EDDL_BRANCH},master) EDDL_REVISION := ${EDDL_REVISION} +EDDL_TAG := # PyEDDL repository PYEDDL_REPOSITORY := $(or ${PYEDDL_REPOSITORY},https://github.com/deephealthproject/pyeddl.git) PYEDDL_BRANCH := $(or ${PYEDDL_BRANCH},master) PYEDDL_REVISION := ${PYEDDL_REVISION} +PYEDDL_TAG := # config file CONFIG_FILE ?= release.conf @@ -226,11 +230,33 @@ endef # 1: library path -# 2: actual revision -define get_revision +define get_tag $(eval tag := $(shell cd ${1} && git tag -l --points-at HEAD)) \ + $(strip $(shell echo ${tag};)) +endef + +# 1: library path +define get_revision $(eval head := $(shell cd ${1} && git rev-parse --short HEAD | sed -E 's/-//; s/ .*//')) \ - $(strip $(shell if [[ -n "${2}" ]]; then echo ${2}; elif [[ -n "${tag}" ]]; then echo ${tag}; else echo ${head}; fi)) + $(strip $(shell echo ${head};)) +endef + +# 1: submodule path +# 2: library name +# 3: revision +define submodule_revision + $(eval rev = $(shell cd $(1) && git submodule status -- $(2) | sed -E 's/-//; s/ .*//' | cut -c1-7;)) \ + $(shell if [[ -n "$(3)" ]]; then echo $(3); else echo $(rev); fi) +endef + +# 1: library path +# 2: library name +define set_library_revision + $(eval lib := $(shell echo $(2) | tr a-z A-Z)) + $(eval ${lib}_REVISION := $(call get_revision,$(1)/$(2))) + $(eval $(lib)_TAG = $(call get_tag,$(1)/$(2))) + $(eval ${lib}_IMAGE_VERSION_TAG = $(or ${${lib}_IMAGE_VERSION_TAG},${${lib}_TAG},${${lib}_REVISION})) + @echo "${lib} rev: ${${lib}_REVISION} ${$(lib)_TAG} ${${lib}_IMAGE_VERSION_TAG}" endef .DEFAULT_GOAL := help @@ -254,7 +280,7 @@ _eddl_folder: libs_folder ) eddl_folder: _eddl_folder - $(eval EDDL_REVISION := $(call get_revision,libs/eddl,${EDDL_REVISION})) + $(call set_library_revision,libs,eddl) define clone_ecvl @@ -267,7 +293,7 @@ _ecvl_folder: libs_folder $(call clone_ecvl) ecvl_folder: _ecvl_folder - $(eval ECVL_REVISION := $(call get_revision,libs/ecvl,${ECVL_REVISION})) + $(call set_library_revision,libs,ecvl) pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} @@ -279,8 +305,7 @@ define pyeddl_shallow_clone endef define pyeddl_clone_dependencies - $(eval EDDL_REVISION = $(shell if [[ ! -n "${EDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYEDDL_LIB_PATH} && git submodule status -- third_party/eddl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${EDDL_REVISION}; fi)) - echo "EDDL_REVISION: ${EDDL_REVISION}" + $(eval EDDL_REVISION = $(call submodule_revision,${PYEDDL_LIB_PATH}/third_party,eddl,${EDDL_REVISION})) if [[ -d ${EDDL_LIB_PATH} ]]; then \ echo "Using existing '${EDDL_LIB_PATH}' repository" ; \ else \ @@ -294,9 +319,12 @@ endef _pyeddl_shallow_clone: pylibs_folder $(call pyeddl_shallow_clone) -pyeddl_folder: _pyeddl_shallow_clone +_pyeddl_dependencies: _pyeddl_shallow_clone $(call pyeddl_clone_dependencies) - $(eval PYEDDL_REVISION := $(call get_revision,pylibs/pyeddl,${PYEDDL_REVISION})) + +pyeddl_folder: _pyeddl_dependencies + $(call set_library_revision,libs,eddl) \ + $(call set_library_revision,pylibs,pyeddl) define pyecvl_shallow_clone $(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ @@ -305,8 +333,8 @@ define pyecvl_shallow_clone endef define pyecvl_resolve_dependencies - $(eval PYEDDL_REVISION = $(shell if [[ ! -n "${PYEDDL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/pyeddl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${PYEDDL_REVISION}; fi)) - $(eval ECVL_REVISION = $(shell if [[ ! -n "${ECVL_REVISION}" ]]; then cd ${CURRENT_PATH}/${PYECVL_LIB_PATH} && git submodule status -- third_party/ecvl | sed -E 's/-//; s/ .*//' | cut -c1-7; else echo ${ECVL_REVISION}; fi)) + $(eval PYEDDL_REVISION = $(call submodule_revision,${PYECVL_LIB_PATH}/third_party,pyeddl,${PYEDDL_REVISION})) + $(eval ECVL_REVISION = $(call submodule_revision,${PYECVL_LIB_PATH}/third_party,ecvl,${ECVL_REVISION})) if [[ -d ${PYEDDL_LIB_PATH} ]]; then \ echo "Using existing '${PYEDDL_LIB_PATH}' repository" ; \ else \ @@ -333,10 +361,12 @@ _pyecvl_first_level_dependencies: _pyecvl_shallow_clone $(call pyecvl_resolve_dependencies) _pyecvl_second_level_dependencies: _pyecvl_first_level_dependencies + $(call set_library_revision,libs,ecvl) \ + $(call set_library_revision,pylibs,pyeddl) \ $(call pyeddl_clone_dependencies) pyecvl_folder: _pyecvl_second_level_dependencies - $(eval PYECVL_REVISION := $(call get_revision,pylibs/pyecvl,${PYECVL_REVISION})) + $(call set_library_revision,pylibs,pyecvl) # TODO: remove this patch when not required @@ -366,7 +396,6 @@ _build_libs_base_toolkit: --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_DEVELOP_IMAGE)) build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image - $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call build_image,libs,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -374,7 +403,6 @@ build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call build_image,libs,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ @@ -400,7 +428,6 @@ _build_libs_base: --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE)) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image - $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) $(call build_image,libs,eddl,${EDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -408,7 +435,6 @@ build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image --label EDDL_REVISION=${EDDL_REVISION},libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(call build_image,libs,ecvl,${ECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -437,7 +463,6 @@ _build_pylibs_base_toolkit: build_ecvl_toolkit --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image - $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call build_image,pylibs,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -451,7 +476,6 @@ build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patc --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image - $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call build_image,pylibs,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -492,7 +516,6 @@ _build_pylibs_base: build_ecvl --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image - $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) $(call build_image,pylibs,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -506,7 +529,6 @@ build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image - $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) $(call build_image,pylibs,pyecvl,${PYECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -631,12 +653,10 @@ push_libs_base: docker_login ## Push 'lib-base' image $(call push_image,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG}) push_eddl: docker_login eddl_folder ## Push 'eddl' image - $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - $(call push_image,eddl,${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) + $(call push_image,eddl,${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION} ${EDDL_TAG}) push_ecvl: docker_login ecvl_folder ## Push 'ecvl' image - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) + $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION} ${ECVL_TAG}) push_libs_toolkit: docker_login ## Push 'libs-toolkit' image $(call push_image,libs-toolkit) @@ -645,34 +665,28 @@ push_libs_base_toolkit: docker_login ## Push 'libs-base-toolkit' image $(call push_image,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG}) push_eddl_toolkit: docker_login eddl_folder ## Push 'eddl-toolkit' images - $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - $(call push_image,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) + $(call push_image,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION} ${EDDL_TAG}) push_ecvl_toolkit: docker_login ecvl_folder ## Push 'ecvl-toolkit' images - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) + $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION} ${ECVL_TAG}) push_pylibs: docker_login ## Push 'pylibs' images $(call push_image,pylibs) push_pyeddl: docker_login pyeddl_folder ## Push 'pyeddl' images - $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) + $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION} ${PYEDDL_TAG}) push_pyecvl: docker_login pyecvl_folder ## Push 'pyecvl' images - $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) + $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION} ${PYECVL_TAG}) push_pylibs_toolkit: docker_login ## Push 'pylibs-toolkit' images $(call push_image,pylibs-toolkit) push_pyeddl_toolkit: docker_login pyeddl_folder ## Push 'pyeddl-toolkit' images - $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) + $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION} ${PYEDDL_TAG}) push_pyecvl_toolkit: docker_login pyecvl_folder ## Push 'pyeddl-toolkit' images - $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - $(call push_image,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) + $(call push_image,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION} ${PYECVL_TAG}) ############################################################################################################################ ### Piblish Docker images @@ -786,7 +800,7 @@ clean: clean_images clean_sources .PHONY: help \ libs_folder eddl_folder ecvl_folder pylibs_folder \ - pyeddl_folder _pyeddl_shallow_clone \ + pyeddl_folder _pyeddl_shallow_clone _pyecvl_second_level_dependencies \ pyecvl_folder _pyeddl_shallow_clone _pyecvl_first_level_dependencies _pyecvl_second_level_dependencies \ apply_pyeddl_patches apply_pyecvl_patches \ clean clean_libs clean_pylibs apply_libs_patches \ From 1fb238177d3d5a445b98ff4b5506fa3f6cd0816e Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 18:26:47 +0100 Subject: [PATCH 103/200] Use only the last tag --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9404620..5c4e1b6 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ ifeq ($(DOCKER_IMAGE_LATEST),$(filter $(DOCKER_IMAGE_LATEST),1 true TRUE)) endif # extract info about repository revision -REPO_TAG := $(shell git tag -l --points-at HEAD) +REPO_TAG := $(shell git tag -l --points-at HEAD | tail -n 1) REPO_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') REPO_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') REPO_VERSION := $(shell if [[ -n "${REPO_TAG}" ]]; then echo ${REPO_TAG}; else echo ${REPO_BRANCH}-${REPO_REVISION}; fi) @@ -129,7 +129,7 @@ ifeq (${GPU}, true) endif define build_new_image - echo "Building Docker image '${image_name}' (tags: ${tag} ${extra_tags})..." ; \ + echo "Building Docker image '${image_name}' ( tags: ${tag} ${extra_tags})..." ; \ $(eval tags := $(filter-out undefined,$(foreach tag,$(extra_tags),-t $(image_name):$(tag)))) cd ${image} \ && docker build ${BUILD_CACHE_OPT} \ @@ -231,7 +231,7 @@ endef # 1: library path define get_tag - $(eval tag := $(shell cd ${1} && git tag -l --points-at HEAD)) \ + $(eval tag := $(shell cd ${1} && git tag -l --points-at HEAD | tail -n 1)) \ $(strip $(shell echo ${tag};)) endef From 6db26a36112249d9649ecfbf5cc62661ba97d30e Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 19:14:26 +0100 Subject: [PATCH 104/200] Add specific revision settings for libs --- Makefile | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 5c4e1b6..46e5cdc 100644 --- a/Makefile +++ b/Makefile @@ -111,13 +111,15 @@ ifeq ($(DOCKER_IMAGE_LATEST),$(filter $(DOCKER_IMAGE_LATEST),1 true TRUE)) endif # extract info about repository revision -REPO_TAG := $(shell git tag -l --points-at HEAD | tail -n 1) -REPO_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') -REPO_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') -REPO_VERSION := $(shell if [[ -n "${REPO_TAG}" ]]; then echo ${REPO_TAG}; else echo ${REPO_BRANCH}-${REPO_REVISION}; fi) +LIBS_TAG := $(shell git tag -l --points-at HEAD | tail -n 1) +LIBS_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') +LIBS_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') +LIBS_VERSION := $(shell if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) +LIBS_IMAGE_VERSION_TAG := $(or ${LIBS_IMAGE_VERSION_TAG},${LIBS_TAG},${LIBS_VERSION}) +LIBS_EXTRA_TAGS := $(LIBS_VERSION) $(LIBS_REVISION) # set container version equal to the repository version -CONTAINER_VERSION := $(REPO_VERSION) +CONTAINER_VERSION := $(LIBS_VERSION) # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) @@ -263,7 +265,7 @@ endef # version version: ## Output the current version of this Makefile - @echo $(REPO_VERSION) + @echo $(LIBS_VERSION) help: ## Show help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @@ -410,14 +412,14 @@ build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image --label ECVL_REVISION=${ECVL_REVISION},eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image - $(call build_image,libs,libs-toolkit,${DOCKER_IMAGE_TAG},\ + $(call build_image,libs,libs-toolkit,${LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=${ECVL_REVISION},ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) @@ -445,14 +447,14 @@ build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image --label ECVL_REVISION=${ECVL_REVISION},eddl:$(EDDL_IMAGE_VERSION_TAG),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_libs: build_ecvl ## Build 'libs' image - $(call build_image,libs,libs,${DOCKER_IMAGE_TAG},\ + $(call build_image,libs,libs,${LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=${ECVL_REVISION},ecvl:$(ECVL_IMAGE_VERSION_TAG)) + --label ECVL_REVISION=${ECVL_REVISION},ecvl:$(ECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) @@ -492,7 +494,7 @@ build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolki --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image - $(call build_image,pylibs,pylibs-toolkit,${DOCKER_IMAGE_TAG},\ + $(call build_image,pylibs,pylibs-toolkit,${LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -505,7 +507,7 @@ build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) @@ -545,7 +547,7 @@ build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl:$(PYEDDL_IMAGE_VERSION_TAG),pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) build_pylibs: build_pyecvl ## Build 'pylibs' image - $(call build_image,pylibs,pylibs,${DOCKER_IMAGE_TAG},\ + $(call build_image,pylibs,pylibs,${LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -558,7 +560,7 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl:$(PYECVL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl:$(PYECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) ############################################################################################################################ @@ -647,7 +649,7 @@ _push: \ push_pyecvl push_pyecvl_toolkit push_libs: docker_login ## Push 'libs' image - $(call push_image,libs) + $(call push_image,libs,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) push_libs_base: docker_login ## Push 'lib-base' image $(call push_image,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG}) @@ -659,7 +661,7 @@ push_ecvl: docker_login ecvl_folder ## Push 'ecvl' image $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION} ${ECVL_TAG}) push_libs_toolkit: docker_login ## Push 'libs-toolkit' image - $(call push_image,libs-toolkit) + $(call push_image,libs-toolkit,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) push_libs_base_toolkit: docker_login ## Push 'libs-base-toolkit' image $(call push_image,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG}) @@ -671,7 +673,7 @@ push_ecvl_toolkit: docker_login ecvl_folder ## Push 'ecvl-toolkit' images $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION} ${ECVL_TAG}) push_pylibs: docker_login ## Push 'pylibs' images - $(call push_image,pylibs) + $(call push_image,pylibs,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) push_pyeddl: docker_login pyeddl_folder ## Push 'pyeddl' images $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION} ${PYEDDL_TAG}) @@ -680,7 +682,7 @@ push_pyecvl: docker_login pyecvl_folder ## Push 'pyecvl' images $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION} ${PYECVL_TAG}) push_pylibs_toolkit: docker_login ## Push 'pylibs-toolkit' images - $(call push_image,pylibs-toolkit) + $(call push_image,pylibs-toolkit,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) push_pyeddl_toolkit: docker_login pyeddl_folder ## Push 'pyeddl-toolkit' images $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION} ${PYEDDL_TAG}) From 407fa86fa24a9081a7623ad4959b30bf1e513e27 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Sun, 16 Feb 2020 22:07:41 +0100 Subject: [PATCH 105/200] Suppress CURL error output --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 46e5cdc..b71ba81 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,7 @@ define build_image $(eval latest_tags := $(shell if [ "${push_latest_tags}" == "true" ]; then echo "-t ${image_name}:latest"; fi)) $(eval tagged_image := ${image_name}:${tag}) $(eval images := $(shell docker images -q ${tagged_image})) - $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag})) + $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag} 2>/dev/null)) $(if $(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},1),\ $(call build_new_image), $(if ${images},\ From e9f6702976808d3d656b3b391f0820450d48837b Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 18 Feb 2020 09:22:20 +0000 Subject: [PATCH 106/200] Install OpenCV from sources; update OpenCV to the 3.4.6 version --- libs/libs-base-toolkit.Dockerfile | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 1539e86..01e7eac 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -6,8 +6,14 @@ LABEL website="https://github.com/deephealthproject/" LABEL description="DeepHealth European Distributed Deep Learning Library" LABEL software="deephealth-eddl,deephealth-ecvl" +# set cmake version ARG cmake_release="3.14.6" +# set OpenCV version +ARG opencv_release="3.4.6" +ENV OPENCV_RELEASE ${opencv_release} +ENV OPENCV_INSTALL_MANIFEST "/usr/local/opencv/install_manifest.txt" + # Install software requirements RUN \ echo "\nInstalling software requirements..." >&2 \ @@ -15,7 +21,9 @@ RUN \ && apt-get update -y -q \ && apt-get install -y --no-install-recommends \ build-essential git gcc-8 g++-8 wget rsync graphviz \ - libopencv-dev libwxgtk3.0-dev libopenslide-dev \ + libwxgtk3.0-dev libopenslide-dev \ + libavcodec-dev libavformat-dev libswscale-dev \ + libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 \ --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ --slave /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/x86_64-linux-gnu-gcc-7 \ @@ -25,6 +33,7 @@ RUN \ --slave /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/x86_64-linux-gnu-gcc-8 \ --slave /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ /usr/bin/x86_64-linux-gnu-g++-8 \ && apt-get clean \ + && echo "\n > Installing cmake (version '${cmake_release}')..." >&2 \ && cd /tmp/ \ && wget --quiet https://github.com/Kitware/CMake/releases/download/v3.14.6/cmake-${cmake_release}-Linux-x86_64.tar.gz \ && tar xzf cmake-${cmake_release}-Linux-x86_64.tar.gz \ @@ -33,4 +42,25 @@ RUN \ && mv cmake*/share/* /usr/local/share/ \ && chown root:root /usr/local/bin/* /usr/local/share/* \ && chmod a+rx /usr/local/bin/* \ - && rm -rf /tmp/cmake* \ No newline at end of file + && rm -rf /tmp/cmake* \ + && echo "\n > Installing OpenCV (version '${opencv_release}')..." >&2 \ + && cd /tmp/ \ + && wget --quiet https://github.com/opencv/opencv/archive/${opencv_release}.tar.gz \ + && tar xzf ${opencv_release}.tar.gz \ + && rm ${opencv_release}.tar.gz \ + && cd opencv-${opencv_release} \ + && mkdir build \ + && cd build \ + && cmake -D CMAKE_BUILD_TYPE=RELEASE \ + -D OPENCV_GENERATE_PKGCONFIG=ON .. \ + && make -j$(nproc) \ + && make install \ + && mkdir -p $(dirname ${OPENCV_INSTALL_MANIFEST}) \ + && cp $(basename ${OPENCV_INSTALL_MANIFEST}) $(dirname ${OPENCV_INSTALL_MANIFEST})/ \ + && rm -rf /tmp/opencv-${opencv_release} + + +# && cmake -D CMAKE_BUILD_TYPE=RELEASE \ +# -D INSTALL_C_EXAMPLES=ON \ +# -D OPENCV_GENERATE_PKGCONFIG=ON \ +# -D BUILD_EXAMPLES=ON .. \ \ No newline at end of file From fd441e136c885a660270a80d4afd49b520538cb9 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 18 Feb 2020 09:24:48 +0000 Subject: [PATCH 107/200] Use OpenCV from base-toolkit --- Makefile | 4 ++-- libs/libs-base.Dockerfile | 43 +++++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b71ba81..b9666f3 100644 --- a/Makefile +++ b/Makefile @@ -425,9 +425,9 @@ build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image ############# libs ############# -_build_libs_base: +_build_libs_base: _build_libs_base_toolkit $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE)) + --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image $(call build_image,libs,eddl,${EDDL_IMAGE_VERSION_TAG},\ diff --git a/libs/libs-base.Dockerfile b/libs/libs-base.Dockerfile index 30524cb..9f9d0b2 100644 --- a/libs/libs-base.Dockerfile +++ b/libs/libs-base.Dockerfile @@ -1,4 +1,32 @@ ARG BASE_IMAGE +ARG TOOLKIT_IMAGE +ARG OPENV_INSTALL_MANIFEST="/usr/local/opencv/install_manifest.txt" + +# set toolkit image +FROM ${TOOLKIT_IMAGE} as toolkit + +############################ +#### INTERMEDIATE Stage #### +############################ +FROM ${BASE_IMAGE} AS prepare_install + +RUN apt-get update -y -q \ + && apt-get install -y --no-install-recommends wget rsync \ + && apt-get clean + +# make a temporary copy of libraries +COPY --from=toolkit /usr/local/bin /tmp/local/bin +COPY --from=toolkit /usr/local/etc /tmp/local/etc +COPY --from=toolkit /usr/local/include /tmp/local/include +COPY --from=toolkit /usr/local/lib /tmp/local/lib +COPY --from=toolkit /usr/local/share /tmp/local/share +COPY --from=toolkit /usr/local/opencv/install_manifest.txt /tmp/local/install_manifest.txt + +# merge existing system directories with those containing libraries +RUN cd /tmp/local && sed -e 's+/usr/local/++g' install_manifest.txt | \ + while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done + + #################### #### BASE image #### #################### @@ -15,15 +43,14 @@ RUN \ && apt-get install -y --no-install-recommends \ wget \ rsync \ - libopencv-core-dev \ - libopencv-imgproc-dev \ - libopencv-imgcodecs-dev \ + libavcodec-dev libavformat-dev libswscale-dev \ + libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \ libopenslide-dev \ libgomp1 \ && apt-get clean -# create a temp directory -RUN mkdir /tmp/local - -# change working directory -WORKDIR /tmp/local \ No newline at end of file +# copy libraries to the target paths +COPY --from=prepare_install /usr/local/etc /usr/local/etc +COPY --from=prepare_install /usr/local/include /usr/local/include +COPY --from=prepare_install /usr/local/lib /usr/local/lib +COPY --from=prepare_install /usr/local/share /usr/local/share \ No newline at end of file From 093c6ed85a1d166a7c599cabc7f98d738834410b Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 18 Feb 2020 17:35:39 +0000 Subject: [PATCH 108/200] Fix temporary path --- libs/ecvl.Dockerfile | 2 +- libs/eddl.Dockerfile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/ecvl.Dockerfile b/libs/ecvl.Dockerfile index d0f5f7d..ccb4c4d 100644 --- a/libs/ecvl.Dockerfile +++ b/libs/ecvl.Dockerfile @@ -22,7 +22,7 @@ COPY --from=toolkit /usr/local/src/ecvl/build/install_manifest.txt /tmp/local/in # merge existing system directories with those containing libraries -RUN sed -e 's+/usr/local/++g' install_manifest.txt | \ +RUN cd /tmp/local && sed -e 's+/usr/local/++g' /tmp/local/install_manifest.txt | \ while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done ###################### diff --git a/libs/eddl.Dockerfile b/libs/eddl.Dockerfile index 50011d4..e2ef136 100644 --- a/libs/eddl.Dockerfile +++ b/libs/eddl.Dockerfile @@ -18,11 +18,10 @@ COPY --from=toolkit /usr/local/etc /tmp/local/etc COPY --from=toolkit /usr/local/include /tmp/local/include COPY --from=toolkit /usr/local/lib /tmp/local/lib COPY --from=toolkit /usr/local/share /tmp/local/share -#COPY --from=toolkit /usr/local/src/ecvl/build/install_manifest.txt /tmp/local/ecvl_manifest.txt COPY --from=toolkit /usr/local/src/eddl/build/install_manifest.txt /tmp/local/install_manifest.txt # merge existing system directories with those containing libraries -RUN sed -e 's+/usr/local/++g' install_manifest.txt | \ +RUN cd /tmp/local && sed -e 's+/usr/local/++g' /tmp/local/install_manifest.txt | \ while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done ###################### From 9fb0bdf66d4c7445e515ee1b546f5f992deb3efc Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 18 Feb 2020 17:38:15 +0000 Subject: [PATCH 109/200] More tests and fixes --- Makefile | 57 ++++++++++++++++++++++++-------------------- tests/test_ecvl.sh | 5 ++++ tests/test_eddl.sh | 5 ++++ tests/test_pyecvl.sh | 8 +++++-- tests/test_pyeddl.sh | 4 ++++ 5 files changed, 51 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index b9666f3..1c4114b 100644 --- a/Makefile +++ b/Makefile @@ -566,27 +566,20 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image ############################################################################################################################ ### Tests ############################################################################################################################ - define test_image $(eval image := $(1)) $(eval test_script := $(2)) - $(eval toolkit_image := $(3)) - $(eval host_path := $(shell echo ${CURRENT_PATH}/$(4) | sed -e 's+[[:space:]]++g')) - $(eval container_path := $(5)) - $(eval container := $(shell if [[ -n "${toolkit_image}" ]]; then docker run -d ${toolkit_image} /bin/bash ; fi)) + $(eval containers := $(3)) + $(eval volumes := $(shell if [ -n "${containers}" ]; then for cname in ${containers}; do echo "--volumes-from $${cname}"; done; fi)) echo "Test: ${test_script}' @ '${image}'..." ; \ - if [[ -n "${container}" ]]; then \ - docker cp ${container}:${container_path} ${host_path} ; \ - cat ${test_script} | ${DOCKER_RUN} -v ${host_path}:${container_path} ${image} /bin/sh ; \ - else \ - cat ${test_script} | ${DOCKER_RUN} ${image} /bin/sh ; \ - fi ; \ + cat ${test_script} | ${DOCKER_RUN} ${volumes} ${image} /bin/sh ; \ docker container prune -f ; \ echo "DONE" - endef -tests: \ +tests: _tests ## Test all docker images + +_tests: \ test_eddl test_eddl_toolkit \ test_ecvl test_ecvl_toolkit \ test_pyeddl test_pyeddl_toolkit \ @@ -594,45 +587,57 @@ tests: \ test_eddl: eddl_folder ## Test 'eddl' images $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - @echo "No test available yet" + @docker run --name eddl-toolkit -v "/usr/local/src/eddl" eddl-toolkit:${EDDL_IMAGE_VERSION_TAG} + @$(call test_image,\ + eddl:${EDDL_IMAGE_VERSION_TAG},\ + tests/test_eddl.sh,\ + eddl-toolkit \ + ) test_eddl_toolkit: eddl_folder ## Test 'eddl' images $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - $(call test_image,eddl-toolkit:${EDDL_IMAGE_VERSION_TAG},tests/test_eddl.sh) + @$(call test_image,eddl-toolkit:${EDDL_IMAGE_VERSION_TAG},tests/test_eddl.sh) test_ecvl: ecvl_folder ## Test 'ecvl' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - echo "No test available yet" + @docker run --name ecvl-toolkit -v "/usr/local/src/eddl" ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG} + @$(call test_image,\ + ecvl:${ECVL_IMAGE_VERSION_TAG},\ + tests/test_ecvl.sh,\ + ecvl-toolkit\ + ) test_ecvl_toolkit: ecvl_folder ## Test 'ecvl' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - $(call test_image,ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG},tests/test_ecvl.sh) + @$(call test_image,ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG},tests/test_ecvl.sh) test_pyeddl: pyeddl_folder ## Test 'ecvl' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - $(call test_image,\ + @docker run --name pyeddl-toolkit -v "/usr/local/src/pyeddl" pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG} + @$(call test_image,\ pyeddl:${PYEDDL_IMAGE_VERSION_TAG},\ tests/test_pyeddl.sh,\ - pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},\ - tests/pyeddl,/usr/local/src/pyeddl \ + pyeddl-toolkit\ ) test_pyeddl_toolkit: pyeddl_folder ## Test 'ecvl' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - $(call test_image,pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},tests/test_pyeddl.sh) + @$(call test_image,pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},tests/test_pyeddl.sh) test_pyecvl: pyecvl_folder ## Test 'ecvl' images + $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - $(call test_image,\ + @docker run --name ecvl-toolkit -v "/usr/local/src/ecvl" ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG} + @docker run --name pyecvl-toolkit -v "/usr/local/src/pyecvl" pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG} + @$(call test_image,\ pyecvl:${PYECVL_IMAGE_VERSION_TAG},\ tests/test_pyecvl.sh,\ - pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},\ - tests/pyecvl,/usr/local/src/pyecvl \ + ecvl-toolkit pyecvl-toolkit\ ) test_pyecvl_toolkit: pyecvl_folder ## Test 'ecvl' images $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - $(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) + @@$(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) ############################################################################################################################ ### Push Docker images @@ -824,7 +829,7 @@ clean: clean_images clean_sources publish_libs_toolkit publish_eddl_toolkit publish_ecvl_toolkit \ publish_pylibs publish_pyeddl publish_pyecvl \ publish_pylibs_toolkit publish_pyeddl_toolkit publish_pyecvl_toolkit \ - test_eddl test_eddl_toolkit test_ecvl test_ecvl_toolkit test_pyeddl \ + tests _tests test_eddl test_eddl_toolkit test_ecvl test_ecvl_toolkit test_pyeddl \ test_pyeddl_toolkit test_pyecvl test_pyecvl_toolkit \ clean_sources \ clean_eddl_sources clean_ecvl_sources \ diff --git a/tests/test_ecvl.sh b/tests/test_ecvl.sh index 00865cc..2f242d9 100644 --- a/tests/test_ecvl.sh +++ b/tests/test_ecvl.sh @@ -1,5 +1,10 @@ #!/bin/bash +# set the path containing tests ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} +# install cmake just to run ctest +apt-get update -y -q && apt-get install -y -q cmake + +# run all tests cd ${ECVL_SRC}/build && ctest -C Debug -VV diff --git a/tests/test_eddl.sh b/tests/test_eddl.sh index 28c9507..34e5b38 100644 --- a/tests/test_eddl.sh +++ b/tests/test_eddl.sh @@ -1,5 +1,10 @@ #!/bin/bash +# set the path containing tests EDDL_SRC=${EDDL_SRC:-"/usr/local/src/eddl"} +# install cmake just to run ctest +apt-get update -y -q && apt-get install -y -q cmake + +# run all tests cd ${EDDL_SRC}/build && ctest -C Debug -VV diff --git a/tests/test_pyecvl.sh b/tests/test_pyecvl.sh index 09e3571..72f003f 100644 --- a/tests/test_pyecvl.sh +++ b/tests/test_pyecvl.sh @@ -1,13 +1,17 @@ #!/bin/bash +# set the path containing sources and tests +ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} PYECVL_SRC=${PYECVL_SRC:-"/usr/local/src/pyecvl"} +# run tests cd ${PYECVL_SRC} && pytest tests +# run examples cd ${PYECVL_SRC}/examples python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml" python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml" -python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/data/isic_dicom/ISIC_0000008.dcm" +python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/examples/data/dicom/ISIC_0000008.dcm" python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg" python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi" -python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg test_mod.jpg" \ No newline at end of file +python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg" "test_mod.jpg" \ No newline at end of file diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 8528f3e..514b072 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -1,7 +1,11 @@ #!/bin/bash +# set the path containing sources and tests PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} +# run tests cd ${PYEDDL_SRC} && pytest tests + +# run examples cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1 From 3bab9f88db219b7b9fb841033e51d018a33ccf9e Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 18 Feb 2020 19:08:15 +0100 Subject: [PATCH 110/200] Bump version number of the base image --- build.conf | 2 +- release.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.conf b/build.conf index 1b719b2..1a735ed 100644 --- a/build.conf +++ b/build.conf @@ -1,7 +1,7 @@ # DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 +DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 DOCKER_LOGIN_DONE=true diff --git a/release.conf b/release.conf index e185cdf..06048d4 100644 --- a/release.conf +++ b/release.conf @@ -1,7 +1,7 @@ # DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG=0.1.8 +DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 DOCKER_LOGIN_DONE=true From 7713ef7282b4ba3dac18217bff356f305c6290a1 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 19 Feb 2020 07:32:35 +0000 Subject: [PATCH 111/200] Do not pull Docker images when cache is disabled --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1c4114b..296383a 100644 --- a/Makefile +++ b/Makefile @@ -154,14 +154,15 @@ define build_image $(eval tagged_image := ${image_name}:${tag}) $(eval images := $(shell docker images -q ${tagged_image})) $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag} 2>/dev/null)) - $(if $(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},1),\ + $(if $(or $(findstring ${_DO_NOT_USE_DOCKER_CACHE},1),$(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},1)),\ + @echo "Not using ${_DO_NOT_USE_DOCKER_CACHE} ${_DO_NOT_PULL_DOCKER_IMAGES}"; \ $(call build_new_image), $(if ${images},\ @echo "Docker image '${tagged_image}' exists (id: ${images})", \ $(if $(and ${exists},$(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},0)), \ @echo "Pulling image '${full_image_name}:${tag}'..."; docker pull ${full_image_name}:${tag} && docker tag ${full_image_name}:${tag} ${tagged_image}, \ - @echo "Image pull disabled..." ; \ + @echo "Docker image '${full_image_name}:${tag}' doesn't exist", \ $(call build_new_image) ) ) From 3330fe20b9f189c600a1bc6e5c4abe0ff1934492 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 19 Feb 2020 08:11:15 +0000 Subject: [PATCH 112/200] Report test exit code --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 296383a..4cf2f74 100644 --- a/Makefile +++ b/Makefile @@ -574,7 +574,9 @@ define test_image $(eval volumes := $(shell if [ -n "${containers}" ]; then for cname in ${containers}; do echo "--volumes-from $${cname}"; done; fi)) echo "Test: ${test_script}' @ '${image}'..." ; \ cat ${test_script} | ${DOCKER_RUN} ${volumes} ${image} /bin/sh ; \ - docker container prune -f ; \ + exit_code=$$? \ + && docker container prune -f \ + && exit $${exit_code} ; \ echo "DONE" endef From ac3cecd42b4291c34f1f627eaaf0c6c74ecd2405 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 19 Feb 2020 08:13:04 +0000 Subject: [PATCH 113/200] Update comment --- tests/test_eddl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_eddl.sh b/tests/test_eddl.sh index 34e5b38..d4dc996 100644 --- a/tests/test_eddl.sh +++ b/tests/test_eddl.sh @@ -1,6 +1,6 @@ #!/bin/bash -# set the path containing tests +# set the path containing sources and tests EDDL_SRC=${EDDL_SRC:-"/usr/local/src/eddl"} # install cmake just to run ctest From f3706f69d04e75fc0da586ae8ea49a2eb2c4e7c1 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 19 Feb 2020 08:23:52 +0000 Subject: [PATCH 114/200] Fix path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4cf2f74..587fcd9 100644 --- a/Makefile +++ b/Makefile @@ -603,7 +603,7 @@ test_eddl_toolkit: eddl_folder ## Test 'eddl' images test_ecvl: ecvl_folder ## Test 'ecvl' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - @docker run --name ecvl-toolkit -v "/usr/local/src/eddl" ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG} + @docker run --name ecvl-toolkit -v "/usr/local/src/ecvl" ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG} @$(call test_image,\ ecvl:${ECVL_IMAGE_VERSION_TAG},\ tests/test_ecvl.sh,\ From cf0b4b5918a926d53dce9f059516d460f98ce8a3 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 19 Feb 2020 09:49:52 +0000 Subject: [PATCH 115/200] Update ECVL revision --- release.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.conf b/release.conf index 06048d4..67b4aac 100644 --- a/release.conf +++ b/release.conf @@ -25,7 +25,7 @@ DOCKER_IMAGE_PREFIX= # ECVL repository ECVL_REPOSITORY=https://github.com/deephealthproject/ecvl.git ECVL_BRANCH=master -ECVL_REVISION=v0.1.0 +ECVL_REVISION=1512be8 # PyECVL PYECVL_REPOSITORY=https://github.com/deephealthproject/pyecvl.git From b2dd4292d8ab96ead056082a87dd90eb7e8814b3 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Sun, 23 Feb 2020 18:07:15 +0000 Subject: [PATCH 116/200] Update tests --- Makefile | 53 ++++++++++++++++++++++++++++------------------ tests/test_ecvl.sh | 4 +++- tests/test_eddl.sh | 4 +++- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 587fcd9..5f9cf2b 100644 --- a/Makefile +++ b/Makefile @@ -259,7 +259,7 @@ define set_library_revision $(eval ${lib}_REVISION := $(call get_revision,$(1)/$(2))) $(eval $(lib)_TAG = $(call get_tag,$(1)/$(2))) $(eval ${lib}_IMAGE_VERSION_TAG = $(or ${${lib}_IMAGE_VERSION_TAG},${${lib}_TAG},${${lib}_REVISION})) - @echo "${lib} rev: ${${lib}_REVISION} ${$(lib)_TAG} ${${lib}_IMAGE_VERSION_TAG}" + @echo "${lib} rev: ${${lib}_REVISION} ${${lib}_TAG} (image-tag: ${${lib}_IMAGE_VERSION_TAG})" endef .DEFAULT_GOAL := help @@ -570,19 +570,34 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image define test_image $(eval image := $(1)) $(eval test_script := $(2)) - $(eval containers := $(3)) - $(eval volumes := $(shell if [ -n "${containers}" ]; then for cname in ${containers}; do echo "--volumes-from $${cname}"; done; fi)) - echo "Test: ${test_script}' @ '${image}'..." ; \ - cat ${test_script} | ${DOCKER_RUN} ${volumes} ${image} /bin/sh ; \ - exit_code=$$? \ - && docker container prune -f \ - && exit $${exit_code} ; \ - echo "DONE" + $(eval container_paths := $(3)) + $(eval rname := $(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)) + echo -e "\n\n\n*************************************************************************************************************" >&2 ; \ + echo -e "*** Test: '${test_script}' @ '${image}' image ***" >&2 ; \ + echo -e "*************************************************************************************************************\n" >&2 ; \ + cnames="" ; \ + for cpath in ${container_paths}; do \ + xcpath=($$(echo $${cpath} | tr "=" " ")) ; \ + cname=$$(echo $${xcpath[0]} | sed -e +s+:.*++)-${rname} ; \ + cnames="$${cnames} $${cname}" ; \ + volumes="$${volumes} --volumes-from $${cname}" ; \ + printf "\nCreating temp container instance of '$${xcpath[0]}' (name: $${cname})... " >&2; \ + docker create --name $${cname} -v "$${xcpath[1]}" $${xcpath[0]} > /dev/null ; \ + printf "DONE" >&2 ; \ + done ; \ + printf "\n\n" ; \ + cat ${test_script} | ${DOCKER_RUN} $${volumes} ${image} /bin/sh ; \ + exit_code=$$? ; \ + for cname in $${cnames}; do \ + printf "\nRemoving temp container instance '$${cname}'... " >&2; \ + docker rm -f $${cname} > /dev/null ; printf "DONE" >&2 ; done ; \ + echo -e "\n*************************************************************************************************************\n\n\n" >&2 ; \ + exit $${exit_code} endef -tests: _tests ## Test all docker images +test: _test ## Test all docker images -_tests: \ +_test: \ test_eddl test_eddl_toolkit \ test_ecvl test_ecvl_toolkit \ test_pyeddl test_pyeddl_toolkit \ @@ -590,11 +605,10 @@ _tests: \ test_eddl: eddl_folder ## Test 'eddl' images $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) - @docker run --name eddl-toolkit -v "/usr/local/src/eddl" eddl-toolkit:${EDDL_IMAGE_VERSION_TAG} @$(call test_image,\ eddl:${EDDL_IMAGE_VERSION_TAG},\ tests/test_eddl.sh,\ - eddl-toolkit \ + eddl-toolkit:${EDDL_IMAGE_VERSION_TAG}=/usr/local/src/eddl \ ) test_eddl_toolkit: eddl_folder ## Test 'eddl' images @@ -603,11 +617,10 @@ test_eddl_toolkit: eddl_folder ## Test 'eddl' images test_ecvl: ecvl_folder ## Test 'ecvl' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - @docker run --name ecvl-toolkit -v "/usr/local/src/ecvl" ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG} @$(call test_image,\ ecvl:${ECVL_IMAGE_VERSION_TAG},\ tests/test_ecvl.sh,\ - ecvl-toolkit\ + ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG}=/usr/local/src/ecvl \ ) test_ecvl_toolkit: ecvl_folder ## Test 'ecvl' images @@ -616,11 +629,10 @@ test_ecvl_toolkit: ecvl_folder ## Test 'ecvl' images test_pyeddl: pyeddl_folder ## Test 'ecvl' images $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) - @docker run --name pyeddl-toolkit -v "/usr/local/src/pyeddl" pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG} @$(call test_image,\ pyeddl:${PYEDDL_IMAGE_VERSION_TAG},\ tests/test_pyeddl.sh,\ - pyeddl-toolkit\ + pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG}=/usr/local/src/pyeddl\ ) test_pyeddl_toolkit: pyeddl_folder ## Test 'ecvl' images @@ -630,15 +642,14 @@ test_pyeddl_toolkit: pyeddl_folder ## Test 'ecvl' images test_pyecvl: pyecvl_folder ## Test 'ecvl' images $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - @docker run --name ecvl-toolkit -v "/usr/local/src/ecvl" ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG} - @docker run --name pyecvl-toolkit -v "/usr/local/src/pyecvl" pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG} @$(call test_image,\ pyecvl:${PYECVL_IMAGE_VERSION_TAG},\ tests/test_pyecvl.sh,\ - ecvl-toolkit pyecvl-toolkit\ + 'ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG}=/usr/local/src/ecvl' \ + 'pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG}=/usr/local/src/pyecvl' \ ) -test_pyecvl_toolkit: pyecvl_folder ## Test 'ecvl' images +test_pyecvl_toolkit: #pyecvl_folder ## Test 'ecvl' images $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) @@$(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) diff --git a/tests/test_ecvl.sh b/tests/test_ecvl.sh index 2f242d9..51c152e 100644 --- a/tests/test_ecvl.sh +++ b/tests/test_ecvl.sh @@ -4,7 +4,9 @@ ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} # install cmake just to run ctest -apt-get update -y -q && apt-get install -y -q cmake +if [ ! $(command -v cmake) ]; then + apt-get update -y -q && apt-get install -y -q cmake +fi # run all tests cd ${ECVL_SRC}/build && ctest -C Debug -VV diff --git a/tests/test_eddl.sh b/tests/test_eddl.sh index d4dc996..cb7c6cb 100644 --- a/tests/test_eddl.sh +++ b/tests/test_eddl.sh @@ -4,7 +4,9 @@ EDDL_SRC=${EDDL_SRC:-"/usr/local/src/eddl"} # install cmake just to run ctest -apt-get update -y -q && apt-get install -y -q cmake +if [ ! $(command -v cmake) ]; then + apt-get update -y -q && apt-get install -y -q cmake +fi # run all tests cd ${EDDL_SRC}/build && ctest -C Debug -VV From 784c58767e48d26c1b7e5cf05fec28d12a387f06 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Sun, 23 Feb 2020 20:22:20 +0000 Subject: [PATCH 117/200] Add Jenkins file --- jenkins.sh | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100755 jenkins.sh diff --git a/jenkins.sh b/jenkins.sh new file mode 100755 index 0000000..9debbf8 --- /dev/null +++ b/jenkins.sh @@ -0,0 +1,256 @@ +#!/bin/bash + +#set -x +set -o nounset +set -o errexit +set -o pipefail +# without errtrace functions don't inherit the ERR trap +set -o errtrace + + +function abspath() { + local path="${*}" + + if [[ -d "${path}" ]]; then + echo "$( cd "${path}" >/dev/null && pwd )" + else + echo "$( cd "$( dirname "${path}" )" >/dev/null && pwd )/$(basename "${path}")" + fi +} + +function log() { + echo -e "${@}" >&2 +} + +function debug_log() { + if [[ -n "${DEBUG:-}" ]]; then + echo -e "DEBUG: ${@}" >&2 + fi +} + +function error_log() { + echo -e "ERROR: ${@}" >&2 +} + +function error_trap() { + error_log "Error at line ${BASH_LINENO[1]} running the following command:\n\n\t${BASH_COMMAND}\n\n" + error_log "Stack trace:" + for (( i=1; i < ${#BASH_SOURCE[@]}; ++i)); do + error_log "$(printf "%$((4*$i))s %s:%s\n" " " "${BASH_SOURCE[$i]}" "${BASH_LINENO[$i]}")" + done + exit 2 +} + +trap error_trap ERR + +function usage_error() { + if [[ $# > 0 ]]; then + echo -e "ERROR: ${@}" >&2 + fi + help + exit 2 +} + +function help() { + local script_name=$(basename "$0") + echo -e "\nUsage of '${script_name}' + ${script_name} [options] + ${script_name} -h prints this help message + ${script_name} -v prints the '${script_name}' version + OPTIONS: + --clean-sources Remove library sources + --clean-images Remove local Docker images + --disable cache Disable Docker cache + --disable pull Disable pull of existing Docker images + --docker-libs-revision + --docker-libs-branch + " >&2 +} + +# sw version +LIBS_TAG=$(git tag -l --points-at HEAD | tail -n 1) +LIBS_REVISION=$(git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') +LIBS_BRANCH=$(git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') +LIBS_VERSION=$(if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) + +# set base images +export DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" +export DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" +export DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 +# set Docker repository +export DOCKER_REPOSITORY_OWNER=dhealth + +# default libs version +export DEFAULT_DOCKER_LIBS_BRANCH="develop" +export DOCKER_LIBS_BRANCH=${DEFAULT_DOCKER_LIBS_BRANCH} +export DOCKER_LIBS_VERSION="" + +# set Docker repository +export DOCKER_REPOSITORY_OWNER="${DOCKER_REPOSITORY_OWNER:-dhealth}" + +# various settings +CLEAN_IMAGES=0 +CLEAN_SOURCES=0 +DISABLE_CACHE=0 +DISABLE_PULL=0 + + +# get docker-libs repository +function clone_docker_libs() { + if [[ ! -d "docker-libs" ]]; then + log "Cloning docker-libs (branch=${DOCKER_LIBS_BRANCH}, rev=${DOCKER_LIBS_VERSION})..." + if [[ -n "${DOCKER_LIBS_BRANCH}" ]]; then + branch="-b ${DOCKER_LIBS_BRANCH}" + fi + echo "git clone "${branch}" https://github.com/kikkomep/docker-libs.git" + git clone ${branch} https://github.com/kikkomep/docker-libs.git + fi + if [[ -n "${DOCKER_LIBS_VERSION}" ]]; then + log "Cloning docker-libs (rev.${DOCKER_LIBS_VERSION})..." + cd docker-libs && git fetch && git reset --hard ${DOCKER_LIBS_VERSION} + fi + log "DONE" +} + +# Docker login +function docker_login() { + echo ${DOCKER_PASSWORD} | docker login --username ${DOCKER_USER} --password-stdin + export DOCKER_LOGIN_DONE="true" +} + +function run() { + # set repository + local REPOSITORY=$(basename $(git rev-parse --show-toplevel)) + # set library name + local LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-IMAGES+LIBS+') + # set git tag & branch & image prefix + # and define whether to push lates tag + GIT_BRANCH=${GIT_BRANCH:-$(git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/|tags/)++g; s+/+-+g; s/ .*//')} + BRANCH_NAME=$(echo "${GIT_BRANCH}" | sed 's+origin/++g; s+refs/tags/++g') + NORMALIZED_BRANCH_NAME=$(echo "${BRANCH_NAME}" | sed 's+/+-+g; s+[[:space:]]++g') + TAG=$(git tag -l --points-at HEAD | tail -n 1 | sed 's+[[:space:]]++g') + REVISION="$(git rev-parse --short HEAD --short | sed 's+[[:space:]]++g')" + if [ -n "${TAG}" ]; then + DOCKER_IMAGE_PREFIX="${TAG}" + # update latest if a tag exists and the branch is master + if [ "${BRANCH_NAME}" == "master" ]; then + export DOCKER_IMAGE_LATEST=true + fi + else + DOCKER_IMAGE_PREFIX="${REVISION}" + fi + + # define Docker image tags + export BUILD_NUMBER=${BUILD_NUMBER:-$(date '+%Y%m%d%H%M%S')} + export DOCKER_IMAGE_TAG="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" + export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_PREFIX} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" + + # set revision + export ${LIB_NAME}_REVISION=${REVISION} + # set branch + export ${LIB_NAME}_BRANCH=${BRANCH_NAME} + # set image build tag + export ${LIB_NAME}_IMAGE_VERSION_TAG=${DOCKER_IMAGE_TAG} + + # log environment + printenv + + echo "${REPOSITORY}" + + + # detect repository + lib_suffix="" + if [[ "${REPOSITORY}" == "LIBS" ]]; then + + echo "SUFF: ${lib_suffix}" + else # clone docker-libs + lib_suffix="_${REPOSITORY}" + echo "SUFF ---: ${lib_suffix}" + export CONFIG_FILE="" + clone_docker_libs + cd docker-libs + fi + + # cleanup sources + if [[ "${CLEAN_SOURCES}" == "true" ]]; then + make clean_sources + fi + + # cleanup images + if [[ "${CLEAN_IMAGES}" == "true" ]]; then + make clean_images + fi + + # build images + make build${lib_suffix} + echo "Docker images after..." + docker images + # make tests + make test${lib_suffix} + # push images + #make push${lib_suffix} +} + +# parse arguments +POSITIONAL=() +while [[ $# -gt 0 ]] +do + opt="${1}" + value="${2:-}" + case $opt in + + -h) help; exit 0 ;; + -v) print_version; exit 0 ;; + + --clean-sources) + CLEAN_SOURCES=true + shift ;; + + --clean-images) + CLEAN_IMAGES=true + shift ;; + + --docker-libs-branch) + DOCKER_LIBS_BRANCH="${value}" + shift 2 ;; + + --docker-libs-version) + DOCKER_LIBS_VERSION="${value}" + shift 2 ;; + + --disable-cache) + DISABLE_CACHE=1 + shift ;; + + --disable-pull) + DISABLE_PULL=1 + shift ;; + + *) # unknown option + POSITIONAL+=("$opt") # save it in an array for later + shift ;; + esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +# get the absolute path of CONFIG_DIR +CONFIG_DIR=$(abspath $(pwd)) + +debug_log "docker-libs branch: ${DOCKER_LIBS_BRANCH}" +debug_log "docker-libs revision: ${DOCKER_LIBS_VERSION}" +debug_log "disable cache: ${DISABLE_CACHE}" +debug_log "disable pull: ${DISABLE_PULL}" + +# +export DOCKER_LIBS_BRANCH +export DOCKER_LIBS_VERSION +export CLEAN_IMAGES +export CLEAN_SOURCES +export DISABLE_CACHE +export DISABLE_PULL + +# login to DockerHub +#docker_login + +# exec +run From 40de433e083c0927feeb02c3166dfe010b3d7eac Mon Sep 17 00:00:00 2001 From: kikkomep Date: Sun, 23 Feb 2020 23:35:06 +0000 Subject: [PATCH 118/200] Udate branch detection --- jenkins.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 9debbf8..21b0a5c 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -70,7 +70,7 @@ function help() { # sw version LIBS_TAG=$(git tag -l --points-at HEAD | tail -n 1) LIBS_REVISION=$(git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') -LIBS_BRANCH=$(git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') +LIBS_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') LIBS_VERSION=$(if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) # set base images @@ -125,7 +125,7 @@ function run() { local LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-IMAGES+LIBS+') # set git tag & branch & image prefix # and define whether to push lates tag - GIT_BRANCH=${GIT_BRANCH:-$(git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/|tags/)++g; s+/+-+g; s/ .*//')} + GIT_BRANCH=${GIT_BRANCH:-$(git rev-parse --abbrev-ref HEAD | sed -E 's+(remotes/|origin/|tags/)++g; s+/+-+g; s/ .*//')} BRANCH_NAME=$(echo "${GIT_BRANCH}" | sed 's+origin/++g; s+refs/tags/++g') NORMALIZED_BRANCH_NAME=$(echo "${BRANCH_NAME}" | sed 's+/+-+g; s+[[:space:]]++g') TAG=$(git tag -l --points-at HEAD | tail -n 1 | sed 's+[[:space:]]++g') From 5e751664d7722a6c43aef6a5c9b176b09e60039d Mon Sep 17 00:00:00 2001 From: kikkomep Date: Mon, 24 Feb 2020 15:18:47 +0000 Subject: [PATCH 119/200] Track dependencies on log files --- Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 5f9cf2b..4436509 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,12 @@ endif # date.time as build number BUILD_NUMBER := $(or ${BUILD_NUMBER},$(shell date '+%Y%m%d.%H%M%S')) +# log file with dependencies +IMAGES_LOG := images.log +LIBRARIES_LOG := libraries.log +DEPENDENCIES_LOG := dependencies.log +DEPENDENCY_GRAPH_FILE := graph.dot + # set docker user credentials DOCKER_USER := $(or ${DOCKER_USER},${USER}) DOCKER_PASSWORD := ${DOCKER_PASSWORD} @@ -167,6 +173,8 @@ define build_image ) ) ) + $(call log_image_revision,$(target),$(tag),extend,$(shell echo $(5) | sed -e 's+:.*++')) + $(if $(6),$(call log_image_revision,$(target),$(tag),use,$(shell echo $(6) | sed -e 's+:.*++'))) endef define push_image @@ -262,6 +270,24 @@ define set_library_revision @echo "${lib} rev: ${${lib}_REVISION} ${${lib}_TAG} (image-tag: ${${lib}_IMAGE_VERSION_TAG})" endef +define log_library_revision + $(file >>${LIBRARIES_LOG},$(1) [label="$(1) (rev. ${$(1)_REVISION} ${$(1)_TAG})"];) \ + $(if $(2),$(file >>${DEPENDENCIES_LOG},$(2) -> $(1) [label=" << depends on >> ",color="black:invis:black"];)) +endef + +define log_image_revision + $(eval A := $(shell echo $(1) | sed -e 's+[-:/\.]+_+g')) + $(eval B := $(shell echo $(4) | sed -e 's+[-:/\.]+_+g')) + $(eval relation_style := $(shell \ + if [[ $(3) == "install" ]]; then echo 'style=dashed,color="black"' ; \ + elif [[ $(3) == "extend" ]]; then echo 'color="black"' ; \ + elif [[ $(3) == "use" ]]; then echo 'style=dotted,color="black"' ; \ + else echo "style=dotted,color=gray" ; fi \ + )) + $(file >>${IMAGES_LOG},${A} [label="$(1) (tag. $(2))"];) \ + $(if $(4),$(file >>${DEPENDENCIES_LOG},$(A) -> $(B) [label=" << $(3) >> ",$(relation_style)];)) +endef + .DEFAULT_GOAL := help # version @@ -271,7 +297,26 @@ version: ## Output the current version of this Makefile help: ## Show help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) -libs_folder: +_reset_log_file: + $(file >${IMAGES_LOG},) + $(file >${LIBRARIES_LOG},) + $(file >${DEPENDENCIES_LOG},) + +dependency_graph: ## make a dependency graph of the involved libraries + @echo "digraph {" > ${DEPENDENCY_GRAPH_FILE} \ + && cat ${LIBRARIES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ + && cat ${IMAGES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ + && cat ${DEPENDENCIES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ + && echo "}" >> ${DEPENDENCY_GRAPH_FILE} \ + && if [[ $$(command -v dot) ]]; then \ + dot -Tpdf ${DEPENDENCY_GRAPH_FILE} -o ${DEPENDENCY_GRAPH_FILE}.pdf; \ + fi + +##################################################################################################################################### +############# Clone sources ############# +##################################################################################################################################### + +libs_folder: _reset_log_file $(if $(wildcard ${LOCAL_LIBS_PATH}),, \ $(info Creating ${LOCAL_LIBS_PATH} folder...) ; \ @mkdir -p ${LOCAL_LIBS_PATH} ; \ @@ -283,7 +328,8 @@ _eddl_folder: libs_folder ) eddl_folder: _eddl_folder - $(call set_library_revision,libs,eddl) + $(call set_library_revision,libs,eddl) \ + $(call log_library_revision,EDDL) define clone_ecvl @@ -296,7 +342,8 @@ _ecvl_folder: libs_folder $(call clone_ecvl) ecvl_folder: _ecvl_folder - $(call set_library_revision,libs,ecvl) + $(call set_library_revision,libs,ecvl) \ + $(call log_library_revision,ECVL) pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} @@ -327,7 +374,8 @@ _pyeddl_dependencies: _pyeddl_shallow_clone pyeddl_folder: _pyeddl_dependencies $(call set_library_revision,libs,eddl) \ - $(call set_library_revision,pylibs,pyeddl) + $(call set_library_revision,pylibs,pyeddl) \ + $(call log_library_revision,PYEDDL) define pyecvl_shallow_clone $(if $(wildcard ${PYECVL_LIB_PATH}),$(info Using existing '${PYECVL_LIB_PATH}' repository), \ @@ -338,6 +386,8 @@ endef define pyecvl_resolve_dependencies $(eval PYEDDL_REVISION = $(call submodule_revision,${PYECVL_LIB_PATH}/third_party,pyeddl,${PYEDDL_REVISION})) $(eval ECVL_REVISION = $(call submodule_revision,${PYECVL_LIB_PATH}/third_party,ecvl,${ECVL_REVISION})) + $(call log_library_revision,PYEDDL,PYECVL) \ + $(call log_library_revision,ECVL,PYECVL) \ if [[ -d ${PYEDDL_LIB_PATH} ]]; then \ echo "Using existing '${PYEDDL_LIB_PATH}' repository" ; \ else \ @@ -370,7 +420,7 @@ _pyecvl_second_level_dependencies: _pyecvl_first_level_dependencies pyecvl_folder: _pyecvl_second_level_dependencies $(call set_library_revision,pylibs,pyecvl) - + $(call log_library_revision,PYECVL) # TODO: remove this patch when not required apply_pyeddl_patches: pyeddl_folder @@ -404,6 +454,7 @@ build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) + $(call log_image_revision,eddl-toolkit,${ECVL_IMAGE_VERSION_TAG},install,EDDL) build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image $(call build_image,libs,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},\ @@ -411,6 +462,7 @@ build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ --label ECVL_REVISION=${ECVL_REVISION},eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) + $(call log_image_revision,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},install,ECVL) build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image $(call build_image,libs,libs-toolkit,${LIBS_IMAGE_VERSION_TAG},\ @@ -423,7 +475,6 @@ build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image --label ECVL_REVISION=${ECVL_REVISION},ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) - ############# libs ############# _build_libs_base: _build_libs_base_toolkit @@ -813,13 +864,13 @@ clean_images: \ ############################################################################################################################ -### Clean Docker images +### Clean Sources and Docker images ############################################################################################################################ clean: clean_images clean_sources -.PHONY: help \ +.PHONY: help _reset_log_file dependency_graph \ libs_folder eddl_folder ecvl_folder pylibs_folder \ pyeddl_folder _pyeddl_shallow_clone _pyecvl_second_level_dependencies \ pyecvl_folder _pyeddl_shallow_clone _pyecvl_first_level_dependencies _pyecvl_second_level_dependencies \ @@ -852,4 +903,4 @@ clean: clean_images clean_sources clean_images \ clean_base_images \ clean_eddl_images clean_ecvl_images clean_libs_images \ - clean_pyeddl_images clean_pyecvl_images clean_pylibs_images \ No newline at end of file + clean_pyeddl_images clean_pyecvl_images clean_pylibs_images From 4614981dacfd6e3b3298a779eb08cd064bd6ebb2 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 15:14:16 +0000 Subject: [PATCH 120/200] Fix dependencies --- Makefile | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 4436509..a9ff08c 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,9 @@ endif BUILD_NUMBER := $(or ${BUILD_NUMBER},$(shell date '+%Y%m%d.%H%M%S')) # log file with dependencies -IMAGES_LOG := images.log -LIBRARIES_LOG := libraries.log -DEPENDENCIES_LOG := dependencies.log +IMAGES_LOG := .images.log +LIBRARIES_LOG := .libraries.log +DEPENDENCIES_LOG := .dependencies.log DEPENDENCY_GRAPH_FILE := graph.dot # set docker user credentials @@ -298,15 +298,30 @@ help: ## Show help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) _reset_log_file: - $(file >${IMAGES_LOG},) - $(file >${LIBRARIES_LOG},) - $(file >${DEPENDENCIES_LOG},) + $(if $(RESET_LOG_FILE_DONE),echo "Already reset",\ + echo "Resetting";\ + $(file >${IMAGES_LOG},)\ + $(file >${LIBRARIES_LOG},)\ + $(file >${DEPENDENCIES_LOG},)\ + ) + +reset_log_file: _reset_log_file + $(eval RESET_LOG_FILE_DONE := 1) + +libraries_list: + sort -u ${LIBRARIES_LOG} + +images_list: + sort -u ${IMAGES_LOG} + +dependencies_list: + sort -u ${DEPENCIES_LOG} dependency_graph: ## make a dependency graph of the involved libraries @echo "digraph {" > ${DEPENDENCY_GRAPH_FILE} \ - && cat ${LIBRARIES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ - && cat ${IMAGES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ - && cat ${DEPENDENCIES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ + && sort -u ${LIBRARIES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ + && sort -u ${IMAGES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ + && sort -u ${DEPENDENCIES_LOG} >> ${DEPENDENCY_GRAPH_FILE} \ && echo "}" >> ${DEPENDENCY_GRAPH_FILE} \ && if [[ $$(command -v dot) ]]; then \ dot -Tpdf ${DEPENDENCY_GRAPH_FILE} -o ${DEPENDENCY_GRAPH_FILE}.pdf; \ @@ -316,7 +331,7 @@ dependency_graph: ## make a dependency graph of the involved libraries ############# Clone sources ############# ##################################################################################################################################### -libs_folder: _reset_log_file +libs_folder: reset_log_file $(if $(wildcard ${LOCAL_LIBS_PATH}),, \ $(info Creating ${LOCAL_LIBS_PATH} folder...) ; \ @mkdir -p ${LOCAL_LIBS_PATH} ; \ @@ -345,7 +360,7 @@ ecvl_folder: _ecvl_folder $(call set_library_revision,libs,ecvl) \ $(call log_library_revision,ECVL) -pylibs_folder: +pylibs_folder: reset_log_file @mkdir -p ${LOCAL_PYLIBS_PATH} define pyeddl_shallow_clone @@ -363,6 +378,7 @@ define pyeddl_clone_dependencies printf "Copying revision '${EDDL_REVISION}' of EDDL library... " ; \ rm -rf ${PYEDDL_LIB_PATH}/third_party/eddl && cp -a ${EDDL_LIB_PATH} ${PYEDDL_LIB_PATH}/third_party/eddl ; \ printf "DONE\n" ; \ + $(call log_library_revision,EDDL,PYEDDL) \ fi endef @@ -395,6 +411,7 @@ define pyecvl_resolve_dependencies printf "Copying revision '${PYEDDL_REVISION}' of PYEDDL library... " ; \ rm -rf ${PYECVL_LIB_PATH}/third_party/pyeddl && cp -a ${PYEDDL_LIB_PATH} ${PYECVL_LIB_PATH}/third_party/pyeddl ; \ printf "DONE\n" ; \ + $(call log_library_revision,PYEDDL,PYECVL) \ fi if [[ -d ${ECVL_LIB_PATH} ]]; then \ echo "Using existing '${ECVL_LIB_PATH}' repository" ; \ @@ -404,6 +421,7 @@ define pyecvl_resolve_dependencies printf "Copying revision '${ECVL_REVISION}' of ECVL library... " ; \ rm -rf ${PYECVL_LIB_PATH}/third_party/ecvl && cp -a ${ECVL_LIB_PATH} ${PYECVL_LIB_PATH}/third_party/ecvl ; \ printf "DONE\n" ; \ + $(call log_library_revision,ECVL,PYECVL) \ fi endef @@ -454,7 +472,7 @@ build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION},libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) - $(call log_image_revision,eddl-toolkit,${ECVL_IMAGE_VERSION_TAG},install,EDDL) + $(call log_image_revision,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},install,EDDL) build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image $(call build_image,libs,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},\ @@ -487,6 +505,7 @@ build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION},libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) + $(call log_image_revision,eddl,${EDDL_IMAGE_VERSION_TAG},install,EDDL) build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image $(call build_image,libs,ecvl,${ECVL_IMAGE_VERSION_TAG},\ @@ -497,6 +516,7 @@ build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ --label ECVL_REVISION=${ECVL_REVISION},eddl:$(EDDL_IMAGE_VERSION_TAG),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + $(call log_image_revision,ecvl,${ECVL_IMAGE_VERSION_TAG},install,ECVL) build_libs: build_ecvl ## Build 'libs' image $(call build_image,libs,libs,${LIBS_IMAGE_VERSION_TAG},\ @@ -528,6 +548,7 @@ build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patc --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + $(call log_image_revision,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},install,PYEDDL) build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image $(call build_image,pylibs,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},\ @@ -544,6 +565,7 @@ build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolki --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) + $(call log_image_revision,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},install,PYECVL) build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image $(call build_image,pylibs,pylibs-toolkit,${LIBS_IMAGE_VERSION_TAG},\ @@ -581,6 +603,7 @@ build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) + $(call log_image_revision,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},install,PYEDDL) build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image $(call build_image,pylibs,pyecvl,${PYECVL_IMAGE_VERSION_TAG},\ @@ -597,6 +620,7 @@ build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl:$(PYEDDL_IMAGE_VERSION_TAG),pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) + $(call log_image_revision,pyecvl,${PYECVL_IMAGE_VERSION_TAG},install,PYECVL) build_pylibs: build_pyecvl ## Build 'pylibs' image $(call build_image,pylibs,pylibs,${LIBS_IMAGE_VERSION_TAG},\ @@ -866,11 +890,12 @@ clean_images: \ ############################################################################################################################ ### Clean Sources and Docker images ############################################################################################################################ -clean: clean_images clean_sources +clean: clean_images clean_sources reset_log_file -.PHONY: help _reset_log_file dependency_graph \ +.PHONY: help _reset_log_file reset_log_file \ + libraries_list images_list dependencies_list dependency_graph \ libs_folder eddl_folder ecvl_folder pylibs_folder \ pyeddl_folder _pyeddl_shallow_clone _pyecvl_second_level_dependencies \ pyecvl_folder _pyeddl_shallow_clone _pyecvl_first_level_dependencies _pyecvl_second_level_dependencies \ From 9182b4d94396c6aa7897238fd604b867b36699bd Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 15:15:31 +0000 Subject: [PATCH 121/200] Ignore more files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4f49410..cacb9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .vscode +.*.log libs/eddl libs/ecvl pylibs/pyeddl -pylibs/pyecvl \ No newline at end of file +pylibs/pyecvl From bb7f2af501123aeb5235b08d05d1b5c357317f53 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 15:43:40 +0000 Subject: [PATCH 122/200] Fix track of nvidia images --- Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a9ff08c..4387e7e 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,11 @@ DOCKER_IMAGE_TAG := $(or ${DOCKER_IMAGE_TAG},${BUILD_NUMBER}) DOCKER_BASE_IMAGE_SKIP_PULL := $(or ${DOCKER_BASE_IMAGE_SKIP_PULL},true) DOCKER_NVIDIA_DEVELOP_IMAGE := $(or ${DOCKER_NVIDIA_DEVELOP_IMAGE},nvidia/cuda:10.1-devel) DOCKER_NVIDIA_RUNTIME_IMAGE := $(or ${DOCKER_NVIDIA_RUNTIME_IMAGE},nvidia/cuda:10.1-runtime) +# extract name and tag of nvidia images +DOCKER_NVIDIA_DEVELOP_IMAGE_NAME := $(shell echo ${DOCKER_NVIDIA_DEVELOP_IMAGE} | sed -e 's+:.*++') +DOCKER_NVIDIA_DEVELOP_IMAGE_TAG := $(shell echo ${DOCKER_NVIDIA_DEVELOP_IMAGE} | sed -E 's@.+:(.+)@\1@') +DOCKER_NVIDIA_RUNTIME_IMAGE_NAME := $(shell echo ${DOCKER_NVIDIA_RUNTIME_IMAGE} | sed -e 's+:.*++') +DOCKER_NVIDIA_RUNTIME_IMAGE_TAG := $(shell echo ${DOCKER_NVIDIA_RUNTIME_IMAGE} | sed -E 's@.+:(.+)@\1@') DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) @@ -173,8 +178,8 @@ define build_image ) ) ) - $(call log_image_revision,$(target),$(tag),extend,$(shell echo $(5) | sed -e 's+:.*++')) - $(if $(6),$(call log_image_revision,$(target),$(tag),use,$(shell echo $(6) | sed -e 's+:.*++'))) + $(call log_image_revision,$(target),$(tag),extend,$(shell echo $(5))) + $(if $(6),$(call log_image_revision,$(target),$(tag),use,$(shell echo $(6)))) endef define push_image @@ -276,7 +281,7 @@ define log_library_revision endef define log_image_revision - $(eval A := $(shell echo $(1) | sed -e 's+[-:/\.]+_+g')) + $(eval A := $(shell echo $(1):$(2) | sed -e 's+[-:/\.]+_+g')) $(eval B := $(shell echo $(4) | sed -e 's+[-:/\.]+_+g')) $(eval relation_style := $(shell \ if [[ $(3) == "install" ]]; then echo 'style=dashed,color="black"' ; \ @@ -465,6 +470,7 @@ _build: \ _build_libs_base_toolkit: $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_DEVELOP_IMAGE)) + $(call log_image_revision,$(DOCKER_NVIDIA_DEVELOP_IMAGE_NAME),$(DOCKER_NVIDIA_DEVELOP_IMAGE_TAG)) build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image $(call build_image,libs,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},\ @@ -498,6 +504,7 @@ build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image _build_libs_base: _build_libs_base_toolkit $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) + $(call log_image_revision,$(DOCKER_NVIDIA_RUNTIME_IMAGE_NAME),$(DOCKER_NVIDIA_RUNTIME_IMAGE_TAG)) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image $(call build_image,libs,eddl,${EDDL_IMAGE_VERSION_TAG},\ From 58caada599b147947589cf035f5fe06328402b9b Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 15:46:38 +0000 Subject: [PATCH 123/200] Restore unique configuration file --- Makefile | 2 +- build.conf | 46 ----------------------------------- release.conf => settings.conf | 0 3 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 build.conf rename release.conf => settings.conf (100%) diff --git a/Makefile b/Makefile index 4387e7e..d231116 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ PYEDDL_REVISION := ${PYEDDL_REVISION} PYEDDL_TAG := # config file -CONFIG_FILE ?= release.conf +CONFIG_FILE ?= settings.conf ifneq ($(wildcard $(CONFIG_FILE)),) include $(CONFIG_FILE) endif diff --git a/build.conf b/build.conf deleted file mode 100644 index 1a735ed..0000000 --- a/build.conf +++ /dev/null @@ -1,46 +0,0 @@ -# -DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" -DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 - -DOCKER_LOGIN_DONE=true - -# set docker user credentials -#DOCKER_USER=deephealth -#DOCKER_PASSWORD="" - -# use DockerHub as default registry -#DOCKER_REGISTRY=registry.hub.docker.com - -# set Docker repository -#DOCKER_REPOSITORY_OWNER=dhealth -#DOCKER_IMAGE_PREFIX= - -# latest tag settings -#DOCKER_IMAGE_LATEST=false - -# additional tags -#DOCKER_IMAGE_TAG_EXTRA= - -# ECVL repository -ECVL_REPOSITORY=https://github.com/deephealthproject/ecvl.git -#ECVL_BRANCH=master -#ECVL_REVISION=v0.1.0 - -# PyECVL -PYECVL_REPOSITORY=https://github.com/deephealthproject/pyecvl.git -#PYECVL_BRANCH=master -#PYECVL_REVISION=0.1.0 - -# EDDL repository -EDDL_REPOSITORY=https://github.com/deephealthproject/eddl.git -#EDDL_BRANCH=master -#EDDL_REVISION=v0.3.1 - -# PyEDDL repository -PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git -#PYEDDL_BRANCH=master -#PYEDDL_REVISION=0.3.0 - -# date.time as build number -#DOCKER_IMAGE_TAG=0.1.2 diff --git a/release.conf b/settings.conf similarity index 100% rename from release.conf rename to settings.conf From f4f077ac622f0314a918d8920675a4aa0ca8bfa8 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 17:03:27 +0000 Subject: [PATCH 124/200] Update parameters --- jenkins.sh | 80 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 21b0a5c..9e5be0e 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -7,6 +7,25 @@ set -o pipefail # without errtrace functions don't inherit the ERR trap set -o errtrace +# set base images +export DOCKER_NVIDIA_DEVELOP_IMAGE="${DOCKER_NVIDIA_DEVELOP_IMAGE:-nvidia/cuda:10.1-devel}" +export DOCKER_NVIDIA_RUNTIME_IMAGE="${DOCKER_NVIDIA_RUNTIME_IMAGE:-nvidia/cuda:10.1-runtime}" +export DOCKER_BASE_IMAGE_VERSION_TAG="${DOCKER_BASE_IMAGE_VERSION_TAG:-0.2.0}" + +# default libs version +export DOCKER_LIBS_REPO="${DOCKER_LIBS_REPO:-https://github.com/deephealthproject/docker-libs.git}" +export DOCKER_LIBS_BRANCH=${DOCKER_LIBS_BRANCH:-develop} +export DOCKER_LIBS_VERSION="" + +# set Docker repository +export DOCKER_REPOSITORY_OWNER="${DOCKER_REPOSITORY_OWNER:-dhealth}" + +# env requirements +DOCKER_USER=${DOCKER_USER:-} +DOCKER_PASSWORD=${DOCKER_PASSWORD:-} + +# set script version +VERSION=0.2.0 function abspath() { local path="${*}" @@ -51,19 +70,36 @@ function usage_error() { exit 2 } +function print_version() { + echo ${VERSION} +} + function help() { local script_name=$(basename "$0") echo -e "\nUsage of '${script_name}' + ${script_name} [options] ${script_name} -h prints this help message ${script_name} -v prints the '${script_name}' version + OPTIONS: --clean-sources Remove library sources --clean-images Remove local Docker images --disable cache Disable Docker cache --disable pull Disable pull of existing Docker images - --docker-libs-revision - --docker-libs-branch + --disable-docker-login Disable login on Docker registry + + ENVIRONMENT requirements: + * DOCKER_USER + * DOCKER_PASSWORD + + ENVIRONMENT defaults: + * DOCKER_NVIDIA_DEVELOP_IMAGE => nvidia/cuda:10.1-devel + * DOCKER_NVIDIA_RUNTIME_IMAGE => nvidia/cuda:10.1-runtime + * DOCKER_BASE_IMAGE_VERSION_TAG => 0.2.0 + * DOCKER_LIBS_REPO => https://github.com/deephealthproject/docker-libs.git + * DOCKER_LIBS_BRANCH => develop + * DOCKER_REPOSITORY_OWNER => dhealth " >&2 } @@ -73,27 +109,12 @@ LIBS_REVISION=$(git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') LIBS_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') LIBS_VERSION=$(if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) -# set base images -export DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" -export DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -export DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 -# set Docker repository -export DOCKER_REPOSITORY_OWNER=dhealth - -# default libs version -export DEFAULT_DOCKER_LIBS_BRANCH="develop" -export DOCKER_LIBS_BRANCH=${DEFAULT_DOCKER_LIBS_BRANCH} -export DOCKER_LIBS_VERSION="" - -# set Docker repository -export DOCKER_REPOSITORY_OWNER="${DOCKER_REPOSITORY_OWNER:-dhealth}" - # various settings CLEAN_IMAGES=0 CLEAN_SOURCES=0 DISABLE_CACHE=0 DISABLE_PULL=0 - +DISABLE_DOCKER_LOGIN=0 # get docker-libs repository function clone_docker_libs() { @@ -102,8 +123,7 @@ function clone_docker_libs() { if [[ -n "${DOCKER_LIBS_BRANCH}" ]]; then branch="-b ${DOCKER_LIBS_BRANCH}" fi - echo "git clone "${branch}" https://github.com/kikkomep/docker-libs.git" - git clone ${branch} https://github.com/kikkomep/docker-libs.git + git clone ${branch} ${DOCKER_LIBS_REPO} fi if [[ -n "${DOCKER_LIBS_VERSION}" ]]; then log "Cloning docker-libs (rev.${DOCKER_LIBS_VERSION})..." @@ -210,14 +230,6 @@ do CLEAN_IMAGES=true shift ;; - --docker-libs-branch) - DOCKER_LIBS_BRANCH="${value}" - shift 2 ;; - - --docker-libs-version) - DOCKER_LIBS_VERSION="${value}" - shift 2 ;; - --disable-cache) DISABLE_CACHE=1 shift ;; @@ -226,6 +238,10 @@ do DISABLE_PULL=1 shift ;; + --disable-docker-login) + DISABLE_DOCKER_LOGIN=1 + shift ;; + *) # unknown option POSITIONAL+=("$opt") # save it in an array for later shift ;; @@ -250,7 +266,13 @@ export DISABLE_CACHE export DISABLE_PULL # login to DockerHub -#docker_login +if [[ ${DISABLE_DOCKER_LOGIN} == 0 ]]; then + if [[ -z ${DOCKER_USER} || -z ${DOCKER_PASSWORD} ]]; then + usage_error "You need to set DOCKER_USER and DOCKER_PASSWORD on your environment" + fi + docker_login + export DOCKER_LOGIN_DONE="true" +fi # exec run From 7b5eadbf7f57e88910fba44630066eb264766d9f Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 17:36:30 +0000 Subject: [PATCH 125/200] Fix missing quotes --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d231116..1d6de65 100644 --- a/Makefile +++ b/Makefile @@ -284,9 +284,9 @@ define log_image_revision $(eval A := $(shell echo $(1):$(2) | sed -e 's+[-:/\.]+_+g')) $(eval B := $(shell echo $(4) | sed -e 's+[-:/\.]+_+g')) $(eval relation_style := $(shell \ - if [[ $(3) == "install" ]]; then echo 'style=dashed,color="black"' ; \ - elif [[ $(3) == "extend" ]]; then echo 'color="black"' ; \ - elif [[ $(3) == "use" ]]; then echo 'style=dotted,color="black"' ; \ + if [[ "$(3)" == "install" ]]; then echo 'style=dashed,color="black"' ; \ + elif [[ "$(3)" == "extend" ]]; then echo 'color="black"' ; \ + elif [[ "$(3)" == "use" ]]; then echo 'style=dotted,color="black"' ; \ else echo "style=dotted,color=gray" ; fi \ )) $(file >>${IMAGES_LOG},${A} [label="$(1) (tag. $(2))"];) \ From 86be2c884f4842282355c098acd12e79706e1272 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 17:41:08 +0000 Subject: [PATCH 126/200] Add more options --- jenkins.sh | 72 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 9e5be0e..50fff0d 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -85,8 +85,11 @@ function help() { OPTIONS: --clean-sources Remove library sources --clean-images Remove local Docker images - --disable cache Disable Docker cache - --disable pull Disable pull of existing Docker images + --disable-cache Disable Docker cache + --disable-build Disable build of Docker images + --disable-pull Disable pull of existing Docker images + --disable-push Disable push of Docker images + --disable-tests Disable tests of Docker images --disable-docker-login Disable login on Docker registry ENVIRONMENT requirements: @@ -114,6 +117,9 @@ CLEAN_IMAGES=0 CLEAN_SOURCES=0 DISABLE_CACHE=0 DISABLE_PULL=0 +DISABLE_BUILD=0 +DISABLE_PUSH=0 +DISABLE_TESTS=0 DISABLE_DOCKER_LOGIN=0 # get docker-libs repository @@ -142,7 +148,7 @@ function run() { # set repository local REPOSITORY=$(basename $(git rev-parse --show-toplevel)) # set library name - local LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-IMAGES+LIBS+') + local LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-LIBS+LIBS+') # set git tag & branch & image prefix # and define whether to push lates tag GIT_BRANCH=${GIT_BRANCH:-$(git rev-parse --abbrev-ref HEAD | sed -E 's+(remotes/|origin/|tags/)++g; s+/+-+g; s/ .*//')} @@ -150,7 +156,7 @@ function run() { NORMALIZED_BRANCH_NAME=$(echo "${BRANCH_NAME}" | sed 's+/+-+g; s+[[:space:]]++g') TAG=$(git tag -l --points-at HEAD | tail -n 1 | sed 's+[[:space:]]++g') REVISION="$(git rev-parse --short HEAD --short | sed 's+[[:space:]]++g')" - if [ -n "${TAG}" ]; then + if [ -n "${TAG}" ]; then DOCKER_IMAGE_PREFIX="${TAG}" # update latest if a tag exists and the branch is master if [ "${BRANCH_NAME}" == "master" ]; then @@ -175,17 +181,10 @@ function run() { # log environment printenv - echo "${REPOSITORY}" - - # detect repository lib_suffix="" - if [[ "${REPOSITORY}" == "LIBS" ]]; then - - echo "SUFF: ${lib_suffix}" - else # clone docker-libs - lib_suffix="_${REPOSITORY}" - echo "SUFF ---: ${lib_suffix}" + if [[ "${LIB_NAME}" != "LIBS" ]]; then + lib_suffix="_${REPOSITORY}" export CONFIG_FILE="" clone_docker_libs cd docker-libs @@ -202,13 +201,29 @@ function run() { fi # build images - make build${lib_suffix} - echo "Docker images after..." - docker images + if [[ ${DISABLE_BUILD} == 0 ]]; then + log "Docker images before..." + docker images + make build${lib_suffix} ; + log "Docker images after..." + docker images + fi + # make tests - make test${lib_suffix} + if [[ ${DISABLE_TESTS} == 0 ]]; then make test${lib_suffix} ; fi + # push images - #make push${lib_suffix} + if [[ ${DISABLE_PUSH} == 0 ]]; then + # login to DockerHub + if [[ ${DISABLE_DOCKER_LOGIN} == 0 ]]; then + if [[ -z ${DOCKER_USER} || -z ${DOCKER_PASSWORD} ]]; then + usage_error "You need to set DOCKER_USER and DOCKER_PASSWORD on your environment" + fi + docker_login + export DOCKER_LOGIN_DONE="true" + fi + make push${lib_suffix} ; + fi } # parse arguments @@ -234,10 +249,22 @@ do DISABLE_CACHE=1 shift ;; + --disable-build) + DISABLE_BUILD=1 + shift ;; + --disable-pull) DISABLE_PULL=1 shift ;; + --disable-push) + DISABLE_PUSH=1 + shift ;; + + --disable-tests) + DISABLE_TESTS=1 + shift ;; + --disable-docker-login) DISABLE_DOCKER_LOGIN=1 shift ;; @@ -265,14 +292,5 @@ export CLEAN_SOURCES export DISABLE_CACHE export DISABLE_PULL -# login to DockerHub -if [[ ${DISABLE_DOCKER_LOGIN} == 0 ]]; then - if [[ -z ${DOCKER_USER} || -z ${DOCKER_PASSWORD} ]]; then - usage_error "You need to set DOCKER_USER and DOCKER_PASSWORD on your environment" - fi - docker_login - export DOCKER_LOGIN_DONE="true" -fi - # exec run From 26e54be26b635756b8dffdd516c1867ebc7d4161 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Tue, 25 Feb 2020 19:02:01 +0100 Subject: [PATCH 127/200] Fix test/push --- jenkins.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 50fff0d..7c4551e 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -210,7 +210,14 @@ function run() { fi # make tests - if [[ ${DISABLE_TESTS} == 0 ]]; then make test${lib_suffix} ; fi + if [[ ${DISABLE_TESTS} == 0 ]]; then + if [[ -n ${lib_suffix} ]]; then + make test${lib_suffix} ; + make test${lib_suffix}_toolkit ; + else + make test ; + fi + fi # push images if [[ ${DISABLE_PUSH} == 0 ]]; then @@ -222,7 +229,12 @@ function run() { docker_login export DOCKER_LOGIN_DONE="true" fi - make push${lib_suffix} ; + if [[ -n ${lib_suffix} ]]; then + make push${lib_suffix} ; + make push${lib_suffix}_toolkit ; + else + make push ; + fi fi } From dcc9a489d4b1ba7408f40a763be37e4056609d03 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 21:20:44 +0000 Subject: [PATCH 128/200] Use GIT_URL env var --- jenkins.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jenkins.sh b/jenkins.sh index 7c4551e..4ad9853 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -146,7 +146,9 @@ function docker_login() { function run() { # set repository - local REPOSITORY=$(basename $(git rev-parse --show-toplevel)) + local REPOSITORY=$(if [[ -n "${GIT_URL}" ]]; then \ + echo "${GIT_URL}" | sed -E 's+(.*)/([^/]*)\.git+\2+' ; \ + else $(basename $(git rev-parse --show-toplevel)) ; fi) # set library name local LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-LIBS+LIBS+') # set git tag & branch & image prefix From 2c1bba275e5635f86ce6345ed38efda1437bbc11 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 21:57:49 +0000 Subject: [PATCH 129/200] Print list of libraries and images at the end of the pipeline --- jenkins.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jenkins.sh b/jenkins.sh index 4ad9853..cddcec6 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -238,6 +238,14 @@ function run() { make push ; fi fi + + # print images + log "List of Docker images..." + make images_list + + # print libraries + log "List of Libraries..." + make libraries_list } # parse arguments From 8be19f6c95de36250bc289640a6dcfaba5833e2f Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 25 Feb 2020 22:16:55 +0000 Subject: [PATCH 130/200] Hide commands --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1d6de65..b5b43ec 100644 --- a/Makefile +++ b/Makefile @@ -314,13 +314,13 @@ reset_log_file: _reset_log_file $(eval RESET_LOG_FILE_DONE := 1) libraries_list: - sort -u ${LIBRARIES_LOG} + @sort -u ${LIBRARIES_LOG} images_list: - sort -u ${IMAGES_LOG} + @sort -u ${IMAGES_LOG} dependencies_list: - sort -u ${DEPENCIES_LOG} + @sort -u ${DEPENCIES_LOG} dependency_graph: ## make a dependency graph of the involved libraries @echo "digraph {" > ${DEPENDENCY_GRAPH_FILE} \ From efbe758b060846c075cf675566af44b33bf6622a Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 26 Feb 2020 12:27:54 +0100 Subject: [PATCH 131/200] Update README --- README.md | 93 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8fd0ca3..ba39d92 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,25 @@ Docker images to develop and run software based on the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their Python wrappers ([PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)). + + ## Description The `docker-libs` repository allows users to build and publish on a registry (e.g., DockerHub) Docker images containing the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their Python wrappers, [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl). All the images are based on the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) and the EDDL and ECVL libraries are configured to leverage NVIDIA GPUs. -Precompiled images are published on [DockerHub](https://hub.docker.com/u/dhealth). +Precompiled images are published on [DockerHub](https://hub.docker.com/u/dhealth). You can find an image for each DeepHealth library ( [EDDL](https://github.com/deephealthproject/eddl), [ECVL](https://github.com/deephealthproject/ecvl), [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)), available with also optional development tools (i.e., images named with the `-toolkit` suffix). Images are tagged accordingly with their revision on GitHub, identified by commit ID or TAG: e.g., `dhealth/ecvl:1512be8` and`dhealth/ecvl-toolkit:1512be8`, where `1512be8` is the ID of the last commit on the ECVL repository when the image was build. If that commit is also associated with a TAG, it will be used a Docker tag as well. -The available images are: +In addition, the following images are periodically released on [DockerHub](https://hub.docker.com/u/dhealth) to provide compatible versions of the libraries above: * **[`dhealth/libs`](https://hub.docker.com/r/dhealth/libs)** contains an installation of the EDDL and ECVL libraries * **[`dhealth/libs-toolkit`](https://hub.docker.com/r/dhealth/libs-toolkit)** contains an installation of the EDDL and ECVL libraries, the source code of two libraries and all the development tools (compilers, libraries, etc.) you need to compile them - * **[`dhealth/pylibs`](https://hub.docker.com/r/dhealth/pylibs)** extends the `libs` image with the PyEDDL and PyECVL libraries * **[`dhealth/pylibs-toolkit`](https://hub.docker.com/r/dhealth/pylibs-toolkit)** extends the `libs-toolkit` image with the PyEDDL and PyECVL libraries +A *dependency graph* of the images published on [DockerHub](https://hub.docker.com/u/dhealth) can be found [here](docs/img/graph-latest.png?raw=true "Dependency Graph"). + + + ## Example usage Open a shell in a container with access to the DeepHealth libraries: @@ -27,34 +32,78 @@ docker run -it --rm dhealth/libs /bin/bash Open a shell to compile your local project: ```bash -docker run -it -u $(id -u) -v $(pwd):/tests --rm dhealth/libs-toolkit:0.1.2 /bin/bash +docker run -it -u $(id -u) -v $(pwd):/tests --rm dhealth/libs-toolkit /bin/bash ``` -## How to build +## How to build, test and publish -A `Makefile` allows to easily compile and publish the Docker images. Type `make help` to see the available `Makefile` targets, i.e.: +A `Makefile` allows to easily compile, test and publish the Docker images. Type `make help` to see the available `Makefile` targets, i.e.: ```bash +version Output the current version of this Makefile help Show help -build Build and tag all Docker images -build_libs Build and tag 'libs' image -build_libs_toolkit Build and tag 'libs-toolkit' image -build_pylibs Build and tag 'pylibs' image -build_pylibs_toolkit Build and tag 'pylibs-toolkit' image -push Push all built images -push_libs Push 'libs' images -push_libs_toolkit Push 'libs-toolkit' images +dependency_graph make a dependency graph of the involved libraries +build Build all Docker images +build_eddl_toolkit Build 'eddl-toolkit' image +build_ecvl_toolkit Build 'ecvl-toolkit' image +build_libs_toolkit Build 'libs-toolkit' image +build_eddl Build 'eddl' image +build_ecvl Build 'ecvl' image +build_libs Build 'libs' image +build_pyeddl_toolkit Build 'pyeddl-toolkit' image +build_pyecvl_toolkit Build 'pyecvl-toolkit' image +build_pylibs_toolkit Build 'pylibs-toolkit' image +build_pyeddl Build 'pyeddl' image +build_pyecvl Build 'pyecvl' image +build_pylibs Build 'pylibs' image +test Test all docker images +test_eddl Test 'eddl' images +test_eddl_toolkit Test 'eddl' images +test_ecvl Test 'ecvl' images +test_ecvl_toolkit Test 'ecvl' images +test_pyeddl Test 'ecvl' images +test_pyeddl_toolkit Test 'ecvl' images +test_pyecvl Test 'ecvl' images +test_pyecvl_toolkit Test 'ecvl' images +push Push all images +push_libs Push 'libs' image +push_libs_base Push 'lib-base' image +push_eddl Push 'eddl' image +push_ecvl Push 'ecvl' image +push_libs_toolkit Push 'libs-toolkit' image +push_libs_base_toolkit Push 'libs-base-toolkit' image +push_eddl_toolkit Push 'eddl-toolkit' images +push_ecvl_toolkit Push 'ecvl-toolkit' images push_pylibs Push 'pylibs' images +push_pyeddl Push 'pyeddl' images +push_pyecvl Push 'pyecvl' images push_pylibs_toolkit Push 'pylibs-toolkit' images -publish Publish all built images to a Docker Registry (e.g., DockerHub) -publish_libs Publish 'libs' images -publish_libs_toolkit Publish 'libs-toolkit' images -publish_pylibs Publish 'pylibs' images -publish_pylibs_toolkit Publish 'pylibs-toolkit' images -repo-login Login to the Docker Registry -version Output the current version of this Makefile +push_pyeddl_toolkit Push 'pyeddl-toolkit' images +push_pyecvl_toolkit Push 'pyeddl-toolkit' images +publish Publish all images to a Docker Registry (e.g., DockerHub) +publish_libs Publish 'libs' image +publish_eddl Publish 'eddl' image +publish_ecvl Publish 'ecvl' image +publish_libs_toolkit Publish 'libs-toolkit' image +publish_eddl_toolkit Publish 'eddl-toolkit' image +publish_ecvl_toolkit Publish 'ecvl-toolkit' image +publish_pylibs Publish 'pylibs' image +publish_pyeddl Publish 'pyeddl' image +publish_pyecvl Publish 'pyecvl' image +publish_pylibs_toolkit Publish 'pylibs-toolkit' image +publish_pyeddl_toolkit Publish 'pyeddl-toolkit' image +publish_pyecvl_toolkit Publish 'pyecvl-toolkit' image +docker-login Login to the Docker Registry +clean_eddl_sources clean repository containing EDDL source code +clean_ecvl_sources clean repository containing ECVL source code +clean_pyeddl_sources clean repository containing PyEDDL source code +clean_pyecvl_sources clean repository containing PyECVL source code +clean_libs_sources clean repository containing libs source code +clean_pylibs_sources clean repository containing pylibs source code +clean_sources clean repository containing source code ``` -Edit the file `settings.sh` to customize your images (name, software revision, Docker registry, etc.) +Edit the file `settings.conf` to customize your images (e.g., software revision, Docker registry, etc.) + From 5a455f04de1d33235127a4a3748ea40de5589fe6 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 26 Feb 2020 12:40:39 +0100 Subject: [PATCH 132/200] Add licence file --- LICENCE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENCE diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..8feab66 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2020 CRS4 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 494c5903877e8381b5ae5595b6dce0652112a9e5 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 26 Feb 2020 12:55:19 +0100 Subject: [PATCH 133/200] Add last badges for release and licence --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index ba39d92..0925dba 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +![GitHub release (latest by date)](https://img.shields.io/github/v/release/deephealthproject/docker-libs)![GitHub](https://img.shields.io/github/license/deephealthproject/docker-libs) + + + # docker-libs Docker images to develop and run software based on the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their Python wrappers ([PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)). From 9373feadcddab839abaf2992005732a7b4700269 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 26 Feb 2020 16:25:10 +0100 Subject: [PATCH 134/200] Update docs --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0925dba..bf0014b 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,29 @@ Docker images to develop and run software based on the [EDDL](https://github.com ## Description -The `docker-libs` repository allows users to build and publish on a registry (e.g., DockerHub) Docker images containing the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their Python wrappers, [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl). All the images are based on the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) and the EDDL and ECVL libraries are configured to leverage NVIDIA GPUs. +The `docker-libs` repository allows users to build and publish on a registry (e.g., DockerHub) Docker images containing the DeepHealth libraries: [EDDL](https://github.com/deephealthproject/eddl), [ECVL](https://github.com/deephealthproject/ecvl) and their Python wrappers, [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl). All the images are based on the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) and the EDDL and ECVL libraries are configured to leverage NVIDIA GPUs. -Precompiled images are published on [DockerHub](https://hub.docker.com/u/dhealth). You can find an image for each DeepHealth library ( [EDDL](https://github.com/deephealthproject/eddl), [ECVL](https://github.com/deephealthproject/ecvl), [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)), available with also optional development tools (i.e., images named with the `-toolkit` suffix). Images are tagged accordingly with their revision on GitHub, identified by commit ID or TAG: e.g., `dhealth/ecvl:1512be8` and`dhealth/ecvl-toolkit:1512be8`, where `1512be8` is the ID of the last commit on the ECVL repository when the image was build. If that commit is also associated with a TAG, it will be used a Docker tag as well. +Precompiled images for each DeepHealth library are published on [DockerHub](https://hub.docker.com/u/dhealth): -In addition, the following images are periodically released on [DockerHub](https://hub.docker.com/u/dhealth) to provide compatible versions of the libraries above: +* **[`dhealth/eddl`](https://hub.docker.com/r/dhealth/eddl)** contains an installation of the EDDL library +* **[`dhealth/ecvl`](https://hub.docker.com/r/dhealth/ecvl)** contains an installation of the ECVL library with support for EDDL +* **[`dhealth/pyeddl`](https://hub.docker.com/r/dhealth/pyeddl)** contains an installation of the PyEDDL and EDDL library +* **[`dhealth/pyecvl`](https://hub.docker.com/r/dhealth/ecvl-toolkit)** contains an installation of the PyECVL library with support for PyEDDL + +They are available with the `-toolkit` variant, which provides optional development tools (sources, compilers, etc.). + +In addition, to provide, under a common Docker tag, library revisions compatible with each other, the following images are periodically released on [DockerHub](https://hub.docker.com/u/dhealth) (see GitHub **[releases](https://github.com/deephealthproject/docker-libs/releases)**): * **[`dhealth/libs`](https://hub.docker.com/r/dhealth/libs)** contains an installation of the EDDL and ECVL libraries * **[`dhealth/libs-toolkit`](https://hub.docker.com/r/dhealth/libs-toolkit)** contains an installation of the EDDL and ECVL libraries, the source code of two libraries and all the development tools (compilers, libraries, etc.) you need to compile them * **[`dhealth/pylibs`](https://hub.docker.com/r/dhealth/pylibs)** extends the `libs` image with the PyEDDL and PyECVL libraries * **[`dhealth/pylibs-toolkit`](https://hub.docker.com/r/dhealth/pylibs-toolkit)** extends the `libs-toolkit` image with the PyEDDL and PyECVL libraries -A *dependency graph* of the images published on [DockerHub](https://hub.docker.com/u/dhealth) can be found [here](docs/img/graph-latest.png?raw=true "Dependency Graph"). + + +##### Image TAGs + +All the images are tagged accordingly with the revision of the corresponding libraries on GitHub, identified by commit ID or TAG: e.g., `dhealth/ecvl:1512be8` and`dhealth/ecvl-toolkit:1512be8` are built on the `1512be8` revision (commit ID) of the ECVL library. If that revision is also associated with a Git TAG, it will be used as a Docker tag as well. From 75e2ebd31ea4f2ccec5f1cf5bbdac71621315ac1 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 26 Feb 2020 16:18:42 +0000 Subject: [PATCH 135/200] Fix repository detection --- Makefile | 1 - jenkins.sh | 15 +++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b5b43ec..d5cf967 100644 --- a/Makefile +++ b/Makefile @@ -304,7 +304,6 @@ help: ## Show help _reset_log_file: $(if $(RESET_LOG_FILE_DONE),echo "Already reset",\ - echo "Resetting";\ $(file >${IMAGES_LOG},)\ $(file >${LIBRARIES_LOG},)\ $(file >${DEPENDENCIES_LOG},)\ diff --git a/jenkins.sh b/jenkins.sh index cddcec6..9d42276 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -24,6 +24,8 @@ export DOCKER_REPOSITORY_OWNER="${DOCKER_REPOSITORY_OWNER:-dhealth}" DOCKER_USER=${DOCKER_USER:-} DOCKER_PASSWORD=${DOCKER_PASSWORD:-} +GIT_URL=${GIT_URL:-} + # set script version VERSION=0.2.0 @@ -145,12 +147,17 @@ function docker_login() { } function run() { + local REPOSITORY="" + local LIB_NAME="" # set repository - local REPOSITORY=$(if [[ -n "${GIT_URL}" ]]; then \ - echo "${GIT_URL}" | sed -E 's+(.*)/([^/]*)\.git+\2+' ; \ - else $(basename $(git rev-parse --show-toplevel)) ; fi) + if [[ -n "${GIT_URL}" ]]; then \ + REPOSITORY=$(echo "${GIT_URL}" | sed -E 's+(.*)/([^/]*)\.git+\2+') ; \ + else + REPOSITORY=$(basename $(git rev-parse --show-toplevel)) ; + fi # set library name - local LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-LIBS+LIBS+') + LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-LIBS+LIBS+') + # set git tag & branch & image prefix # and define whether to push lates tag GIT_BRANCH=${GIT_BRANCH:-$(git rev-parse --abbrev-ref HEAD | sed -E 's+(remotes/|origin/|tags/)++g; s+/+-+g; s/ .*//')} From 9f5a163dac7b071c5ba491e50e6bb2ffcbba4613 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Wed, 26 Feb 2020 17:10:28 +0000 Subject: [PATCH 136/200] Clean logs --- Makefile | 43 +++++++++++++++++++++++++------------------ jenkins.sh | 6 ++++-- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index d5cf967..7aca019 100644 --- a/Makefile +++ b/Makefile @@ -302,16 +302,6 @@ version: ## Output the current version of this Makefile help: ## Show help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) -_reset_log_file: - $(if $(RESET_LOG_FILE_DONE),echo "Already reset",\ - $(file >${IMAGES_LOG},)\ - $(file >${LIBRARIES_LOG},)\ - $(file >${DEPENDENCIES_LOG},)\ - ) - -reset_log_file: _reset_log_file - $(eval RESET_LOG_FILE_DONE := 1) - libraries_list: @sort -u ${LIBRARIES_LOG} @@ -335,7 +325,7 @@ dependency_graph: ## make a dependency graph of the involved libraries ############# Clone sources ############# ##################################################################################################################################### -libs_folder: reset_log_file +libs_folder: $(if $(wildcard ${LOCAL_LIBS_PATH}),, \ $(info Creating ${LOCAL_LIBS_PATH} folder...) ; \ @mkdir -p ${LOCAL_LIBS_PATH} ; \ @@ -357,14 +347,14 @@ define clone_ecvl ) endef -_ecvl_folder: libs_folder +_ecvl_folder: $(call clone_ecvl) ecvl_folder: _ecvl_folder $(call set_library_revision,libs,ecvl) \ $(call log_library_revision,ECVL) -pylibs_folder: reset_log_file +pylibs_folder: @mkdir -p ${LOCAL_PYLIBS_PATH} define pyeddl_shallow_clone @@ -851,7 +841,7 @@ clean_libs_sources: clean_eddl_sources clean_ecvl_sources ## clean repository co clean_pylibs_sources: clean_pyeddl_sources clean_pyecvl_sources ## clean repository containing pylibs source code -clean_sources: clean_pylibs_sources clean_libs_sources ## clean repository containing source code +clean_sources: clean_pylibs_sources clean_libs_sources _clean_libraries_logs ## clean repository containing source code ############################################################################################################################ @@ -890,17 +880,34 @@ clean_pylibs_images: clean_pyecvl_images clean_pyeddl_images clean_images: \ clean_pylibs_images clean_libs_images clean_base_images \ clean_ecvl_images clean_eddl_images \ - clean_pyecvl_images clean_pylibs_images + clean_pyecvl_images clean_pylibs_images \ + _clean_images_logs + +#################################################################### + +_clean_dependencies_logs: + $(file >${DEPENDENCIES_LOG},) + @echo "Logs of dependencies deleted" + +_clean_images_logs: _clean_dependencies_logs + $(file >${IMAGES_LOG},) + @echo "Logs of images deleted" + +_clean_libraries_logs: _clean_dependencies_logs + $(file >${LIBRARIES_LOG},) + @echo "Logs of libraries deleted" + +clean_logs: _clean_images_logs _clean_libraries_logs ## clean logs ############################################################################################################################ ### Clean Sources and Docker images ############################################################################################################################ -clean: clean_images clean_sources reset_log_file - +clean: clean_images clean_sources clean_logs -.PHONY: help _reset_log_file reset_log_file \ +.PHONY: help \ + clean_logs _clean_dependencies_logs _clean_libraries_logs _clean_images_logs \ libraries_list images_list dependencies_list dependency_graph \ libs_folder eddl_folder ecvl_folder pylibs_folder \ pyeddl_folder _pyeddl_shallow_clone _pyecvl_second_level_dependencies \ diff --git a/jenkins.sh b/jenkins.sh index 9d42276..b7db3dc 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -247,11 +247,13 @@ function run() { fi # print images - log "List of Docker images..." + log "\n\nList of Docker images..." + log "*************************************************************************************************************" make images_list # print libraries - log "List of Libraries..." + log "\n\nList of Libraries..." + log "*************************************************************************************************************" make libraries_list } From 497d53805a91fd5578d64f1f5da798317a389d80 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 10:28:50 +0000 Subject: [PATCH 137/200] Compile and install eigen and protobuf from sources --- libs/libs-base-toolkit.Dockerfile | 47 +++++++++++++++++++++++++------ libs/libs-base.Dockerfile | 13 +++++---- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 01e7eac..daeaf34 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -14,6 +14,17 @@ ARG opencv_release="3.4.6" ENV OPENCV_RELEASE ${opencv_release} ENV OPENCV_INSTALL_MANIFEST "/usr/local/opencv/install_manifest.txt" +# set Eigen version +ARG eigen_release="3.3.7" +ENV EIGEN_RELEASE ${eigen_release} +ENV EIGEN_INSTALL_MANIFEST "/usr/local/eigen/install_manifest.txt" +ENV CPATH="/usr/include/eigen3:${CPATH}" + +# set ProtoBuf version +ARG protobuf_release="3.11.4" +ENV PROTOBUF_RELEASE ${protobuf_release} +ENV PROTOBUF_INSTALL_MANIFEST "/usr/local/protobuf/install_manifest.txt" + # Install software requirements RUN \ echo "\nInstalling software requirements..." >&2 \ @@ -21,7 +32,7 @@ RUN \ && apt-get update -y -q \ && apt-get install -y --no-install-recommends \ build-essential git gcc-8 g++-8 wget rsync graphviz \ - libwxgtk3.0-dev libopenslide-dev \ + libwxgtk3.0-dev libopenslide-dev zlib1g-dev libblas-dev \ libavcodec-dev libavformat-dev libswscale-dev \ libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 \ @@ -57,10 +68,30 @@ RUN \ && make install \ && mkdir -p $(dirname ${OPENCV_INSTALL_MANIFEST}) \ && cp $(basename ${OPENCV_INSTALL_MANIFEST}) $(dirname ${OPENCV_INSTALL_MANIFEST})/ \ - && rm -rf /tmp/opencv-${opencv_release} - - -# && cmake -D CMAKE_BUILD_TYPE=RELEASE \ -# -D INSTALL_C_EXAMPLES=ON \ -# -D OPENCV_GENERATE_PKGCONFIG=ON \ -# -D BUILD_EXAMPLES=ON .. \ \ No newline at end of file + && rm -rf /tmp/opencv-${opencv_release} \ + # Eigen version installed by APT is too old to work properly with CUDA + # https://devtalk.nvidia.com/default/topic/1026622/nvcc-can-t-compile-code-that-uses-eigen/ + && echo "\n > Installing Eigen (version '${eigen_release}')..." >&2 \ + && cd /tmp \ + && wget --quiet https://gitlab.com/libeigen/eigen/-/archive/${eigen_release}/eigen-${eigen_release}.tar.gz \ + && tar xzf eigen-${eigen_release}.tar.gz \ + && rm eigen-${eigen_release}.tar.gz \ + && cd eigen-${eigen_release} \ + && mkdir build \ + && cd build \ + && cmake .. \ + && make install \ + && mkdir -p $(dirname ${EIGEN_INSTALL_MANIFEST}) \ + && cp $(basename ${EIGEN_INSTALL_MANIFEST}) $(dirname ${EIGEN_INSTALL_MANIFEST})/ \ + && rm -rf /tmp/eigen-${eigen_release} \ + && echo "\n > Installing ProtoBuf (version '${protobuf_release}')..." >&2 \ + && cd /tmp \ + && wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_release}/protobuf-all-${protobuf_release}.tar.gz \ + && tar xf protobuf-all-${protobuf_release}.tar.gz \ + && rm protobuf-all-${protobuf_release}.tar.gz \ + && cd protobuf-${protobuf_release}/ \ + && ./configure \ + && make -j$(nproc) \ + && make install \ + && ldconfig \ + && rm -rf /tmp/protobuf-${protobuf_release} diff --git a/libs/libs-base.Dockerfile b/libs/libs-base.Dockerfile index 9f9d0b2..189822c 100644 --- a/libs/libs-base.Dockerfile +++ b/libs/libs-base.Dockerfile @@ -20,12 +20,13 @@ COPY --from=toolkit /usr/local/etc /tmp/local/etc COPY --from=toolkit /usr/local/include /tmp/local/include COPY --from=toolkit /usr/local/lib /tmp/local/lib COPY --from=toolkit /usr/local/share /tmp/local/share -COPY --from=toolkit /usr/local/opencv/install_manifest.txt /tmp/local/install_manifest.txt +COPY --from=toolkit /usr/local/opencv/install_manifest.txt /tmp/local/opencv_manifest.txt +COPY --from=toolkit /usr/local/eigen/install_manifest.txt /tmp/local/eigen_manifest.txt # merge existing system directories with those containing libraries -RUN cd /tmp/local && sed -e 's+/usr/local/++g' install_manifest.txt | \ - while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done - +RUN cd /tmp/local && sed -e 's+/usr/local/++g' *_manifest.txt | \ + while IFS= read -r line; do echo ">>> $line" ; rsync --relative "${line}" "/usr/local/" || exit ; done \ + && find /tmp/local/lib -not -type d -execdir cp "{}" /usr/local/lib ";" #################### #### BASE image #### @@ -36,6 +37,7 @@ LABEL website="https://github.com/deephealthproject" LABEL description="DeepHealth European Distributed Deep Learning Library" LABEL software="deephealth-eddl,deephealth-ecvl" +# Install software requirements RUN \ echo "\nInstalling software requirements..." >&2 \ && export DEBIAN_FRONTEND=noninteractive \ @@ -47,7 +49,8 @@ RUN \ libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \ libopenslide-dev \ libgomp1 \ - && apt-get clean + && apt-get clean \ + && ldconfig # copy libraries to the target paths COPY --from=prepare_install /usr/local/etc /usr/local/etc From 9788980eb1043dd4d2de1592caeee48d28256502 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 10:29:16 +0000 Subject: [PATCH 138/200] Enable protobuf --- libs/eddl-toolkit.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/eddl-toolkit.Dockerfile b/libs/eddl-toolkit.Dockerfile index 5421285..1a20a2f 100644 --- a/libs/eddl-toolkit.Dockerfile +++ b/libs/eddl-toolkit.Dockerfile @@ -25,6 +25,7 @@ RUN echo "\nBuilding EDDL library..." >&2 \ -D BUILD_TARGET=GPU \ -D BUILD_TESTS=ON \ -D EDDL_SHARED=ON \ + -D BUILD_PROTOBUF=ON \ .. \ && make -j$(grep -c ^processor /proc/cpuinfo) \ && echo "\n Installing EDDL library..." >&2 \ From 3b02c4f85c22b09f7ad6c5fcfce2beba7f0ff296 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 10:29:53 +0000 Subject: [PATCH 139/200] Update EDDL and PyEDDL revisions --- settings.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/settings.conf b/settings.conf index 67b4aac..548e3d1 100644 --- a/settings.conf +++ b/settings.conf @@ -1,7 +1,7 @@ # DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 +DOCKER_BASE_IMAGE_VERSION_TAG=0.2.1 DOCKER_LOGIN_DONE=true @@ -35,12 +35,12 @@ PYECVL_REVISION=0.1.0 # EDDL repository EDDL_REPOSITORY=https://github.com/deephealthproject/eddl.git EDDL_BRANCH=master -EDDL_REVISION=v0.3.1 +EDDL_REVISION=v0.4.2 # PyEDDL repository PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git PYEDDL_BRANCH=master -PYEDDL_REVISION=0.3.0 +PYEDDL_REVISION=0.4.0 # date.time as build number #DOCKER_IMAGE_TAG=0.1.2 From 93062963f644d808f0b19f78591bcb656c84d103 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 11:09:32 +0000 Subject: [PATCH 140/200] Fix CMake CMP0072 warning --- libs/libs-base-toolkit.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index daeaf34..d2f3864 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -79,7 +79,7 @@ RUN \ && cd eigen-${eigen_release} \ && mkdir build \ && cd build \ - && cmake .. \ + && cmake -D OpenGL_GL_PREFERENCE=GLVND .. \ && make install \ && mkdir -p $(dirname ${EIGEN_INSTALL_MANIFEST}) \ && cp $(basename ${EIGEN_INSTALL_MANIFEST}) $(dirname ${EIGEN_INSTALL_MANIFEST})/ \ From defdd31fb1916c4aac37064a616b2c57d5f5f041 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 15:06:29 +0000 Subject: [PATCH 141/200] Fix CPATH --- libs/libs-base-toolkit.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index d2f3864..77a2250 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -18,7 +18,7 @@ ENV OPENCV_INSTALL_MANIFEST "/usr/local/opencv/install_manifest.txt" ARG eigen_release="3.3.7" ENV EIGEN_RELEASE ${eigen_release} ENV EIGEN_INSTALL_MANIFEST "/usr/local/eigen/install_manifest.txt" -ENV CPATH="/usr/include/eigen3:${CPATH}" +ENV CPATH="/usr/local/include/eigen3:${CPATH}" # set ProtoBuf version ARG protobuf_release="3.11.4" From bfbdff42b9679669f5a12aa5c29d9c276992ade0 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 15:07:42 +0000 Subject: [PATCH 142/200] Update flag to build EDDL shared lib --- libs/eddl-toolkit.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/eddl-toolkit.Dockerfile b/libs/eddl-toolkit.Dockerfile index 1a20a2f..4613494 100644 --- a/libs/eddl-toolkit.Dockerfile +++ b/libs/eddl-toolkit.Dockerfile @@ -24,7 +24,7 @@ RUN echo "\nBuilding EDDL library..." >&2 \ && cmake \ -D BUILD_TARGET=GPU \ -D BUILD_TESTS=ON \ - -D EDDL_SHARED=ON \ + -D BUILD_SHARED_LIB=ON \ -D BUILD_PROTOBUF=ON \ .. \ && make -j$(grep -c ^processor /proc/cpuinfo) \ From 73e6531c8ecbb3aa262350f6d8352e7b2eee0bd6 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 15:09:45 +0000 Subject: [PATCH 143/200] Add missing ENV to enable support for CUDA --- pylibs/pyeddl-toolkit.Dockerfile | 3 +++ pylibs/pyeddl.Dockerfile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pylibs/pyeddl-toolkit.Dockerfile b/pylibs/pyeddl-toolkit.Dockerfile index 28b9b8f..cb4a025 100644 --- a/pylibs/pyeddl-toolkit.Dockerfile +++ b/pylibs/pyeddl-toolkit.Dockerfile @@ -13,6 +13,9 @@ ARG eddl_src="/usr/local/src/eddl" ARG pyeddl_src_origin="pyeddl" ARG pyeddl_src_target="/usr/local/src/pyeddl" +# enable CUDA support +ENV EDDL_WITH_CUDA 'true' + # Run git submodule update [--init] --recursive first COPY ${pyeddl_src_origin} ${pyeddl_src_target} diff --git a/pylibs/pyeddl.Dockerfile b/pylibs/pyeddl.Dockerfile index 45f5d05..a1b62bb 100644 --- a/pylibs/pyeddl.Dockerfile +++ b/pylibs/pyeddl.Dockerfile @@ -21,6 +21,9 @@ LABEL website="https://github.com/deephealthproject/" LABEL description="DeepHealth European Distributed Deep Learning Library" LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" +# enable CUDA support +ENV EDDL_WITH_CUDA 'true' + # Run git submodule update [--init] --recursive first COPY --from=intermediate_stage /intermediate_path/bin/* /usr/local/bin/ COPY --from=intermediate_stage /intermediate_path/lib/python3.6/dist-packages/* /usr/local/lib/python3.6/dist-packages/ From 5edd70730f770ec8e0be843529417653af807617 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 15:12:49 +0000 Subject: [PATCH 144/200] Unset REPO_OWNER and IMAGE_PREFIX from settings --- settings.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.conf b/settings.conf index 548e3d1..529de89 100644 --- a/settings.conf +++ b/settings.conf @@ -13,8 +13,8 @@ DOCKER_LOGIN_DONE=true #DOCKER_REGISTRY=registry.hub.docker.com # set Docker repository -DOCKER_REPOSITORY_OWNER=dhealth -DOCKER_IMAGE_PREFIX= +#DOCKER_REPOSITORY_OWNER=dhealth +#DOCKER_IMAGE_PREFIX= # latest tag settings #DOCKER_IMAGE_LATEST=false From 2e739d9e468c161bf3163355bc449de3c2810669 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 15:13:29 +0000 Subject: [PATCH 145/200] Remove white-space --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7aca019..0b41e5e 100644 --- a/Makefile +++ b/Makefile @@ -165,8 +165,8 @@ define build_image $(eval tagged_image := ${image_name}:${tag}) $(eval images := $(shell docker images -q ${tagged_image})) $(eval exists := $(shell curl --silent -f -lSL https://index.docker.io/v1/repositories/${full_image_name}/tags/${tag} 2>/dev/null)) + @printf "\n\n" ; \ $(if $(or $(findstring ${_DO_NOT_USE_DOCKER_CACHE},1),$(findstring ${_DO_NOT_PULL_DOCKER_IMAGES},1)),\ - @echo "Not using ${_DO_NOT_USE_DOCKER_CACHE} ${_DO_NOT_PULL_DOCKER_IMAGES}"; \ $(call build_new_image), $(if ${images},\ @echo "Docker image '${tagged_image}' exists (id: ${images})", \ @@ -226,7 +226,7 @@ define clean_sources $(eval path := $(1)) @printf "Removing sources '$(path)'... " @rm -rf $(path) - @printf "DONE\n" + @printf "DONE\n" endef From c218676c90cb73a23181e60f306363e16a14a010 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 16:08:51 +0000 Subject: [PATCH 146/200] Link cudart, cublas and curand in standard system locations --- pylibs/pyeddl-toolkit.Dockerfile | 5 +++++ pylibs/pyeddl.Dockerfile | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pylibs/pyeddl-toolkit.Dockerfile b/pylibs/pyeddl-toolkit.Dockerfile index cb4a025..4123fa2 100644 --- a/pylibs/pyeddl-toolkit.Dockerfile +++ b/pylibs/pyeddl-toolkit.Dockerfile @@ -16,6 +16,11 @@ ARG pyeddl_src_target="/usr/local/src/pyeddl" # enable CUDA support ENV EDDL_WITH_CUDA 'true' +# link the cudart, cublas and curand libraries on "standard" system locations +RUN ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ + # Run git submodule update [--init] --recursive first COPY ${pyeddl_src_origin} ${pyeddl_src_target} diff --git a/pylibs/pyeddl.Dockerfile b/pylibs/pyeddl.Dockerfile index a1b62bb..883dc14 100644 --- a/pylibs/pyeddl.Dockerfile +++ b/pylibs/pyeddl.Dockerfile @@ -24,6 +24,11 @@ LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" # enable CUDA support ENV EDDL_WITH_CUDA 'true' +# link the cudart, cublas and curand libraries on "standard" system locations +RUN ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ + # Run git submodule update [--init] --recursive first COPY --from=intermediate_stage /intermediate_path/bin/* /usr/local/bin/ COPY --from=intermediate_stage /intermediate_path/lib/python3.6/dist-packages/* /usr/local/lib/python3.6/dist-packages/ From 98e106560dbb7fb40f0fd279a569c8c5d1b8d17b Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 20:26:47 +0000 Subject: [PATCH 147/200] Allow user to specify CL options to run Docker --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0b41e5e..404323c 100644 --- a/Makefile +++ b/Makefile @@ -137,8 +137,8 @@ DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) # Arguments to execute tests with Docker DOCKER_RUN := docker run -i --rm #-u 1000:1000 -ifeq (${GPU}, true) - DOCKER_RUN := ${DOCKER_RUN} --gpus 1 +ifneq (${DOCKER_OPTS},) + DOCKER_RUN := ${DOCKER_RUN} ${DOCKER_OPTS} endif define build_new_image From 784ab5dfb47831dc85c14c4a0d3375bb519beb76 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 27 Feb 2020 22:23:10 +0000 Subject: [PATCH 148/200] Update PyEDDL tests for GPU --- tests/test_pyeddl.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 514b072..fe5799d 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -7,5 +7,10 @@ PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} cd ${PYEDDL_SRC} && pytest tests # run examples -cd ${PYEDDL_SRC}/examples && python3 Tensor/eddl_tensor.py -cd ${PYEDDL_SRC}/examples && python3 NN/other/eddl_ae.py --epochs 1 +if [[ $(docker run --gpus 1 nvidia/cuda:10.0-base nvidia-smi) ]]; then + cd ${PYEDDL_SRC}/examples + python3 Tensor/eddl_tensor.py + bash examples/NN/1_MNIST/run_all_fast.sh + bash examples/NN/py_loss_metric/run_all_fast.sh + bash examples/onnx/run_all_fast.sh +fi \ No newline at end of file From c10d852789d8f0d90c35df3e39f20b39fe4bf3d8 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 11:05:00 +0000 Subject: [PATCH 149/200] Update tests for PyEDDL --- tests/test_pyeddl.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index fe5799d..91b5480 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -7,9 +7,26 @@ PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} cd ${PYEDDL_SRC} && pytest tests # run examples -if [[ $(docker run --gpus 1 nvidia/cuda:10.0-base nvidia-smi) ]]; then - cd ${PYEDDL_SRC}/examples - python3 Tensor/eddl_tensor.py +gpus=$(docker run --runtime=nvidia nvidia/cuda:10.0-base nvidia-smi -L 2>&-) + +cd ${PYEDDL_SRC}/examples +if [[ -z ${gpus} ]]; then + log 'INFO: No GPU available. Running tests with no GPU....' + log 'Downloading test dataset' + wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin + wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin + wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin + wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin + log 'Running tests....' + pytest tests + log 'Running examples....' + python3 examples/Tensor/array_tensor_save.py + python3 examples/NN/1_MNIST/mnist_auto_encoder.py --epochs 1 +else + log "Available GPUs: \n ${gpus}" + log "Running tests..." + python3 examples/Tensor/array_tensor_save.py + log 'Running examples....' bash examples/NN/1_MNIST/run_all_fast.sh bash examples/NN/py_loss_metric/run_all_fast.sh bash examples/onnx/run_all_fast.sh From dad09e82159c2e077d5ca1ca0d17f686315bfaaa Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 11:15:05 +0000 Subject: [PATCH 150/200] Fix paths --- tests/test_pyeddl.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 91b5480..6199521 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -10,7 +10,7 @@ cd ${PYEDDL_SRC} && pytest tests gpus=$(docker run --runtime=nvidia nvidia/cuda:10.0-base nvidia-smi -L 2>&-) cd ${PYEDDL_SRC}/examples -if [[ -z ${gpus} ]]; then +if [ -z ${gpus} ]; then log 'INFO: No GPU available. Running tests with no GPU....' log 'Downloading test dataset' wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin @@ -20,14 +20,14 @@ if [[ -z ${gpus} ]]; then log 'Running tests....' pytest tests log 'Running examples....' - python3 examples/Tensor/array_tensor_save.py - python3 examples/NN/1_MNIST/mnist_auto_encoder.py --epochs 1 + python3 Tensor/array_tensor_save.py + python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 else log "Available GPUs: \n ${gpus}" log "Running tests..." - python3 examples/Tensor/array_tensor_save.py + python3 Tensor/array_tensor_save.py log 'Running examples....' - bash examples/NN/1_MNIST/run_all_fast.sh - bash examples/NN/py_loss_metric/run_all_fast.sh - bash examples/onnx/run_all_fast.sh + bash NN/1_MNIST/run_all_fast.sh + bash NN/py_loss_metric/run_all_fast.sh + bash onnx/run_all_fast.sh fi \ No newline at end of file From 829c647f9a11787b374481d20b33c7c0d5c02265 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 11:18:39 +0000 Subject: [PATCH 151/200] Fix missing log function --- tests/test_pyeddl.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 6199521..c005d2b 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -11,22 +11,22 @@ gpus=$(docker run --runtime=nvidia nvidia/cuda:10.0-base nvidia-smi -L 2>&-) cd ${PYEDDL_SRC}/examples if [ -z ${gpus} ]; then - log 'INFO: No GPU available. Running tests with no GPU....' - log 'Downloading test dataset' + echo 'INFO: No GPU available. Running tests with no GPU....' + echo 'Downloading test dataset' wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin - log 'Running tests....' + echo 'Running tests....' pytest tests - log 'Running examples....' + echo 'Running examples....' python3 Tensor/array_tensor_save.py python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 else - log "Available GPUs: \n ${gpus}" - log "Running tests..." + echo "Available GPUs: \n ${gpus}" + echo "Running tests..." python3 Tensor/array_tensor_save.py - log 'Running examples....' + echo 'Running examples....' bash NN/1_MNIST/run_all_fast.sh bash NN/py_loss_metric/run_all_fast.sh bash onnx/run_all_fast.sh From 21c9b552d16cce921caa991d129c961f868ca5f4 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 11:28:19 +0000 Subject: [PATCH 152/200] Fix indentation --- tests/test_pyeddl.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index c005d2b..72487dd 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -14,14 +14,14 @@ if [ -z ${gpus} ]; then echo 'INFO: No GPU available. Running tests with no GPU....' echo 'Downloading test dataset' wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin - wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin - wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin - wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin - echo 'Running tests....' + wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin + wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin + wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin + echo 'Running tests....' pytest tests echo 'Running examples....' - python3 Tensor/array_tensor_save.py - python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 + python3 Tensor/array_tensor_save.py + python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 else echo "Available GPUs: \n ${gpus}" echo "Running tests..." From b7ae86cbaadba79f18bef4e0d362fd197b445067 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 11:33:01 +0000 Subject: [PATCH 153/200] Use bash for testing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 404323c..a9bf5ea 100644 --- a/Makefile +++ b/Makefile @@ -657,7 +657,7 @@ define test_image printf "DONE" >&2 ; \ done ; \ printf "\n\n" ; \ - cat ${test_script} | ${DOCKER_RUN} $${volumes} ${image} /bin/sh ; \ + cat ${test_script} | ${DOCKER_RUN} $${volumes} ${image} /bin/bash ; \ exit_code=$$? ; \ for cname in $${cnames}; do \ printf "\nRemoving temp container instance '$${cname}'... " >&2; \ From 3258ad29305a61d14a814d48f34502ded6c09f0b Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 14:17:28 +0000 Subject: [PATCH 154/200] Fix GPU check --- tests/test_pyeddl.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 72487dd..9d821d8 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -6,11 +6,13 @@ PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} # run tests cd ${PYEDDL_SRC} && pytest tests -# run examples -gpus=$(docker run --runtime=nvidia nvidia/cuda:10.0-base nvidia-smi -L 2>&-) +# check GPU availability +gpu_check=".gpus_check" +docker run --runtime=nvidia nvidia/cuda:10.0-base nvidia-smi -L > ${gpu_check} 2>&- +# run examples cd ${PYEDDL_SRC}/examples -if [ -z ${gpus} ]; then +if [ -s ${gpu_check} ]; then echo 'INFO: No GPU available. Running tests with no GPU....' echo 'Downloading test dataset' wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin From 9ec8cd44447e1759066e4688315351973199a923 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 14:55:15 +0000 Subject: [PATCH 155/200] Search for images before testing --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a9bf5ea..74d38ed 100644 --- a/Makefile +++ b/Makefile @@ -638,6 +638,16 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image ############################################################################################################################ ### Tests ############################################################################################################################ +define check_image + printf "\nSearching image $(1)... " ; \ + images=$(docker images -q ${1}) ; \ + if [ -z "$${images}" ]; then \ + docker pull ${DOCKER_REPOSITORY_OWNER}/${1}; \ + docker tag ${DOCKER_REPOSITORY_OWNER}/${1} ${1}; \ + fi ; \ + printf "\n" +endef + define test_image $(eval image := $(1)) $(eval test_script := $(2)) @@ -653,10 +663,12 @@ define test_image cnames="$${cnames} $${cname}" ; \ volumes="$${volumes} --volumes-from $${cname}" ; \ printf "\nCreating temp container instance of '$${xcpath[0]}' (name: $${cname})... " >&2; \ + $(call check_image,$${xcpath[0]}) ; \ docker create --name $${cname} -v "$${xcpath[1]}" $${xcpath[0]} > /dev/null ; \ - printf "DONE" >&2 ; \ + printf "DONE\n" >&2 ; \ done ; \ printf "\n\n" ; \ + $(call check_image,${image}) ; \ cat ${test_script} | ${DOCKER_RUN} $${volumes} ${image} /bin/bash ; \ exit_code=$$? ; \ for cname in $${cnames}; do \ From 0c177f9a5d2107ad1e1db5d4b45f1a4404177e17 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 15:13:52 +0000 Subject: [PATCH 156/200] Use GPU_RUNTIME to enable testing on GPUs --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 74d38ed..5a0a34e 100644 --- a/Makefile +++ b/Makefile @@ -137,8 +137,8 @@ DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) # Arguments to execute tests with Docker DOCKER_RUN := docker run -i --rm #-u 1000:1000 -ifneq (${DOCKER_OPTS},) - DOCKER_RUN := ${DOCKER_RUN} ${DOCKER_OPTS} +ifneq (${GPU_RUNTIME},) + DOCKER_RUN := ${DOCKER_RUN} ${GPU_RUNTIME} endif define build_new_image @@ -669,7 +669,7 @@ define test_image done ; \ printf "\n\n" ; \ $(call check_image,${image}) ; \ - cat ${test_script} | ${DOCKER_RUN} $${volumes} ${image} /bin/bash ; \ + cat ${test_script} | ${DOCKER_RUN} -e GPU_RUNTIME=${GPU_RUNTIME} $${volumes} ${image} /bin/bash ; \ exit_code=$$? ; \ for cname in $${cnames}; do \ printf "\nRemoving temp container instance '$${cname}'... " >&2; \ From fdba65dc737cc1a828ebe909f04bb219b99d1cfc Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 15:14:52 +0000 Subject: [PATCH 157/200] Use GPU_RUNTIME as flag to choose testing set --- tests/test_pyeddl.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 9d821d8..217cb32 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -6,27 +6,21 @@ PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} # run tests cd ${PYEDDL_SRC} && pytest tests -# check GPU availability -gpu_check=".gpus_check" -docker run --runtime=nvidia nvidia/cuda:10.0-base nvidia-smi -L > ${gpu_check} 2>&- - # run examples cd ${PYEDDL_SRC}/examples -if [ -s ${gpu_check} ]; then - echo 'INFO: No GPU available. Running tests with no GPU....' +if [ -z "${GPU_RUNTIME}" ]; then echo 'Downloading test dataset' wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin - echo 'Running tests....' + echo 'Running tests for CPUs....' pytest tests echo 'Running examples....' python3 Tensor/array_tensor_save.py python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 else - echo "Available GPUs: \n ${gpus}" - echo "Running tests..." + echo "Running tests for GPUs..." python3 Tensor/array_tensor_save.py echo 'Running examples....' bash NN/1_MNIST/run_all_fast.sh From 5d7057ebfdd165838eb6d1b74153db7d8b4bfea5 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 15:38:56 +0000 Subject: [PATCH 158/200] Fix missing quotes --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5a0a34e..5b640ae 100644 --- a/Makefile +++ b/Makefile @@ -669,7 +669,7 @@ define test_image done ; \ printf "\n\n" ; \ $(call check_image,${image}) ; \ - cat ${test_script} | ${DOCKER_RUN} -e GPU_RUNTIME=${GPU_RUNTIME} $${volumes} ${image} /bin/bash ; \ + cat ${test_script} | ${DOCKER_RUN} -e GPU_RUNTIME="${GPU_RUNTIME}" $${volumes} ${image} /bin/bash ; \ exit_code=$$? ; \ for cname in $${cnames}; do \ printf "\nRemoving temp container instance '$${cname}'... " >&2; \ From e01908ac54b10245104c7fbab9ec68c978b52bdc Mon Sep 17 00:00:00 2001 From: kikkomep Date: Fri, 28 Feb 2020 16:48:24 +0000 Subject: [PATCH 159/200] Set exit on error flag --- tests/test_ecvl.sh | 3 +++ tests/test_eddl.sh | 3 +++ tests/test_pyecvl.sh | 3 +++ tests/test_pyeddl.sh | 3 +++ 4 files changed, 12 insertions(+) diff --git a/tests/test_ecvl.sh b/tests/test_ecvl.sh index 51c152e..15b1183 100644 --- a/tests/test_ecvl.sh +++ b/tests/test_ecvl.sh @@ -1,5 +1,8 @@ #!/bin/bash +# exit on error +set -e + # set the path containing tests ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} diff --git a/tests/test_eddl.sh b/tests/test_eddl.sh index cb7c6cb..4be61f2 100644 --- a/tests/test_eddl.sh +++ b/tests/test_eddl.sh @@ -1,5 +1,8 @@ #!/bin/bash +# exit on error +set -e + # set the path containing sources and tests EDDL_SRC=${EDDL_SRC:-"/usr/local/src/eddl"} diff --git a/tests/test_pyecvl.sh b/tests/test_pyecvl.sh index 72f003f..fe448c1 100644 --- a/tests/test_pyecvl.sh +++ b/tests/test_pyecvl.sh @@ -1,5 +1,8 @@ #!/bin/bash +# exit on error +set -e + # set the path containing sources and tests ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} PYECVL_SRC=${PYECVL_SRC:-"/usr/local/src/pyecvl"} diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 217cb32..b2cfb01 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -1,5 +1,8 @@ #!/bin/bash +# exit on error +set -e + # set the path containing sources and tests PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} From a58396ea9527a485ea091e38cf47b4f1806cc084 Mon Sep 17 00:00:00 2001 From: kikkomep Date: Tue, 3 Mar 2020 08:42:40 +0000 Subject: [PATCH 160/200] Update tag of pylibs-base image --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5b640ae..7edcb04 100644 --- a/Makefile +++ b/Makefile @@ -528,8 +528,9 @@ build_libs: build_ecvl ## Build 'libs' image ############# pylibs-toolkit ############# -_build_pylibs_base_toolkit: build_ecvl_toolkit - $(call build_image,pylibs,pylibs-base-toolkit,${ECVL_IMAGE_VERSION_TAG},\ +_build_pylibs_base_toolkit: build_ecvl_toolkit + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) + $(call build_image,pylibs,pylibs-base-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image @@ -543,7 +544,7 @@ build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patc --label ECVL_REVISION=${ECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(PYLIBS_BASE_IMAGE_VERSION_TAG)) $(call log_image_revision,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},install,PYEDDL) build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image From 770b89eba6cc4ac663325d9f1475de7258e22f74 Mon Sep 17 00:00:00 2001 From: Luca Pireddu Date: Tue, 3 Mar 2020 13:12:56 +0100 Subject: [PATCH 161/200] Add TL;DR section to docs --- README.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bf0014b..e2a9862 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,45 @@ ![GitHub release (latest by date)](https://img.shields.io/github/v/release/deephealthproject/docker-libs)![GitHub](https://img.shields.io/github/license/deephealthproject/docker-libs) - # docker-libs -Docker images to develop and run software based on the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their Python wrappers ([PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)). +Docker images to develop and run software based on the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their respective Python interfaces ([PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)). + +# TL;DR + +* Every library has a corresponding image repository: + - `dhealth/eddl` + - `dhealth/ecvl` + - `dhealth/pyeddl` + - `dhealth/pyecvl` + +* Every tag and commit id you see in the git repository has a corresponding image tag + - e.g., PyECVL [version 0.1.0](https://github.com/deephealthproject/pyecvl/tree/0.1.0) corresponds to the image tag [dhealth/pyecvl:0.1.0](https://hub.docker.com/layers/dhealth/pyecvl/0.1.0/) + - e.g., PyECVL at [commit id 23a79c5](https://github.com/deephealthproject/pyecvl/tree/23a79c5b6ba39a5049901933edff2ca372713df7) corresponds to the image tag [dhealth/pyecvl:23a79c5](https://hub.docker.com/layers/dhealth/pyecvl/23a79c5/images/sha256-bea02aa37dbb4f0f987b56d5c33d319e4018c809b562bca09bd1df0b4c755425?context=explore) (use the first 7 characters of the commit id) + +## Dependencies + +When you use the DeepHealth image for a library, the image also contains the libraries on which it depends: +* PyECVL -> also contains PyEDDL, EDDL, ECVL +* PyEDDL -> also contains EDDL +* ECVL -> also contains EDDL +* EDDL -> on its own + +If you want everything, use the PyECVL image. + +## Toolkit + +For all images, a toolkit version is also built that contains build requirements for software (compiler, headers, etc.). You can use these to build your own software or rebuild the DeepHealth libraries from source. + +The toolkit images have the same name with an appended `-toolkit`: +* `dhealth/eddl-toolkit` +* `dhealth/ecvl-toolkit` +* `dhealth/pyeddl-toolkit` +* `dhealth/pyecvl-toolkit` -## Description +# Description The `docker-libs` repository allows users to build and publish on a registry (e.g., DockerHub) Docker images containing the DeepHealth libraries: [EDDL](https://github.com/deephealthproject/eddl), [ECVL](https://github.com/deephealthproject/ecvl) and their Python wrappers, [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl). All the images are based on the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) and the EDDL and ECVL libraries are configured to leverage NVIDIA GPUs. From d5703c1a3dd43f3007d82285c8f753fd63378818 Mon Sep 17 00:00:00 2001 From: Luca Pireddu Date: Tue, 3 Mar 2020 13:14:10 +0100 Subject: [PATCH 162/200] Fix heading levels --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e2a9862..88cb2f2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Docker images to develop and run software based on the [EDDL](https://github.com/deephealthproject/eddl) and [ECVL](https://github.com/deephealthproject/ecvl) libraries and their respective Python interfaces ([PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl)). -# TL;DR +## TL;DR * Every library has a corresponding image repository: - `dhealth/eddl` @@ -17,7 +17,7 @@ Docker images to develop and run software based on the [EDDL](https://github.com - e.g., PyECVL [version 0.1.0](https://github.com/deephealthproject/pyecvl/tree/0.1.0) corresponds to the image tag [dhealth/pyecvl:0.1.0](https://hub.docker.com/layers/dhealth/pyecvl/0.1.0/) - e.g., PyECVL at [commit id 23a79c5](https://github.com/deephealthproject/pyecvl/tree/23a79c5b6ba39a5049901933edff2ca372713df7) corresponds to the image tag [dhealth/pyecvl:23a79c5](https://hub.docker.com/layers/dhealth/pyecvl/23a79c5/images/sha256-bea02aa37dbb4f0f987b56d5c33d319e4018c809b562bca09bd1df0b4c755425?context=explore) (use the first 7 characters of the commit id) -## Dependencies +### Dependencies When you use the DeepHealth image for a library, the image also contains the libraries on which it depends: * PyECVL -> also contains PyEDDL, EDDL, ECVL @@ -27,7 +27,7 @@ When you use the DeepHealth image for a library, the image also contains the lib If you want everything, use the PyECVL image. -## Toolkit +### Toolkit For all images, a toolkit version is also built that contains build requirements for software (compiler, headers, etc.). You can use these to build your own software or rebuild the DeepHealth libraries from source. @@ -39,7 +39,7 @@ The toolkit images have the same name with an appended `-toolkit`: -# Description +## Description The `docker-libs` repository allows users to build and publish on a registry (e.g., DockerHub) Docker images containing the DeepHealth libraries: [EDDL](https://github.com/deephealthproject/eddl), [ECVL](https://github.com/deephealthproject/ecvl) and their Python wrappers, [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl). All the images are based on the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) and the EDDL and ECVL libraries are configured to leverage NVIDIA GPUs. From 6139bc8f60dc0bfe42fa91dbdc69d5206952fa54 Mon Sep 17 00:00:00 2001 From: Luca Pireddu Date: Tue, 3 Mar 2020 13:16:18 +0100 Subject: [PATCH 163/200] Minor changes --- README.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 88cb2f2..0eaa04e 100644 --- a/README.md +++ b/README.md @@ -25,21 +25,14 @@ When you use the DeepHealth image for a library, the image also contains the lib * ECVL -> also contains EDDL * EDDL -> on its own -If you want everything, use the PyECVL image. +If you want everything, **use the PyECVL image**. ### Toolkit -For all images, a toolkit version is also built that contains build requirements for software (compiler, headers, etc.). You can use these to build your own software or rebuild the DeepHealth libraries from source. +For all images, a toolkit version is also built that contains build requirements for software (compiler, headers, etc.). You can use these to build your own software or rebuild the DeepHealth libraries from source. Keep reading the section below for details. -The toolkit images have the same name with an appended `-toolkit`: -* `dhealth/eddl-toolkit` -* `dhealth/ecvl-toolkit` -* `dhealth/pyeddl-toolkit` -* `dhealth/pyecvl-toolkit` - - -## Description +## Detailed description The `docker-libs` repository allows users to build and publish on a registry (e.g., DockerHub) Docker images containing the DeepHealth libraries: [EDDL](https://github.com/deephealthproject/eddl), [ECVL](https://github.com/deephealthproject/ecvl) and their Python wrappers, [PyEDDL](https://github.com/deephealthproject/pyeddl) and [PyECVL](https://github.com/deephealthproject/pycvl). All the images are based on the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) and the EDDL and ECVL libraries are configured to leverage NVIDIA GPUs. From f0fff8ef57bb5f044ac378480d799fca0d75ee84 Mon Sep 17 00:00:00 2001 From: Luca Pireddu Date: Tue, 3 Mar 2020 13:17:20 +0100 Subject: [PATCH 164/200] Add docker pull example --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0eaa04e..d5e55f0 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ Docker images to develop and run software based on the [EDDL](https://github.com ## TL;DR + docker pull dhealth/pyecvl + + * Every library has a corresponding image repository: - `dhealth/eddl` - `dhealth/ecvl` From f739a6a3aa7fccc8206104d40ac60d62eee3b2f0 Mon Sep 17 00:00:00 2001 From: Luca Pireddu Date: Tue, 3 Mar 2020 13:54:55 +0100 Subject: [PATCH 165/200] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d5e55f0..0296747 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Docker images to develop and run software based on the [EDDL](https://github.com ## TL;DR - docker pull dhealth/pyecvl +E.g., `docker pull dhealth/pyecvl:0.1.0` * Every library has a corresponding image repository: From b9f7a996faa7473fcc2fdfd6ab8baf50255c44cc Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 26 Mar 2020 11:32:50 +0000 Subject: [PATCH 166/200] Add missing GTest library --- libs/libs-base-toolkit.Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 77a2250..57967f9 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -43,7 +43,6 @@ RUN \ --slave /usr/bin/g++ g++ /usr/bin/g++-8 \ --slave /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/x86_64-linux-gnu-gcc-8 \ --slave /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ /usr/bin/x86_64-linux-gnu-g++-8 \ - && apt-get clean \ && echo "\n > Installing cmake (version '${cmake_release}')..." >&2 \ && cd /tmp/ \ && wget --quiet https://github.com/Kitware/CMake/releases/download/v3.14.6/cmake-${cmake_release}-Linux-x86_64.tar.gz \ @@ -94,4 +93,12 @@ RUN \ && make -j$(nproc) \ && make install \ && ldconfig \ - && rm -rf /tmp/protobuf-${protobuf_release} + && rm -rf /tmp/protobuf-${protobuf_release} \ + && echo "\n > Installing GTest library..." >&2 \ + && apt-get install -y --no-install-recommends libgtest-dev \ + && cd /usr/src/gtest \ + && mkdir build \ + && cd build \ + && cmake .. \ + && make install \ + && apt-get clean \ From b4986d5a299451a4cbc39566cd94c46011c3435d Mon Sep 17 00:00:00 2001 From: kikkomep Date: Thu, 26 Mar 2020 11:33:13 +0000 Subject: [PATCH 167/200] Bump base image version tag --- settings.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.conf b/settings.conf index 7d24d1c..529de89 100644 --- a/settings.conf +++ b/settings.conf @@ -1,7 +1,7 @@ # DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG=0.2.0 +DOCKER_BASE_IMAGE_VERSION_TAG=0.2.1 DOCKER_LOGIN_DONE=true From 560afad6a3092a190586d206b63b382917d1c056 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 17:31:35 +0000 Subject: [PATCH 168/200] Evaluate settings.conf first --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 7edcb04..797e342 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,12 @@ ifeq ($(UNAME_S),Darwin) XARGS_OPT = endif +# config file +CONFIG_FILE ?= settings.conf +ifneq ($(wildcard $(CONFIG_FILE)),) +include $(CONFIG_FILE) +endif + # date.time as build number BUILD_NUMBER := $(or ${BUILD_NUMBER},$(shell date '+%Y%m%d.%H%M%S')) From 5811223888262e27dfd67c92c24025b19e700c4c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 17:38:35 +0000 Subject: [PATCH 169/200] Add BUILD_TARGET option --- Makefile | 26 +++++++++++++++++------ libs/libs-base-toolkit.Dockerfile | 4 ++++ libs/libs-base.Dockerfile | 11 +++++++--- pylibs/pyeddl-toolkit.Dockerfile | 30 +++++++++++++-------------- pylibs/pyeddl.Dockerfile | 11 +++++----- pylibs/pylibs-base-toolkit.Dockerfile | 9 +++++++- 6 files changed, 59 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 797e342..db7f42c 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,10 @@ endif # date.time as build number BUILD_NUMBER := $(or ${BUILD_NUMBER},$(shell date '+%Y%m%d.%H%M%S')) +# set build target: (CPU, GPU) +BUILD_TARGET := $(or $(BUILD_TARGET),CPU) +build_target_opts := --build-arg BUILD_TARGET=$(BUILD_TARGET) + # log file with dependencies IMAGES_LOG := .images.log LIBRARIES_LOG := .libraries.log @@ -153,7 +157,7 @@ define build_new_image cd ${image} \ && docker build ${BUILD_CACHE_OPT} \ -f ${target}.Dockerfile \ - ${base} ${toolkit} \ + ${base} ${toolkit} ${extra_args} \ -t ${image_name}:${tag} ${tags} ${latest_tags} ${labels} . endef @@ -165,6 +169,7 @@ define build_image $(eval base := $(if $(5), --build-arg BASE_IMAGE=$(5))) $(eval toolkit := $(if $(6), --build-arg TOOLKIT_IMAGE=$(6))) $(eval extra_tags := $(7)) + $(eval extra_args := $(8)) $(eval image_name := ${DOCKER_IMAGE_PREFIX}${target}${${target}_suffix}) $(eval full_image_name := $(shell prefix=""; if [ -n "${DOCKER_REGISTRY}" ]; then prefix="${DOCKER_REGISTRY}/"; fi; echo "${prefix}${DOCKER_REPOSITORY_OWNER}/${image_name}")) $(eval latest_tags := $(shell if [ "${push_latest_tags}" == "true" ]; then echo "-t ${image_name}:latest"; fi)) @@ -463,9 +468,14 @@ _build: \ ############# libs-toolkit ############# _build_libs_base_toolkit: - $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_DEVELOP_IMAGE)) - $(call log_image_revision,$(DOCKER_NVIDIA_DEVELOP_IMAGE_NAME),$(DOCKER_NVIDIA_DEVELOP_IMAGE_TAG)) + $(if $(findstring $(BUILD_TARGET), GPU),\ + echo "Building for GPU"; \ + $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG}, --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_DEVELOP_IMAGE),,,${build_target_opts}) \ + $(call log_image_revision,$(DOCKER_NVIDIA_DEVELOP_IMAGE_NAME),$(DOCKER_NVIDIA_DEVELOP_IMAGE_TAG)),\ + echo "Building for CPU"; \ + $(call build_image,libs,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG}, --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_UBUNTU_IMAGE),,,${build_target_opts}) \ + $(call log_image_revision,$(DOCKER_UBUNTU_IMAGE_NAME),$(DOCKER_UBUNTU_IMAGE_TAG)) \ + ) build_eddl_toolkit: eddl_folder _build_libs_base_toolkit apply_pyeddl_patches ## Build 'eddl-toolkit' image $(call build_image,libs,eddl-toolkit,${EDDL_IMAGE_VERSION_TAG},\ @@ -498,8 +508,12 @@ build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image _build_libs_base: _build_libs_base_toolkit $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ - --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG)) - $(call log_image_revision,$(DOCKER_NVIDIA_RUNTIME_IMAGE_NAME),$(DOCKER_NVIDIA_RUNTIME_IMAGE_TAG)) + --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG),,${build_target_opts})\ + $(call log_image_revision,$(DOCKER_NVIDIA_RUNTIME_IMAGE_NAME),$(DOCKER_NVIDIA_RUNTIME_IMAGE_TAG)),\ + $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_UBUNTU_IMAGE),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG),,${build_target_opts})\ + $(call log_image_revision,$(DOCKER_UBUNTU_IMAGE_NAME),$(DOCKER_UBUNTU_IMAGE_TAG))\ + ) build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image $(call build_image,libs,eddl,${EDDL_IMAGE_VERSION_TAG},\ diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 57967f9..926e5aa 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -25,6 +25,10 @@ ARG protobuf_release="3.11.4" ENV PROTOBUF_RELEASE ${protobuf_release} ENV PROTOBUF_INSTALL_MANIFEST "/usr/local/protobuf/install_manifest.txt" +# set build target +ARG BUILD_TARGET="CPU" +ENV BUILD_TARGET=${BUILD_TARGET} + # Install software requirements RUN \ echo "\nInstalling software requirements..." >&2 \ diff --git a/libs/libs-base.Dockerfile b/libs/libs-base.Dockerfile index 189822c..a98a6bd 100644 --- a/libs/libs-base.Dockerfile +++ b/libs/libs-base.Dockerfile @@ -1,5 +1,6 @@ ARG BASE_IMAGE ARG TOOLKIT_IMAGE +ARG BUILD_TARGET="CPU" ARG OPENV_INSTALL_MANIFEST="/usr/local/opencv/install_manifest.txt" # set toolkit image @@ -33,9 +34,13 @@ RUN cd /tmp/local && sed -e 's+/usr/local/++g' *_manifest.txt | \ #################### FROM ${BASE_IMAGE} AS base -LABEL website="https://github.com/deephealthproject" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl" +LABEL website="https://github.com/deephealthproject" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl" + +# set build target +ARG BUILD_TARGET +ENV BUILD_TARGET ${BUILD_TARGET} # Install software requirements RUN \ diff --git a/pylibs/pyeddl-toolkit.Dockerfile b/pylibs/pyeddl-toolkit.Dockerfile index 4123fa2..8b42892 100644 --- a/pylibs/pyeddl-toolkit.Dockerfile +++ b/pylibs/pyeddl-toolkit.Dockerfile @@ -13,22 +13,20 @@ ARG eddl_src="/usr/local/src/eddl" ARG pyeddl_src_origin="pyeddl" ARG pyeddl_src_target="/usr/local/src/pyeddl" -# enable CUDA support -ENV EDDL_WITH_CUDA 'true' - -# link the cudart, cublas and curand libraries on "standard" system locations -RUN ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ - && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ - && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ - # Run git submodule update [--init] --recursive first COPY ${pyeddl_src_origin} ${pyeddl_src_target} -RUN \ - cd ${pyeddl_src_target} \ - && echo "\nLinking eddl library..." >&2 \ - && rm -r third_party/eddl \ - && ln -s ${eddl_src} third_party/ \ - && echo "\nInstalling pyeddl module..." >&2 \ - && python3 setup.py install --record install.log \ - && rm -rf build/temp.* +# link the cudart, cublas and curand libraries on "standard" system locations +RUN /bin/bash -c "if [[ \"${BUILD_TARGET}\" == \"GPU\" ]]; then \ + ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ \ + && export EDDL_WITH_CUDA=\"true\" ; \ + fi" \ + && cd ${pyeddl_src_target} \ + && echo "\nLinking eddl library..." >&2 \ + && rm -r third_party/eddl \ + && ln -s ${eddl_src} third_party/ \ + && echo "\nInstalling pyeddl module..." >&2 \ + && python3 setup.py install --record install.log \ + && rm -rf build/temp.* diff --git a/pylibs/pyeddl.Dockerfile b/pylibs/pyeddl.Dockerfile index 883dc14..50492e2 100644 --- a/pylibs/pyeddl.Dockerfile +++ b/pylibs/pyeddl.Dockerfile @@ -21,13 +21,12 @@ LABEL website="https://github.com/deephealthproject/" LABEL description="DeepHealth European Distributed Deep Learning Library" LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" -# enable CUDA support -ENV EDDL_WITH_CUDA 'true' - # link the cudart, cublas and curand libraries on "standard" system locations -RUN ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ - && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ - && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ +RUN /bin/bash -c "if [[ \"${BUILD_TARGET}\" == \"GPU\" ]]; then \ + ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ ; \ + fi" # Run git submodule update [--init] --recursive first COPY --from=intermediate_stage /intermediate_path/bin/* /usr/local/bin/ diff --git a/pylibs/pylibs-base-toolkit.Dockerfile b/pylibs/pylibs-base-toolkit.Dockerfile index 6fb78ee..a8e7630 100644 --- a/pylibs/pylibs-base-toolkit.Dockerfile +++ b/pylibs/pylibs-base-toolkit.Dockerfile @@ -12,4 +12,11 @@ RUN \ python3-dev python3-pip \ && apt-get clean \ && python3 -m pip install --upgrade --no-cache-dir \ - setuptools pip numpy pybind11 pytest \ No newline at end of file + setuptools pip numpy pybind11 pytest \ + # link the cudart, cublas and curand libraries on "standard" system locations + && /bin/bash -c "if [[ "${BUILD_TARGET}" == "GPU" ]]; then \ + ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ + && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ \ + && export EDDL_WITH_CUDA="true" ; \ + fi" From 4bc64767a420f6d8950a1c458a4a8b59f461b9ae Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 17:47:21 +0000 Subject: [PATCH 170/200] Add CPU base image and fix tags --- Makefile | 92 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index db7f42c..3dc4aea 100644 --- a/Makefile +++ b/Makefile @@ -42,30 +42,53 @@ DOCKER_REPOSITORY_OWNER := $(or ${DOCKER_REPOSITORY_OWNER},${DOCKER_USER}) runtime_suffix = develop_suffix = -toolkit +# extract info about repository revision +LIBS_TAG := $(shell git tag -l --points-at HEAD | tail -n 1) +LIBS_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') +LIBS_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') +LIBS_VERSION := $(shell if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) + +# set container version equal to the repository version +CONTAINER_VERSION := $(LIBS_VERSION) + +# set base image version +DOCKER_BASE_IMAGE_VERSION := ${DOCKER_BASE_IMAGE_VERSION} + # latest tag settings DOCKER_IMAGE_LATEST := $(or ${DOCKER_IMAGE_LATEST},false) # extra tags DOCKER_IMAGE_TAG_EXTRA := ${DOCKER_IMAGE_TAG_EXTRA} +# set tag suffix +DOCKER_IMAGE_TAG_SUFFIX := $(shell [[ "$(ENABLE_TARGET_SUFFIX_IMAGE_TAG)" == "true" ]] && echo -$(BUILD_TARGET) | tr '[:upper:]' '[:lower:]') + # set default Docker image TAG DOCKER_IMAGE_TAG := $(or ${DOCKER_IMAGE_TAG},${BUILD_NUMBER}) +# set docker-libs version tag +DOCKER_LIBS_IMAGE_VERSION_TAG := $(or ${LIBS_IMAGE_VERSION_TAG},${LIBS_TAG},${LIBS_VERSION})$(DOCKER_IMAGE_TAG_SUFFIX) +DOCKER_LIBS_EXTRA_TAGS := $(LIBS_VERSION)$(DOCKER_IMAGE_TAG_SUFFIX) $(LIBS_REVISION)$(DOCKER_IMAGE_TAG_SUFFIX) + # set default Base images DOCKER_BASE_IMAGE_SKIP_PULL := $(or ${DOCKER_BASE_IMAGE_SKIP_PULL},true) -DOCKER_NVIDIA_DEVELOP_IMAGE := $(or ${DOCKER_NVIDIA_DEVELOP_IMAGE},nvidia/cuda:10.1-devel) -DOCKER_NVIDIA_RUNTIME_IMAGE := $(or ${DOCKER_NVIDIA_RUNTIME_IMAGE},nvidia/cuda:10.1-runtime) +DOCKER_UBUNTU_IMAGE := $(or ${DOCKER_UBUNTU_IMAGE},ubuntu:18.04) +DOCKER_NVIDIA_DEVELOP_IMAGE := $(or ${DOCKER_NVIDIA_DEVELOP_IMAGE},nvidia/cuda:10.1-devel-ubuntu18.04) +DOCKER_NVIDIA_RUNTIME_IMAGE := $(or ${DOCKER_NVIDIA_RUNTIME_IMAGE},nvidia/cuda:10.1-runtime-ubuntu18.04) + # extract name and tag of nvidia images +DOCKER_UBUNTU_IMAGE_NAME := $(shell echo ${DOCKER_UBUNTU_IMAGE} | sed -e 's+:.*++') +DOCKER_UBUNTU_IMAGE_TAG := $(shell echo ${DOCKER_UBUNTU_IMAGE} | sed -E 's@.+:(.+)@\1@') DOCKER_NVIDIA_DEVELOP_IMAGE_NAME := $(shell echo ${DOCKER_NVIDIA_DEVELOP_IMAGE} | sed -e 's+:.*++') DOCKER_NVIDIA_DEVELOP_IMAGE_TAG := $(shell echo ${DOCKER_NVIDIA_DEVELOP_IMAGE} | sed -E 's@.+:(.+)@\1@') DOCKER_NVIDIA_RUNTIME_IMAGE_NAME := $(shell echo ${DOCKER_NVIDIA_RUNTIME_IMAGE} | sed -e 's+:.*++') DOCKER_NVIDIA_RUNTIME_IMAGE_TAG := $(shell echo ${DOCKER_NVIDIA_RUNTIME_IMAGE} | sed -E 's@.+:(.+)@\1@') -DOCKER_BASE_IMAGE_VERSION_TAG := $(or ${DOCKER_BASE_IMAGE_VERSION_TAG},${DOCKER_IMAGE_TAG}) -EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) -ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) -PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) -PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) +DOCKER_BASE_IMAGE_VERSION_TAG := $(CONTAINER_VERSION)$(DOCKER_IMAGE_TAG_SUFFIX) +EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) +ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) +PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) +PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) # current path CURRENT_PATH := $(PWD) @@ -102,12 +125,6 @@ PYEDDL_BRANCH := $(or ${PYEDDL_BRANCH},master) PYEDDL_REVISION := ${PYEDDL_REVISION} PYEDDL_TAG := -# config file -CONFIG_FILE ?= settings.conf -ifneq ($(wildcard $(CONFIG_FILE)),) -include $(CONFIG_FILE) -endif - # disable image pull DISABLE_PULL ?= 0 _DO_NOT_PULL_DOCKER_IMAGES = 0 @@ -131,17 +148,6 @@ ifeq ($(DOCKER_IMAGE_LATEST),$(filter $(DOCKER_IMAGE_LATEST),1 true TRUE)) push_latest_tags = true endif -# extract info about repository revision -LIBS_TAG := $(shell git tag -l --points-at HEAD | tail -n 1) -LIBS_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') -LIBS_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') -LIBS_VERSION := $(shell if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) -LIBS_IMAGE_VERSION_TAG := $(or ${LIBS_IMAGE_VERSION_TAG},${LIBS_TAG},${LIBS_VERSION}) -LIBS_EXTRA_TAGS := $(LIBS_VERSION) $(LIBS_REVISION) - -# set container version equal to the repository version -CONTAINER_VERSION := $(LIBS_VERSION) - # auxiliary flag DOCKER_LOGIN_DONE := $(or ${DOCKER_LOGIN_DONE},false) @@ -494,20 +500,21 @@ build_ecvl_toolkit: ecvl_folder build_eddl_toolkit ## Build 'ecvl-toolkit' image $(call log_image_revision,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},install,ECVL) build_libs_toolkit: build_ecvl_toolkit ## Build 'libs-toolkit' image - $(call build_image,libs,libs-toolkit,${LIBS_IMAGE_VERSION_TAG},\ + $(call build_image,libs,libs-toolkit,${DOCKER_LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=${ECVL_REVISION},ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) + --label ECVL_REVISION=${ECVL_REVISION},ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG),,${DOCKER_LIBS_EXTRA_TAGS}) ############# libs ############# _build_libs_base: _build_libs_base_toolkit - $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ + $(if $(findstring $(BUILD_TARGET), GPU),\ + $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),$(DOCKER_NVIDIA_RUNTIME_IMAGE),libs-base-toolkit:$(DOCKER_BASE_IMAGE_VERSION_TAG),,${build_target_opts})\ $(call log_image_revision,$(DOCKER_NVIDIA_RUNTIME_IMAGE_NAME),$(DOCKER_NVIDIA_RUNTIME_IMAGE_TAG)),\ $(call build_image,libs,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ @@ -535,14 +542,14 @@ build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image $(call log_image_revision,ecvl,${ECVL_IMAGE_VERSION_TAG},install,ECVL) build_libs: build_ecvl ## Build 'libs' image - $(call build_image,libs,libs,${LIBS_IMAGE_VERSION_TAG},\ + $(call build_image,libs,libs,${DOCKER_LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ --label EDDL_REVISION=${EDDL_REVISION} \ --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ --label ECVL_BRANCH=${ECVL_BRANCH} \ - --label ECVL_REVISION=${ECVL_REVISION},ecvl:$(ECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) + --label ECVL_REVISION=${ECVL_REVISION},ecvl:$(ECVL_IMAGE_VERSION_TAG),,${DOCKER_LIBS_EXTRA_TAGS}) @@ -585,7 +592,7 @@ build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolki $(call log_image_revision,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},install,PYECVL) build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image - $(call build_image,pylibs,pylibs-toolkit,${LIBS_IMAGE_VERSION_TAG},\ + $(call build_image,pylibs,pylibs-toolkit,${DOCKER_LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -598,14 +605,15 @@ build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG),,${DOCKER_LIBS_EXTRA_TAGS}) ############# pylibs ############# _build_pylibs_base: build_ecvl - $(call build_image,pylibs,pylibs-base,${DOCKER_BASE_IMAGE_VERSION_TAG},\ + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) + $(call build_image,pylibs,pylibs-base,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl:$(ECVL_IMAGE_VERSION_TAG)) build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image @@ -619,7 +627,7 @@ build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image --label ECVL_REVISION=${ECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(PYLIBS_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) $(call log_image_revision,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},install,PYEDDL) build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image @@ -640,7 +648,7 @@ build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image $(call log_image_revision,pyecvl,${PYECVL_IMAGE_VERSION_TAG},install,PYECVL) build_pylibs: build_pyecvl ## Build 'pylibs' image - $(call build_image,pylibs,pylibs,${LIBS_IMAGE_VERSION_TAG},\ + $(call build_image,pylibs,pylibs,${DOCKER_LIBS_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ --label EDDL_BRANCH=${EDDL_BRANCH} \ @@ -653,7 +661,7 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl:$(PYECVL_IMAGE_VERSION_TAG),,${LIBS_REVISION}) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyecvl:$(PYECVL_IMAGE_VERSION_TAG),,${DOCKER_LIBS_EXTRA_TAGS}) ############################################################################################################################ @@ -661,10 +669,10 @@ build_pylibs: build_pyecvl ## Build 'pylibs' image ############################################################################################################################ define check_image printf "\nSearching image $(1)... " ; \ - images=$(docker images -q ${1}) ; \ + images=$(docker images -q ${1}) 2> /dev/null ; \ if [ -z "$${images}" ]; then \ - docker pull ${DOCKER_REPOSITORY_OWNER}/${1}; \ - docker tag ${DOCKER_REPOSITORY_OWNER}/${1} ${1}; \ + docker pull ${DOCKER_REPOSITORY_OWNER}/${1} 2> /dev/null ; \ + docker tag ${DOCKER_REPOSITORY_OWNER}/${1} ${1} 2> /dev/null ; \ fi ; \ printf "\n" endef @@ -772,7 +780,7 @@ _push: \ push_pyecvl push_pyecvl_toolkit push_libs: docker_login ## Push 'libs' image - $(call push_image,libs,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) + $(call push_image,libs,${DOCKER_LIBS_IMAGE_VERSION_TAG},${DOCKER_LIBS_EXTRA_TAGS}) push_libs_base: docker_login ## Push 'lib-base' image $(call push_image,libs-base,${DOCKER_BASE_IMAGE_VERSION_TAG}) @@ -784,7 +792,7 @@ push_ecvl: docker_login ecvl_folder ## Push 'ecvl' image $(call push_image,ecvl,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION} ${ECVL_TAG}) push_libs_toolkit: docker_login ## Push 'libs-toolkit' image - $(call push_image,libs-toolkit,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) + $(call push_image,libs-toolkit,${DOCKER_LIBS_IMAGE_VERSION_TAG},${DOCKER_LIBS_EXTRA_TAGS}) push_libs_base_toolkit: docker_login ## Push 'libs-base-toolkit' image $(call push_image,libs-base-toolkit,${DOCKER_BASE_IMAGE_VERSION_TAG}) @@ -796,7 +804,7 @@ push_ecvl_toolkit: docker_login ecvl_folder ## Push 'ecvl-toolkit' images $(call push_image,ecvl-toolkit,${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION} ${ECVL_TAG}) push_pylibs: docker_login ## Push 'pylibs' images - $(call push_image,pylibs,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) + $(call push_image,pylibs,${DOCKER_LIBS_IMAGE_VERSION_TAG},${DOCKER_LIBS_EXTRA_TAGS}) push_pyeddl: docker_login pyeddl_folder ## Push 'pyeddl' images $(call push_image,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION} ${PYEDDL_TAG}) @@ -805,7 +813,7 @@ push_pyecvl: docker_login pyecvl_folder ## Push 'pyecvl' images $(call push_image,pyecvl,${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION} ${PYECVL_TAG}) push_pylibs_toolkit: docker_login ## Push 'pylibs-toolkit' images - $(call push_image,pylibs-toolkit,${LIBS_IMAGE_VERSION_TAG},${LIBS_EXTRA_TAGS}) + $(call push_image,pylibs-toolkit,${DOCKER_LIBS_IMAGE_VERSION_TAG},${DOCKER_LIBS_EXTRA_TAGS}) push_pyeddl_toolkit: docker_login pyeddl_folder ## Push 'pyeddl-toolkit' images $(call push_image,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION} ${PYEDDL_TAG}) From 0894eefa27b6615001f6f2cb725b49b69227b06d Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 17:54:41 +0000 Subject: [PATCH 171/200] Minor optimizations --- libs/eddl-toolkit.Dockerfile | 6 +++--- libs/libs-base-toolkit.Dockerfile | 9 +++++---- libs/libs-base.Dockerfile | 4 +++- libs/libs-toolkit.Dockerfile | 6 +++--- libs/libs.Dockerfile | 6 +++--- pylibs/pyecvl-toolkit.Dockerfile | 6 +++--- pylibs/pyecvl.Dockerfile | 6 +++--- pylibs/pyeddl-toolkit.Dockerfile | 6 +++--- pylibs/pyeddl.Dockerfile | 6 +++--- pylibs/pylibs-base-toolkit.Dockerfile | 5 +++-- pylibs/pylibs-base.Dockerfile | 5 +++-- pylibs/pylibs-toolkit.Dockerfile | 6 +++--- pylibs/pylibs.Dockerfile | 6 +++--- 13 files changed, 41 insertions(+), 36 deletions(-) diff --git a/libs/eddl-toolkit.Dockerfile b/libs/eddl-toolkit.Dockerfile index 4613494..4a69dc8 100644 --- a/libs/eddl-toolkit.Dockerfile +++ b/libs/eddl-toolkit.Dockerfile @@ -2,9 +2,9 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} AS libs.eddl-toolkit # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl" # set arguments ARG eddl_src_origin="eddl" diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 926e5aa..39d5eb6 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -2,9 +2,9 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as libs.base-toolkit # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl" # set cmake version ARG cmake_release="3.14.6" @@ -31,7 +31,7 @@ ENV BUILD_TARGET=${BUILD_TARGET} # Install software requirements RUN \ - echo "\nInstalling software requirements..." >&2 \ + echo "\nInstalling base software requirements..." >&2 \ && export DEBIAN_FRONTEND=noninteractive \ && apt-get update -y -q \ && apt-get install -y --no-install-recommends \ @@ -106,3 +106,4 @@ RUN \ && cmake .. \ && make install \ && apt-get clean \ + && rm -rf /var/lib/apt/lists/* diff --git a/libs/libs-base.Dockerfile b/libs/libs-base.Dockerfile index a98a6bd..4d7dd55 100644 --- a/libs/libs-base.Dockerfile +++ b/libs/libs-base.Dockerfile @@ -13,7 +13,8 @@ FROM ${BASE_IMAGE} AS prepare_install RUN apt-get update -y -q \ && apt-get install -y --no-install-recommends wget rsync \ - && apt-get clean + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* # make a temporary copy of libraries COPY --from=toolkit /usr/local/bin /tmp/local/bin @@ -55,6 +56,7 @@ RUN \ libopenslide-dev \ libgomp1 \ && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ && ldconfig # copy libraries to the target paths diff --git a/libs/libs-toolkit.Dockerfile b/libs/libs-toolkit.Dockerfile index 5d6dd38..d090eb1 100644 --- a/libs/libs-toolkit.Dockerfile +++ b/libs/libs-toolkit.Dockerfile @@ -2,6 +2,6 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} AS libs-toolkit # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl" \ No newline at end of file +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl" \ No newline at end of file diff --git a/libs/libs.Dockerfile b/libs/libs.Dockerfile index 538caae..2e7d2d5 100644 --- a/libs/libs.Dockerfile +++ b/libs/libs.Dockerfile @@ -2,6 +2,6 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} AS libs # Set metadata -LABEL website="https://github.com/deephealthproject" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl" +LABEL website="https://github.com/deephealthproject" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl" diff --git a/pylibs/pyecvl-toolkit.Dockerfile b/pylibs/pyecvl-toolkit.Dockerfile index dbf9ef0..c306dc5 100644 --- a/pylibs/pyecvl-toolkit.Dockerfile +++ b/pylibs/pyecvl-toolkit.Dockerfile @@ -2,9 +2,9 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" # set paths ARG ecvl_src="/usr/local/src/ecvl" diff --git a/pylibs/pyecvl.Dockerfile b/pylibs/pyecvl.Dockerfile index 7474948..5216ffe 100644 --- a/pylibs/pyecvl.Dockerfile +++ b/pylibs/pyecvl.Dockerfile @@ -17,9 +17,9 @@ RUN sed -e 's+/usr/local/++g' install.log | \ FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" # Run git submodule update [--init] --recursive first COPY --from=intermediate_stage /intermediate_path/bin/* /usr/local/bin/ diff --git a/pylibs/pyeddl-toolkit.Dockerfile b/pylibs/pyeddl-toolkit.Dockerfile index 8b42892..8aa4f23 100644 --- a/pylibs/pyeddl-toolkit.Dockerfile +++ b/pylibs/pyeddl-toolkit.Dockerfile @@ -4,9 +4,9 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" ARG eddl_src="/usr/local/src/eddl" diff --git a/pylibs/pyeddl.Dockerfile b/pylibs/pyeddl.Dockerfile index 50492e2..d42a421 100644 --- a/pylibs/pyeddl.Dockerfile +++ b/pylibs/pyeddl.Dockerfile @@ -17,9 +17,9 @@ RUN sed -e 's+/usr/local/++g' install.log | \ FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl,deephealth-pyeddl" # link the cudart, cublas and curand libraries on "standard" system locations RUN /bin/bash -c "if [[ \"${BUILD_TARGET}\" == \"GPU\" ]]; then \ diff --git a/pylibs/pylibs-base-toolkit.Dockerfile b/pylibs/pylibs-base-toolkit.Dockerfile index a8e7630..877aaa3 100644 --- a/pylibs/pylibs-base-toolkit.Dockerfile +++ b/pylibs/pylibs-base-toolkit.Dockerfile @@ -2,8 +2,8 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" # software requirements RUN \ @@ -11,6 +11,7 @@ RUN \ && apt-get -y update && apt-get -y install --no-install-recommends \ python3-dev python3-pip \ && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ && python3 -m pip install --upgrade --no-cache-dir \ setuptools pip numpy pybind11 pytest \ # link the cudart, cublas and curand libraries on "standard" system locations diff --git a/pylibs/pylibs-base.Dockerfile b/pylibs/pylibs-base.Dockerfile index 0bf42b5..42bf6fd 100644 --- a/pylibs/pylibs-base.Dockerfile +++ b/pylibs/pylibs-base.Dockerfile @@ -3,8 +3,8 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" # Install software requirements RUN \ @@ -12,5 +12,6 @@ RUN \ && apt-get -y update && apt-get -y install --no-install-recommends \ python3-dev python3-pip \ && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ && python3 -m pip install --upgrade --no-cache-dir \ setuptools pip numpy pybind11 pytest \ No newline at end of file diff --git a/pylibs/pylibs-toolkit.Dockerfile b/pylibs/pylibs-toolkit.Dockerfile index 4101275..04de904 100644 --- a/pylibs/pylibs-toolkit.Dockerfile +++ b/pylibs/pylibs-toolkit.Dockerfile @@ -2,6 +2,6 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" diff --git a/pylibs/pylibs.Dockerfile b/pylibs/pylibs.Dockerfile index b223178..67096a3 100644 --- a/pylibs/pylibs.Dockerfile +++ b/pylibs/pylibs.Dockerfile @@ -3,6 +3,6 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as base # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl,deephealth-ecvl,deephealth-pyecvl,deephealth-pyeddl" From d78a8cd84d447fcf48d31057c44513a5ef77acb9 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 17:55:23 +0000 Subject: [PATCH 172/200] Use BUILD_TARGET env variable --- libs/eddl-toolkit.Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/eddl-toolkit.Dockerfile b/libs/eddl-toolkit.Dockerfile index 4a69dc8..cbf3da0 100644 --- a/libs/eddl-toolkit.Dockerfile +++ b/libs/eddl-toolkit.Dockerfile @@ -22,7 +22,8 @@ RUN echo "\nBuilding EDDL library..." >&2 \ && mkdir build \ && cd build \ && cmake \ - -D BUILD_TARGET=GPU \ + -D BUILD_TARGET=${BUILD_TARGET} \ + -D DBUILD_EXAMPLES=ON \ -D BUILD_TESTS=ON \ -D BUILD_SHARED_LIB=ON \ -D BUILD_PROTOBUF=ON \ From dd25f3857e7269c676db79f00b4d7d01b489d396 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 17:57:30 +0000 Subject: [PATCH 173/200] Reduce size of EDDL and ECVL images building them from scratch --- libs/ecvl.Dockerfile | 39 +++++++++++++++++++++++++++++---------- libs/eddl.Dockerfile | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/libs/ecvl.Dockerfile b/libs/ecvl.Dockerfile index ccb4c4d..4e52880 100644 --- a/libs/ecvl.Dockerfile +++ b/libs/ecvl.Dockerfile @@ -28,15 +28,34 @@ RUN cd /tmp/local && sed -e 's+/usr/local/++g' /tmp/local/install_manifest.txt | ###################### #### TARGET Stage #### ###################### -FROM ${BASE_IMAGE} AS libs.ecvl +FROM scratch AS libs.ecvl # set metadata -LABEL website="https://github.com/deephealthproject/" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-ecvl" - -# copy libraries to the target paths -COPY --from=prepare_install /usr/local/etc /usr/local/etc -COPY --from=prepare_install /usr/local/include /usr/local/include -COPY --from=prepare_install /usr/local/lib /usr/local/lib -COPY --from=prepare_install /usr/local/share /usr/local/share \ No newline at end of file +LABEL website="https://github.com/deephealthproject/" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-ecvl" + +COPY --from=prepare_install /bin /bin +COPY --from=prepare_install /boot /boot +COPY --from=prepare_install /dev /dev +COPY --from=prepare_install /etc /etc +COPY --from=prepare_install /home /home +COPY --from=prepare_install /lib /lib +COPY --from=prepare_install /lib64 /lib64 +COPY --from=prepare_install /media /media +COPY --from=prepare_install /mnt /mnt +COPY --from=prepare_install /opt /opt +COPY --from=prepare_install /proc /proc +COPY --from=prepare_install /root /root +COPY --from=prepare_install /run /run +COPY --from=prepare_install /sbin /sbin +COPY --from=prepare_install /srv /srv +COPY --from=prepare_install /sys /sys +COPY --from=prepare_install /usr /usr +COPY --from=prepare_install /var /var + +# create the /tmp folder with right permissions +RUN mkdir -p /tmp && chmod 1777 /tmp + +# default cmd +CMD ["/bin/bash"] \ No newline at end of file diff --git a/libs/eddl.Dockerfile b/libs/eddl.Dockerfile index e2ef136..76488b0 100644 --- a/libs/eddl.Dockerfile +++ b/libs/eddl.Dockerfile @@ -27,15 +27,34 @@ RUN cd /tmp/local && sed -e 's+/usr/local/++g' /tmp/local/install_manifest.txt | ###################### #### TARGET Stage #### ###################### -FROM ${BASE_IMAGE} AS libs.eddl +FROM scratch AS libs.eddl # Set metadata -LABEL website="https://github.com/deephealthproject" -LABEL description="DeepHealth European Distributed Deep Learning Library" -LABEL software="deephealth-eddl" - -# copy libraries to the target paths -COPY --from=prepare_install /usr/local/etc /usr/local/etc -COPY --from=prepare_install /usr/local/include /usr/local/include -COPY --from=prepare_install /usr/local/lib /usr/local/lib -COPY --from=prepare_install /usr/local/share /usr/local/share \ No newline at end of file +LABEL website="https://github.com/deephealthproject" \ + description="DeepHealth European Distributed Deep Learning Library" \ + software="deephealth-eddl" + +COPY --from=prepare_install /bin /bin +COPY --from=prepare_install /boot /boot +COPY --from=prepare_install /dev /dev +COPY --from=prepare_install /etc /etc +COPY --from=prepare_install /home /home +COPY --from=prepare_install /lib /lib +COPY --from=prepare_install /lib64 /lib64 +COPY --from=prepare_install /media /media +COPY --from=prepare_install /mnt /mnt +COPY --from=prepare_install /opt /opt +COPY --from=prepare_install /proc /proc +COPY --from=prepare_install /root /root +COPY --from=prepare_install /run /run +COPY --from=prepare_install /sbin /sbin +COPY --from=prepare_install /srv /srv +COPY --from=prepare_install /sys /sys +COPY --from=prepare_install /usr /usr +COPY --from=prepare_install /var /var + +# create the /tmp folder with right permissions +RUN mkdir -p /tmp && chmod 1777 /tmp + +# default cmd +CMD ["/bin/bash"] \ No newline at end of file From 78f3c157f10677a1a949d135d0731ea084e0fe5b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 18:01:20 +0000 Subject: [PATCH 174/200] Update default settings --- settings.conf | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/settings.conf b/settings.conf index 529de89..9694ad3 100644 --- a/settings.conf +++ b/settings.conf @@ -1,13 +1,13 @@ -# -DOCKER_NVIDIA_DEVELOP_IMAGE="nvidia/cuda:10.1-devel" -DOCKER_NVIDIA_RUNTIME_IMAGE="nvidia/cuda:10.1-runtime" -DOCKER_BASE_IMAGE_VERSION_TAG=0.2.1 +# set build target (CPU or GPU) +BUILD_TARGET=CPU -DOCKER_LOGIN_DONE=true +# enable/disable suffix `-cpu` or `-gpu` +ENABLE_TARGET_SUFFIX_IMAGE_TAG=false # set docker user credentials #DOCKER_USER=deephealth #DOCKER_PASSWORD="" +DOCKER_LOGIN_DONE=true # use DockerHub as default registry #DOCKER_REGISTRY=registry.hub.docker.com @@ -19,6 +19,9 @@ DOCKER_LOGIN_DONE=true # latest tag settings #DOCKER_IMAGE_LATEST=false +# date.time as build number +#DOCKER_IMAGE_TAG=0.1.2 + # additional tags #DOCKER_IMAGE_TAG_EXTRA= From 5bb1504c75ef24693ead7168dfd49ee904e26d9f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 18:02:00 +0000 Subject: [PATCH 175/200] Upgrade revision of libraries --- settings.conf | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/settings.conf b/settings.conf index 9694ad3..57a17f1 100644 --- a/settings.conf +++ b/settings.conf @@ -28,22 +28,19 @@ DOCKER_LOGIN_DONE=true # ECVL repository ECVL_REPOSITORY=https://github.com/deephealthproject/ecvl.git ECVL_BRANCH=master -ECVL_REVISION=1512be8 +ECVL_REVISION=627c803 # PyECVL PYECVL_REPOSITORY=https://github.com/deephealthproject/pyecvl.git PYECVL_BRANCH=master -PYECVL_REVISION=0.1.0 +PYECVL_REVISION=56f9de5 # EDDL repository EDDL_REPOSITORY=https://github.com/deephealthproject/eddl.git EDDL_BRANCH=master -EDDL_REVISION=v0.4.2 +EDDL_REVISION=7467cb6 # PyEDDL repository PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git PYEDDL_BRANCH=master -PYEDDL_REVISION=0.4.0 - -# date.time as build number -#DOCKER_IMAGE_TAG=0.1.2 +PYEDDL_REVISION=0.6.0 From 523c3257e61318c2af0d308dae1a27154f04e08f Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Wed, 22 Apr 2020 18:02:46 +0000 Subject: [PATCH 176/200] Update tests --- tests/test_pyecvl.sh | 7 +------ tests/test_pyeddl.sh | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/test_pyecvl.sh b/tests/test_pyecvl.sh index fe448c1..6daff19 100644 --- a/tests/test_pyecvl.sh +++ b/tests/test_pyecvl.sh @@ -12,9 +12,4 @@ cd ${PYECVL_SRC} && pytest tests # run examples cd ${PYECVL_SRC}/examples -python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml" -python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml" -python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/examples/data/dicom/ISIC_0000008.dcm" -python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg" -python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi" -python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg" "test_mod.jpg" \ No newline at end of file +bash run_all.sh "${ECVL_SRC}/examples/data" \ No newline at end of file diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index b2cfb01..46aceca 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -9,23 +9,24 @@ PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} # run tests cd ${PYEDDL_SRC} && pytest tests +echo 'Downloading test dataset' +wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin +wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin +wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin +wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin + +echo 'Running tests....' +pytest tests + # run examples cd ${PYEDDL_SRC}/examples if [ -z "${GPU_RUNTIME}" ]; then - echo 'Downloading test dataset' - wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin - wget -q https://www.dropbox.com/s/m82hmmrg46kcugp/trY.bin - wget -q https://www.dropbox.com/s/7psutd4m4wna2d5/tsX.bin - wget -q https://www.dropbox.com/s/q0tnbjvaenb4tjs/tsY.bin - echo 'Running tests for CPUs....' - pytest tests - echo 'Running examples....' + echo 'Running CPU examples...' python3 Tensor/array_tensor_save.py python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 else - echo "Running tests for GPUs..." + echo "Running GPU examples..." python3 Tensor/array_tensor_save.py - echo 'Running examples....' bash NN/1_MNIST/run_all_fast.sh bash NN/py_loss_metric/run_all_fast.sh bash onnx/run_all_fast.sh From 85b174d97987a31c8a72acca2d6dcd8777687b50 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 13:42:43 +0000 Subject: [PATCH 177/200] Fix IMAGE_VERSION_TAG --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3dc4aea..375e54c 100644 --- a/Makefile +++ b/Makefile @@ -85,10 +85,10 @@ DOCKER_NVIDIA_RUNTIME_IMAGE_NAME := $(shell echo ${DOCKER_NVIDIA_RUNTIME_IMAGE} DOCKER_NVIDIA_RUNTIME_IMAGE_TAG := $(shell echo ${DOCKER_NVIDIA_RUNTIME_IMAGE} | sed -E 's@.+:(.+)@\1@') DOCKER_BASE_IMAGE_VERSION_TAG := $(CONTAINER_VERSION)$(DOCKER_IMAGE_TAG_SUFFIX) -EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) -ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) -PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) -PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX) +EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION}) +ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION}) +PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION}) +PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION}) # current path CURRENT_PATH := $(PWD) @@ -288,7 +288,7 @@ define set_library_revision $(eval lib := $(shell echo $(2) | tr a-z A-Z)) $(eval ${lib}_REVISION := $(call get_revision,$(1)/$(2))) $(eval $(lib)_TAG = $(call get_tag,$(1)/$(2))) - $(eval ${lib}_IMAGE_VERSION_TAG = $(or ${${lib}_IMAGE_VERSION_TAG},${${lib}_TAG},${${lib}_REVISION})) + $(eval ${lib}_IMAGE_VERSION_TAG = $(or $(filter %-cpu %-gpu,$(${lib}_IMAGE_VERSION_TAG)),$(or ${${lib}_IMAGE_VERSION_TAG},${${lib}_TAG},${${lib}_REVISION})$(DOCKER_IMAGE_TAG_SUFFIX))) @echo "${lib} rev: ${${lib}_REVISION} ${${lib}_TAG} (image-tag: ${${lib}_IMAGE_VERSION_TAG})" endef From 5a3b913d2bdff6c05dd4dd8ce68222fb0d3cd4a7 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 13:54:28 +0000 Subject: [PATCH 178/200] Remove branch from tag name --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 375e54c..3160060 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ develop_suffix = -toolkit LIBS_TAG := $(shell git tag -l --points-at HEAD | tail -n 1) LIBS_REVISION := $(shell git rev-parse --short HEAD | sed -E 's/-//; s/ .*//') LIBS_BRANCH := $(shell git name-rev --name-only HEAD | sed -E 's+(remotes/|origin/)++g; s+/+-+g; s/ .*//') -LIBS_VERSION := $(shell if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_BRANCH}-${LIBS_REVISION}; fi) +LIBS_VERSION := $(shell if [[ -n "${LIBS_TAG}" ]]; then echo ${LIBS_TAG}; else echo ${LIBS_REVISION}; fi) # set container version equal to the repository version CONTAINER_VERSION := $(LIBS_VERSION) From 6a24e927c9bedb9246b5f92ede02bf86c14a0213 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 14:29:08 +0000 Subject: [PATCH 179/200] Optimize python wrappers images --- Makefile | 58 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 3160060..caf6b94 100644 --- a/Makefile +++ b/Makefile @@ -555,12 +555,29 @@ build_libs: build_ecvl ## Build 'libs' image ############# pylibs-toolkit ############# -_build_pylibs_base_toolkit: build_ecvl_toolkit - $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) +_build_pyeddl_base_toolkit: build_eddl_toolkit + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}) + $(call build_image,pylibs,pylibs-base-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) + +_build_pyecvl_base_toolkit: build_ecvl_toolkit pyeddl_folder apply_pyeddl_patches + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-pyeddl_eddl_${PYEDDL_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) $(call build_image,pylibs,pylibs-base-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) + $(call build_image,pylibs,pyeddl-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=${EDDL_REVISION} \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=${ECVL_REVISION} \ + --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ + --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(PYLIBS_BASE_IMAGE_VERSION_TAG)) + $(call log_image_revision,pyeddl-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},install,PYEDDL) -build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image +build_pyeddl_toolkit: pyeddl_folder _build_pyeddl_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image $(call build_image,pylibs,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -574,7 +591,7 @@ build_pyeddl_toolkit: pyeddl_folder _build_pylibs_base_toolkit apply_pyeddl_patc --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(PYLIBS_BASE_IMAGE_VERSION_TAG)) $(call log_image_revision,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},install,PYEDDL) -build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolkit' image +build_pyecvl_toolkit: pyecvl_folder _build_pyecvl_base_toolkit ## Build 'pyecvl-toolkit' image $(call build_image,pylibs,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -588,7 +605,7 @@ build_pyecvl_toolkit: pyecvl_folder build_pyeddl_toolkit ## Build 'pyecvl-toolki --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl-toolkit:$(PYLIBS_BASE_IMAGE_VERSION_TAG)) $(call log_image_revision,pyecvl-toolkit,${PYECVL_IMAGE_VERSION_TAG},install,PYECVL) build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image @@ -611,12 +628,29 @@ build_pylibs_toolkit: build_pyecvl_toolkit ## Build 'pylibs-toolkit' image ############# pylibs ############# -_build_pylibs_base: build_ecvl - $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) +_build_pyeddl_base: build_eddl + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}) + $(call build_image,pylibs,pylibs-base,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION),eddl:$(EDDL_IMAGE_VERSION_TAG)) + +_build_pyecvl_base: build_ecvl + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-pyeddl_${PYEDDL_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) $(call build_image,pylibs,pylibs-base,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl:$(ECVL_IMAGE_VERSION_TAG)) + $(call build_image,pylibs,pyeddl,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ + --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ + --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ + --label EDDL_BRANCH=${EDDL_BRANCH} \ + --label EDDL_REVISION=${EDDL_REVISION} \ + --label ECVL_REPOSITORY=${ECVL_REPOSITORY} \ + --label ECVL_BRANCH=${ECVL_BRANCH} \ + --label ECVL_REVISION=${ECVL_REVISION} \ + --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ + --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ + --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(PYLIBS_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) + $(call log_image_revision,pyeddl,${PYLIBS_BASE_IMAGE_VERSION_TAG},install,PYEDDL) -build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image +build_pyeddl: build_pyeddl_toolkit _build_pyeddl_base ## Build 'pyeddl' image $(call build_image,pylibs,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -630,7 +664,7 @@ build_pyeddl: build_pyeddl_toolkit _build_pylibs_base ## Build 'pyeddl' image --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(PYLIBS_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) $(call log_image_revision,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},install,PYEDDL) -build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image +build_pyecvl: build_pyecvl_toolkit _build_pyecvl_base ## Build 'pyecvl' image $(call build_image,pylibs,pyecvl,${PYECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ @@ -644,7 +678,7 @@ build_pyecvl: build_pyecvl_toolkit build_pyeddl ## Build 'pyecvl' image --label PYECVL_REVISION=${PYECVL_REVISION} \ --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ - --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl:$(PYEDDL_IMAGE_VERSION_TAG),pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) + --label PYEDDL_REVISION=${PYEDDL_REVISION},pyeddl:$(PYLIBS_BASE_IMAGE_VERSION_TAG),pyecvl-toolkit:$(PYECVL_IMAGE_VERSION_TAG)) $(call log_image_revision,pyecvl,${PYECVL_IMAGE_VERSION_TAG},install,PYECVL) build_pylibs: build_pyecvl ## Build 'pylibs' image @@ -959,9 +993,9 @@ clean: clean_images clean_sources clean_logs _build_libs_base_toolkit \ build_eddl_toolkit build_ecvl_toolkit build_libs_toolkit \ _build_libs_base build_eddl build_ecvl build_libs \ - _build_pylibs_base_toolkit _build_pylibs_base \ + _build_pyeddl_base_toolkit _build_pyecvl_base_toolkit _build_pylibs_base \ build_pyeddl_toolkit build_pyecvl_toolkit build_pylibs_toolkit\ - _build_pylibs_base build_pyeddl build_pyecvl build_pylibs \ + _build_pyeddl_base _build_pyecvl_base build_pyeddl build_pyecvl build_pylibs \ _docker_login docker_login \ push _push \ push_libs push_eddl push_ecvl \ From b0951fe437910ff9eb48a79e4cb94677cf6dd921 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 14:38:47 +0000 Subject: [PATCH 180/200] Do not pull images on tests when pull is disabled --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index caf6b94..41a790f 100644 --- a/Makefile +++ b/Makefile @@ -705,7 +705,7 @@ define check_image printf "\nSearching image $(1)... " ; \ images=$(docker images -q ${1}) 2> /dev/null ; \ if [ -z "$${images}" ]; then \ - docker pull ${DOCKER_REPOSITORY_OWNER}/${1} 2> /dev/null ; \ + [ "${_DO_NOT_PULL_DOCKER_IMAGES}" == "0" ] && docker pull ${DOCKER_REPOSITORY_OWNER}/${1} 2> /dev/null ; \ docker tag ${DOCKER_REPOSITORY_OWNER}/${1} ${1} 2> /dev/null ; \ fi ; \ printf "\n" From ee13d73ecafbd203eb6f8f10229bddb082e134fc Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 14:55:22 +0000 Subject: [PATCH 181/200] Disable certificate check on wget --- libs/libs-base-toolkit.Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 39d5eb6..7bd999a 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -49,7 +49,8 @@ RUN \ --slave /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ /usr/bin/x86_64-linux-gnu-g++-8 \ && echo "\n > Installing cmake (version '${cmake_release}')..." >&2 \ && cd /tmp/ \ - && wget --quiet https://github.com/Kitware/CMake/releases/download/v3.14.6/cmake-${cmake_release}-Linux-x86_64.tar.gz \ + && wget --quiet --no-check-certificate \ + https://github.com/Kitware/CMake/releases/download/v${cmake_release}/cmake-${cmake_release}-Linux-x86_64.tar.gz \ && tar xzf cmake-${cmake_release}-Linux-x86_64.tar.gz \ && rm cmake*.tar.gz \ && mv cmake*/bin/* /usr/local/bin/ \ @@ -59,7 +60,8 @@ RUN \ && rm -rf /tmp/cmake* \ && echo "\n > Installing OpenCV (version '${opencv_release}')..." >&2 \ && cd /tmp/ \ - && wget --quiet https://github.com/opencv/opencv/archive/${opencv_release}.tar.gz \ + && wget --quiet --no-check-certificate \ + https://github.com/opencv/opencv/archive/${opencv_release}.tar.gz \ && tar xzf ${opencv_release}.tar.gz \ && rm ${opencv_release}.tar.gz \ && cd opencv-${opencv_release} \ @@ -76,7 +78,8 @@ RUN \ # https://devtalk.nvidia.com/default/topic/1026622/nvcc-can-t-compile-code-that-uses-eigen/ && echo "\n > Installing Eigen (version '${eigen_release}')..." >&2 \ && cd /tmp \ - && wget --quiet https://gitlab.com/libeigen/eigen/-/archive/${eigen_release}/eigen-${eigen_release}.tar.gz \ + && wget --quiet --no-check-certificate \ + https://gitlab.com/libeigen/eigen/-/archive/${eigen_release}/eigen-${eigen_release}.tar.gz \ && tar xzf eigen-${eigen_release}.tar.gz \ && rm eigen-${eigen_release}.tar.gz \ && cd eigen-${eigen_release} \ @@ -89,7 +92,8 @@ RUN \ && rm -rf /tmp/eigen-${eigen_release} \ && echo "\n > Installing ProtoBuf (version '${protobuf_release}')..." >&2 \ && cd /tmp \ - && wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_release}/protobuf-all-${protobuf_release}.tar.gz \ + && wget --quiet --no-check-certificate \ + https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_release}/protobuf-all-${protobuf_release}.tar.gz \ && tar xf protobuf-all-${protobuf_release}.tar.gz \ && rm protobuf-all-${protobuf_release}.tar.gz \ && cd protobuf-${protobuf_release}/ \ From d5f4def9109b4cd49338eb08542d42dcc0c3f4f4 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 16:25:44 +0000 Subject: [PATCH 182/200] Use PyECVL to determine the latest EDDL compatible with ECVL --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 41a790f..3778939 100644 --- a/Makefile +++ b/Makefile @@ -367,7 +367,7 @@ endef _ecvl_folder: $(call clone_ecvl) -ecvl_folder: _ecvl_folder +ecvl_folder: _ecvl_folder pyecvl_folder $(call set_library_revision,libs,ecvl) \ $(call log_library_revision,ECVL) @@ -530,7 +530,7 @@ build_eddl: _build_libs_base build_eddl_toolkit ## Build 'eddl' image --label EDDL_REVISION=${EDDL_REVISION},libs-base:$(DOCKER_BASE_IMAGE_VERSION_TAG),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) $(call log_image_revision,eddl,${EDDL_IMAGE_VERSION_TAG},install,EDDL) -build_ecvl: _build_libs_base build_eddl build_ecvl_toolkit## Build 'ecvl' image +build_ecvl: _build_libs_base build_ecvl_toolkit build_eddl ## Build 'ecvl' image $(call build_image,libs,ecvl,${ECVL_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION) \ --label EDDL_REPOSITORY=${EDDL_REPOSITORY} \ From cb03f2a9f9176f655d5ea6aa517020d48f21bd07 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 16:42:39 +0000 Subject: [PATCH 183/200] Disable image pull after the first build of the chain --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3778939..d4cf174 100644 --- a/Makefile +++ b/Makefile @@ -160,6 +160,7 @@ endif define build_new_image echo "Building Docker image '${image_name}' ( tags: ${tag} ${extra_tags})..." ; \ $(eval tags := $(filter-out undefined,$(foreach tag,$(extra_tags),-t $(image_name):$(tag)))) + $(eval _DO_NOT_PULL_DOCKER_IMAGES := 1) cd ${image} \ && docker build ${BUILD_CACHE_OPT} \ -f ${target}.Dockerfile \ From 7148a14fbbc85008a71a745b7677efe6166bb77d Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 18:07:41 +0000 Subject: [PATCH 184/200] Update image tags used by tests --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d4cf174..fe3ed00 100644 --- a/Makefile +++ b/Makefile @@ -751,7 +751,7 @@ _test: \ test_pyecvl test_pyecvl_toolkit test_eddl: eddl_folder ## Test 'eddl' images - $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call set_library_revision,libs,eddl) @$(call test_image,\ eddl:${EDDL_IMAGE_VERSION_TAG},\ tests/test_eddl.sh,\ @@ -759,11 +759,11 @@ test_eddl: eddl_folder ## Test 'eddl' images ) test_eddl_toolkit: eddl_folder ## Test 'eddl' images - $(eval EDDL_IMAGE_VERSION_TAG := $(or ${EDDL_IMAGE_VERSION_TAG},${EDDL_REVISION})) + $(call set_library_revision,libs,eddl) @$(call test_image,eddl-toolkit:${EDDL_IMAGE_VERSION_TAG},tests/test_eddl.sh) test_ecvl: ecvl_folder ## Test 'ecvl' images - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call set_library_revision,libs,ecvl) @$(call test_image,\ ecvl:${ECVL_IMAGE_VERSION_TAG},\ tests/test_ecvl.sh,\ @@ -771,11 +771,11 @@ test_ecvl: ecvl_folder ## Test 'ecvl' images ) test_ecvl_toolkit: ecvl_folder ## Test 'ecvl' images - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) + $(call set_library_revision,libs,ecvl) @$(call test_image,ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG},tests/test_ecvl.sh) test_pyeddl: pyeddl_folder ## Test 'ecvl' images - $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call set_library_revision,pylibs,pyeddl) @$(call test_image,\ pyeddl:${PYEDDL_IMAGE_VERSION_TAG},\ tests/test_pyeddl.sh,\ @@ -783,12 +783,12 @@ test_pyeddl: pyeddl_folder ## Test 'ecvl' images ) test_pyeddl_toolkit: pyeddl_folder ## Test 'ecvl' images - $(eval PYEDDL_IMAGE_VERSION_TAG := $(or ${PYEDDL_IMAGE_VERSION_TAG},${PYEDDL_REVISION})) + $(call set_library_revision,pylibs,pyeddl) @$(call test_image,pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},tests/test_pyeddl.sh) test_pyecvl: pyecvl_folder ## Test 'ecvl' images - $(eval ECVL_IMAGE_VERSION_TAG := $(or ${ECVL_IMAGE_VERSION_TAG},${ECVL_REVISION})) - $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) + $(call set_library_revision,libs,ecvl) + $(call set_library_revision,pylibs,pyecvl) @$(call test_image,\ pyecvl:${PYECVL_IMAGE_VERSION_TAG},\ tests/test_pyecvl.sh,\ @@ -797,8 +797,8 @@ test_pyecvl: pyecvl_folder ## Test 'ecvl' images ) test_pyecvl_toolkit: #pyecvl_folder ## Test 'ecvl' images - $(eval PYECVL_IMAGE_VERSION_TAG := $(or ${PYECVL_IMAGE_VERSION_TAG},${PYECVL_REVISION})) - @@$(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) + $(call set_library_revision,pylibs,pyecvl) + @$(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) ############################################################################################################################ ### Push Docker images From 9a9097e0b1bfaac7c16fad4285b5029931edbd57 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 20:19:56 +0000 Subject: [PATCH 185/200] Update default settings --- jenkins.sh | 13 ++----------- settings.conf | 4 ++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 8c7a18c..21aacb5 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -7,11 +7,6 @@ set -o pipefail # without errtrace functions don't inherit the ERR trap set -o errtrace -# set base images -export DOCKER_NVIDIA_DEVELOP_IMAGE="${DOCKER_NVIDIA_DEVELOP_IMAGE:-nvidia/cuda:10.1-devel}" -export DOCKER_NVIDIA_RUNTIME_IMAGE="${DOCKER_NVIDIA_RUNTIME_IMAGE:-nvidia/cuda:10.1-runtime}" -export DOCKER_BASE_IMAGE_VERSION_TAG="${DOCKER_BASE_IMAGE_VERSION_TAG:-0.2.1}" - # default libs version export DOCKER_LIBS_REPO="${DOCKER_LIBS_REPO:-https://github.com/deephealthproject/docker-libs.git}" export DOCKER_LIBS_BRANCH=${DOCKER_LIBS_BRANCH:-develop} @@ -99,8 +94,6 @@ function help() { * DOCKER_PASSWORD ENVIRONMENT defaults: - * DOCKER_NVIDIA_DEVELOP_IMAGE => nvidia/cuda:10.1-devel - * DOCKER_NVIDIA_RUNTIME_IMAGE => nvidia/cuda:10.1-runtime * DOCKER_BASE_IMAGE_VERSION_TAG => 0.2.0 * DOCKER_LIBS_REPO => https://github.com/deephealthproject/docker-libs.git * DOCKER_LIBS_BRANCH => develop @@ -156,7 +149,7 @@ function run() { REPOSITORY=$(basename $(git rev-parse --show-toplevel)) ; fi # set library name - LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-LIBS+LIBS+') + LIB_NAME=$(echo "${REPOSITORY}" | tr a-z A-Z | sed 's+DOCKER-LIBS+LIBS+; s+-+_+') # set git tag & branch & image prefix # and define whether to push lates tag @@ -177,15 +170,13 @@ function run() { # define Docker image tags export BUILD_NUMBER=${BUILD_NUMBER:-$(date '+%Y%m%d%H%M%S')} - export DOCKER_IMAGE_TAG="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" + #export DOCKER_IMAGE_TAG="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_PREFIX} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" # set revision export ${LIB_NAME}_REVISION=${REVISION} # set branch export ${LIB_NAME}_BRANCH=${BRANCH_NAME} - # set image build tag - export ${LIB_NAME}_IMAGE_VERSION_TAG=${DOCKER_IMAGE_TAG} # log environment printenv diff --git a/settings.conf b/settings.conf index 57a17f1..c11df6f 100644 --- a/settings.conf +++ b/settings.conf @@ -1,5 +1,5 @@ # set build target (CPU or GPU) -BUILD_TARGET=CPU +BUILD_TARGET=GPU # enable/disable suffix `-cpu` or `-gpu` ENABLE_TARGET_SUFFIX_IMAGE_TAG=false @@ -43,4 +43,4 @@ EDDL_REVISION=7467cb6 # PyEDDL repository PYEDDL_REPOSITORY=https://github.com/deephealthproject/pyeddl.git PYEDDL_BRANCH=master -PYEDDL_REVISION=0.6.0 +PYEDDL_REVISION=a55c3c4 From f69c644a65951c7319ad34c5876532f750eb66f3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Thu, 23 Apr 2020 20:56:23 +0000 Subject: [PATCH 186/200] Remove duplicate code --- pylibs/pylibs-base-toolkit.Dockerfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pylibs/pylibs-base-toolkit.Dockerfile b/pylibs/pylibs-base-toolkit.Dockerfile index 877aaa3..1e125bb 100644 --- a/pylibs/pylibs-base-toolkit.Dockerfile +++ b/pylibs/pylibs-base-toolkit.Dockerfile @@ -13,11 +13,4 @@ RUN \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && python3 -m pip install --upgrade --no-cache-dir \ - setuptools pip numpy pybind11 pytest \ - # link the cudart, cublas and curand libraries on "standard" system locations - && /bin/bash -c "if [[ "${BUILD_TARGET}" == "GPU" ]]; then \ - ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so /usr/lib/ \ - && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcurand.so /usr/lib/ \ - && ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcublas.so /usr/lib/ \ - && export EDDL_WITH_CUDA="true" ; \ - fi" + setuptools pip numpy pybind11 pytest From 431c816b76b4e948266fe17999b10f4346cae75c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 08:42:52 +0000 Subject: [PATCH 187/200] Fix PyEDDL tests --- tests/test_pyeddl.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/test_pyeddl.sh b/tests/test_pyeddl.sh index 46aceca..a43b4c7 100644 --- a/tests/test_pyeddl.sh +++ b/tests/test_pyeddl.sh @@ -7,7 +7,7 @@ set -e PYEDDL_SRC=${PYEDDL_SRC:-"/usr/local/src/pyeddl"} # run tests -cd ${PYEDDL_SRC} && pytest tests +cd ${PYEDDL_SRC} echo 'Downloading test dataset' wget -q https://www.dropbox.com/s/khrb3th2z6owd9t/trX.bin @@ -19,15 +19,14 @@ echo 'Running tests....' pytest tests # run examples -cd ${PYEDDL_SRC}/examples if [ -z "${GPU_RUNTIME}" ]; then echo 'Running CPU examples...' - python3 Tensor/array_tensor_save.py - python3 NN/1_MNIST/mnist_auto_encoder.py --epochs 1 + python3 examples/Tensor/array_tensor_save.py + python3 examples/NN/1_MNIST/mnist_auto_encoder.py --epochs 1 else echo "Running GPU examples..." - python3 Tensor/array_tensor_save.py - bash NN/1_MNIST/run_all_fast.sh - bash NN/py_loss_metric/run_all_fast.sh - bash onnx/run_all_fast.sh + python3 examples/Tensor/array_tensor_save.py + bash examples/NN/1_MNIST/run_all_fast.sh + bash examples/NN/py_loss_metric/run_all_fast.sh + bash examples/onnx/run_all_fast.sh fi \ No newline at end of file From a19d5339fadf28bb8bd08fd40d8ee20df36ab0c3 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 10:18:41 +0000 Subject: [PATCH 188/200] Ignore nonexistent files --- pylibs/pyecvl-toolkit.Dockerfile | 4 ++-- pylibs/pyeddl-toolkit.Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylibs/pyecvl-toolkit.Dockerfile b/pylibs/pyecvl-toolkit.Dockerfile index c306dc5..c6cf063 100644 --- a/pylibs/pyecvl-toolkit.Dockerfile +++ b/pylibs/pyecvl-toolkit.Dockerfile @@ -19,8 +19,8 @@ COPY ${pyecvl_src_origin} ${pyecvl_src_target} RUN \ cd ${pyecvl_src_target} \ && echo "\nLinking ecvl library..." >&2 \ - && rm -r third_party/ecvl \ - && rm -r third_party/pyeddl \ + && rm -rf third_party/ecvl \ + && rm -rf third_party/pyeddl \ && ln -s ${ecvl_src} third_party/ecvl \ && ln -s ${pyeddl_src_target} third_party/pyeddl \ && echo "\nInstalling pyecvl module..." >&2 \ diff --git a/pylibs/pyeddl-toolkit.Dockerfile b/pylibs/pyeddl-toolkit.Dockerfile index 8aa4f23..a709c34 100644 --- a/pylibs/pyeddl-toolkit.Dockerfile +++ b/pylibs/pyeddl-toolkit.Dockerfile @@ -25,7 +25,7 @@ RUN /bin/bash -c "if [[ \"${BUILD_TARGET}\" == \"GPU\" ]]; then \ fi" \ && cd ${pyeddl_src_target} \ && echo "\nLinking eddl library..." >&2 \ - && rm -r third_party/eddl \ + && rm -rf third_party/eddl \ && ln -s ${eddl_src} third_party/ \ && echo "\nInstalling pyeddl module..." >&2 \ && python3 setup.py install --record install.log \ From d42a435593de1635f8b679c1037e5297d3b4c7c7 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 10:50:45 +0000 Subject: [PATCH 189/200] Fix defaults --- jenkins.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jenkins.sh b/jenkins.sh index 21aacb5..8a580bd 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -170,11 +170,9 @@ function run() { # define Docker image tags export BUILD_NUMBER=${BUILD_NUMBER:-$(date '+%Y%m%d%H%M%S')} - #export DOCKER_IMAGE_TAG="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" - export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_PREFIX} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" + export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" + #export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_TAG_EXTRA} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" - # set revision - export ${LIB_NAME}_REVISION=${REVISION} # set branch export ${LIB_NAME}_BRANCH=${BRANCH_NAME} From aa9084f67e1eba6f101d9397a3e910c6629fd904 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 10:58:27 +0000 Subject: [PATCH 190/200] Remove redundant logs --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index fe3ed00..c51754b 100644 --- a/Makefile +++ b/Makefile @@ -576,7 +576,6 @@ _build_pyecvl_base_toolkit: build_ecvl_toolkit pyeddl_folder apply_pyeddl_patche --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base-toolkit:$(PYLIBS_BASE_IMAGE_VERSION_TAG)) - $(call log_image_revision,pyeddl-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},install,PYEDDL) build_pyeddl_toolkit: pyeddl_folder _build_pyeddl_base_toolkit apply_pyeddl_patches ## Build 'pyeddl-toolkit' image $(call build_image,pylibs,pyeddl-toolkit,${PYEDDL_IMAGE_VERSION_TAG},\ @@ -649,7 +648,6 @@ _build_pyecvl_base: build_ecvl --label PYEDDL_REPOSITORY=${PYEDDL_REPOSITORY} \ --label PYEDDL_BRANCH=${PYEDDL_BRANCH} \ --label PYEDDL_REVISION=${PYEDDL_REVISION},pylibs-base:$(PYLIBS_BASE_IMAGE_VERSION_TAG),pyeddl-toolkit:$(PYEDDL_IMAGE_VERSION_TAG)) - $(call log_image_revision,pyeddl,${PYLIBS_BASE_IMAGE_VERSION_TAG},install,PYEDDL) build_pyeddl: build_pyeddl_toolkit _build_pyeddl_base ## Build 'pyeddl' image $(call build_image,pylibs,pyeddl,${PYEDDL_IMAGE_VERSION_TAG},\ From 252ce2f363f4bab9a855c18708de565b4b9fe82b Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 17:04:37 +0000 Subject: [PATCH 191/200] Fix tag name --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c51754b..1451a2e 100644 --- a/Makefile +++ b/Makefile @@ -562,7 +562,7 @@ _build_pyeddl_base_toolkit: build_eddl_toolkit --label CONTAINER_VERSION=$(CONTAINER_VERSION),eddl-toolkit:$(EDDL_IMAGE_VERSION_TAG)) _build_pyecvl_base_toolkit: build_ecvl_toolkit pyeddl_folder apply_pyeddl_patches - $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-pyeddl_eddl_${PYEDDL_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) + $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-pyeddl_${PYEDDL_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) $(call build_image,pylibs,pylibs-base-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl-toolkit:$(ECVL_IMAGE_VERSION_TAG)) $(call build_image,pylibs,pyeddl-toolkit,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ From bce24ff145afc5c8fe2e850ac0dc1faad961551c Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 17:04:58 +0000 Subject: [PATCH 192/200] Fix missing dependency --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1451a2e..633e0db 100644 --- a/Makefile +++ b/Makefile @@ -633,7 +633,7 @@ _build_pyeddl_base: build_eddl $(call build_image,pylibs,pylibs-base,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),eddl:$(EDDL_IMAGE_VERSION_TAG)) -_build_pyecvl_base: build_ecvl +_build_pyecvl_base: build_ecvl build_pyeddl_toolkit $(eval PYLIBS_BASE_IMAGE_VERSION_TAG := base_${DOCKER_BASE_IMAGE_VERSION_TAG}-pyeddl_${PYEDDL_IMAGE_VERSION_TAG}-eddl_${EDDL_IMAGE_VERSION_TAG}-ecvl_${ECVL_IMAGE_VERSION_TAG}) $(call build_image,pylibs,pylibs-base,${PYLIBS_BASE_IMAGE_VERSION_TAG},\ --label CONTAINER_VERSION=$(CONTAINER_VERSION),ecvl:$(ECVL_IMAGE_VERSION_TAG)) From a00e4ad2acc28f38b8f4e99a1992d08791e550e5 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Fri, 24 Apr 2020 17:24:34 +0000 Subject: [PATCH 193/200] Ensure ldconfig after make install --- libs/ecvl-toolkit.Dockerfile | 3 ++- libs/eddl-toolkit.Dockerfile | 3 ++- libs/libs-base-toolkit.Dockerfile | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/ecvl-toolkit.Dockerfile b/libs/ecvl-toolkit.Dockerfile index 1c2ee3f..239a2be 100644 --- a/libs/ecvl-toolkit.Dockerfile +++ b/libs/ecvl-toolkit.Dockerfile @@ -31,4 +31,5 @@ RUN echo "\nBuilding ECVL library..." >&2 \ .. \ && make -j$(grep -c ^processor /proc/cpuinfo) \ && echo "\n Installing ECVL library..." >&2 \ - && make install + && make install \ + && ldconfig diff --git a/libs/eddl-toolkit.Dockerfile b/libs/eddl-toolkit.Dockerfile index cbf3da0..681a914 100644 --- a/libs/eddl-toolkit.Dockerfile +++ b/libs/eddl-toolkit.Dockerfile @@ -30,4 +30,5 @@ RUN echo "\nBuilding EDDL library..." >&2 \ .. \ && make -j$(grep -c ^processor /proc/cpuinfo) \ && echo "\n Installing EDDL library..." >&2 \ - && make install \ No newline at end of file + && make install \ + && ldconfig \ No newline at end of file diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 7bd999a..4daff9f 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -100,7 +100,6 @@ RUN \ && ./configure \ && make -j$(nproc) \ && make install \ - && ldconfig \ && rm -rf /tmp/protobuf-${protobuf_release} \ && echo "\n > Installing GTest library..." >&2 \ && apt-get install -y --no-install-recommends libgtest-dev \ @@ -110,4 +109,5 @@ RUN \ && cmake .. \ && make install \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* \ + && ldconfig From fd6941718ddde29f71cbf700cc06ec4a40ca0e87 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 10:39:49 +0000 Subject: [PATCH 194/200] Add support for multi-version tests --- Makefile | 20 +++-- ...865965bc4abe2e040deb7ce44b1f386f35a5c1.sh} | 0 ...b079b8dd624204bad3d902761e6b291e3f74fa.sh} | 0 tests/inventory.py | 86 +++++++++++++++++++ ...6da4abde1a8d6633310ea9f39b828c50369ecba.sh | 20 +++++ ...e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh} | 0 ...5c3c40414a2e751c3e2d392b7ae1ae201c5168.sh} | 2 +- 7 files changed, 119 insertions(+), 9 deletions(-) rename tests/{test_ecvl.sh => ecvl/3e865965bc4abe2e040deb7ce44b1f386f35a5c1.sh} (100%) rename tests/{test_eddl.sh => eddl/ddb079b8dd624204bad3d902761e6b291e3f74fa.sh} (100%) create mode 100644 tests/inventory.py create mode 100644 tests/pyecvl/36da4abde1a8d6633310ea9f39b828c50369ecba.sh rename tests/{test_pyecvl.sh => pyecvl/f0e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh} (100%) rename tests/{test_pyeddl.sh => pyeddl/a55c3c40414a2e751c3e2d392b7ae1ae201c5168.sh} (99%) diff --git a/Makefile b/Makefile index 633e0db..5e9afe0 100644 --- a/Makefile +++ b/Makefile @@ -752,51 +752,55 @@ test_eddl: eddl_folder ## Test 'eddl' images $(call set_library_revision,libs,eddl) @$(call test_image,\ eddl:${EDDL_IMAGE_VERSION_TAG},\ - tests/test_eddl.sh,\ + $(shell python3 tests/inventory.py ${EDDL_LIB_PATH} tests/eddl),\ eddl-toolkit:${EDDL_IMAGE_VERSION_TAG}=/usr/local/src/eddl \ ) test_eddl_toolkit: eddl_folder ## Test 'eddl' images $(call set_library_revision,libs,eddl) - @$(call test_image,eddl-toolkit:${EDDL_IMAGE_VERSION_TAG},tests/test_eddl.sh) + @$(call test_image,eddl-toolkit:${EDDL_IMAGE_VERSION_TAG},\ + $(shell python3 tests/inventory.py ${EDDL_LIB_PATH} tests/eddl)) test_ecvl: ecvl_folder ## Test 'ecvl' images $(call set_library_revision,libs,ecvl) @$(call test_image,\ ecvl:${ECVL_IMAGE_VERSION_TAG},\ - tests/test_ecvl.sh,\ + $(shell python3 tests/inventory.py ${ECVL_LIB_PATH} tests/ecvl),\ ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG}=/usr/local/src/ecvl \ ) test_ecvl_toolkit: ecvl_folder ## Test 'ecvl' images $(call set_library_revision,libs,ecvl) - @$(call test_image,ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG},tests/test_ecvl.sh) + @$(call test_image,ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG},\ + $(shell python3 tests/inventory.py ${ECVL_LIB_PATH} tests/ecvl)) test_pyeddl: pyeddl_folder ## Test 'ecvl' images $(call set_library_revision,pylibs,pyeddl) @$(call test_image,\ pyeddl:${PYEDDL_IMAGE_VERSION_TAG},\ - tests/test_pyeddl.sh,\ + $(shell python3 tests/inventory.py ${PYEDDL_LIB_PATH} tests/pyeddl),\ pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG}=/usr/local/src/pyeddl\ ) test_pyeddl_toolkit: pyeddl_folder ## Test 'ecvl' images $(call set_library_revision,pylibs,pyeddl) - @$(call test_image,pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},tests/test_pyeddl.sh) + @$(call test_image,pyeddl-toolkit:${PYEDDL_IMAGE_VERSION_TAG},\ + $(shell python3 tests/inventory.py ${PYEDDL_LIB_PATH} tests/pyeddl)) test_pyecvl: pyecvl_folder ## Test 'ecvl' images $(call set_library_revision,libs,ecvl) $(call set_library_revision,pylibs,pyecvl) @$(call test_image,\ pyecvl:${PYECVL_IMAGE_VERSION_TAG},\ - tests/test_pyecvl.sh,\ + $(shell python3 tests/inventory.py ${PYECVL_LIB_PATH} tests/pyecvl),\ 'ecvl-toolkit:${ECVL_IMAGE_VERSION_TAG}=/usr/local/src/ecvl' \ 'pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG}=/usr/local/src/pyecvl' \ ) test_pyecvl_toolkit: #pyecvl_folder ## Test 'ecvl' images $(call set_library_revision,pylibs,pyecvl) - @$(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},tests/test_pyecvl.sh) + @$(call test_image,pyecvl-toolkit:${PYECVL_IMAGE_VERSION_TAG},\ + $(shell python3 tests/inventory.py ${PYECVL_LIB_PATH} tests/pyecvl)) ############################################################################################################################ ### Push Docker images diff --git a/tests/test_ecvl.sh b/tests/ecvl/3e865965bc4abe2e040deb7ce44b1f386f35a5c1.sh similarity index 100% rename from tests/test_ecvl.sh rename to tests/ecvl/3e865965bc4abe2e040deb7ce44b1f386f35a5c1.sh diff --git a/tests/test_eddl.sh b/tests/eddl/ddb079b8dd624204bad3d902761e6b291e3f74fa.sh similarity index 100% rename from tests/test_eddl.sh rename to tests/eddl/ddb079b8dd624204bad3d902761e6b291e3f74fa.sh diff --git a/tests/inventory.py b/tests/inventory.py new file mode 100644 index 0000000..801993c --- /dev/null +++ b/tests/inventory.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +import os +import logging +import argparse +import subprocess +from glob import glob + +# Set script logger +_logger = logging.getLogger() + + +def get_repo_commits(repo_path): + if not os.path.exists(repo_path): + raise FileNotFoundError("The repository %s doesn't exist", repo_path) + cmd_result = subprocess.Popen("cd {} && git rev-list --all --reverse".format(repo_path), shell=True, + stdout=subprocess.PIPE) + subprocess_return = cmd_result.stdout.read() + repo_list = subprocess_return.decode("utf-8").split('\n') + _logger.debug(repo_list) + return repo_list + + +def get_current_repo_revision(repo_path): + if not os.path.exists(repo_path): + raise FileNotFoundError("The repository %s doesn't exist", repo_path) + cmd_result = subprocess.Popen("cd {} && git rev-parse HEAD".format(repo_path), shell=True, stdout=subprocess.PIPE) + subprocess_return = cmd_result.stdout.read() + repo_list = subprocess_return.decode("utf-8").strip() + _logger.debug(repo_list) + return repo_list + + +def get_test_revisions(tests_path=".", order_by=None): + revisions = {os.path.basename(v).split(".")[0]: v \ + for v in glob(os.path.join(tests_path, "*.sh"))} + return revisions if not order_by else \ + [rev for x in order_by for rev in revisions.items() if rev[0] == x] + + +def find_test_revision(repo_path=".", tests_path="."): + found_revision = None + + commits = get_repo_commits(repo_path) + current_revision = get_current_repo_revision(repo_path) + test_revision_order = commits.copy() + test_revision_order.reverse() + test_revisions = get_test_revisions(tests_path, test_revision_order) + + _logger.debug("List of commits %r", commits) + _logger.debug("Current revision %r", current_revision) + _logger.debug("Test revisions %r", test_revisions) + + remaining_revisions = test_revisions + while len(remaining_revisions) > 0: + found_revision = remaining_revisions.pop() + _logger.debug("Current found %r", found_revision) + _logger.debug("Remaining revisions: %r", len(remaining_revisions)) + + if len(remaining_revisions) == 0 \ + or commits.index(current_revision) < commits.index(found_revision[0]): + break + _logger.debug("indexes %d %d", commits.index(found_revision[0]), commits.index(remaining_revisions[-1][0])) + current_slice = [commits[x] \ + for x in range(commits.index(found_revision[0]), \ + commits.index(remaining_revisions[-1][0]))] + if current_revision in current_slice: + break + return found_revision + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('repo_path', metavar='REPO_PATH', type=str, help='Path of the git repository') + parser.add_argument('test_revisions_path', metavar='TEST_REVISIONS_PATH', type=str, + help='Path containing revisions of a test') + parser.add_argument('--debug', action='store_true', help='Enable debug') + args = parser.parse_args() + logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO) + found_test_revision = find_test_revision(args.repo_path, args.test_revisions_path) + _logger.debug(found_test_revision) + if found_test_revision: + print(found_test_revision[1]) + + +if __name__ == "__main__": + main() diff --git a/tests/pyecvl/36da4abde1a8d6633310ea9f39b828c50369ecba.sh b/tests/pyecvl/36da4abde1a8d6633310ea9f39b828c50369ecba.sh new file mode 100644 index 0000000..fe448c1 --- /dev/null +++ b/tests/pyecvl/36da4abde1a8d6633310ea9f39b828c50369ecba.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# exit on error +set -e + +# set the path containing sources and tests +ECVL_SRC=${ECVL_SRC:-"/usr/local/src/ecvl"} +PYECVL_SRC=${PYECVL_SRC:-"/usr/local/src/pyecvl"} + +# run tests +cd ${PYECVL_SRC} && pytest tests + +# run examples +cd ${PYECVL_SRC}/examples +python3 dataset.py "${ECVL_SRC}/examples/data/mnist/mnist.yml" +python3 ecvl_eddl.py "${ECVL_SRC}/examples/data/test.jpg" "${ECVL_SRC}/examples/data/mnist/mnist.yml" +python3 img_format.py "${ECVL_SRC}/examples/data/nifti/LR_nifti.nii" "${ECVL_SRC}/examples/data/dicom/ISIC_0000008.dcm" +python3 imgproc.py "${ECVL_SRC}/examples/data/test.jpg" +python3 openslide.py "${ECVL_SRC}/examples/data/hamamatsu/test3-DAPI 2 (387).ndpi" +python3 read_write.py "${ECVL_SRC}/examples/data/test.jpg" "test_mod.jpg" \ No newline at end of file diff --git a/tests/test_pyecvl.sh b/tests/pyecvl/f0e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh similarity index 100% rename from tests/test_pyecvl.sh rename to tests/pyecvl/f0e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh diff --git a/tests/test_pyeddl.sh b/tests/pyeddl/a55c3c40414a2e751c3e2d392b7ae1ae201c5168.sh similarity index 99% rename from tests/test_pyeddl.sh rename to tests/pyeddl/a55c3c40414a2e751c3e2d392b7ae1ae201c5168.sh index a43b4c7..dc76468 100644 --- a/tests/test_pyeddl.sh +++ b/tests/pyeddl/a55c3c40414a2e751c3e2d392b7ae1ae201c5168.sh @@ -29,4 +29,4 @@ else bash examples/NN/1_MNIST/run_all_fast.sh bash examples/NN/py_loss_metric/run_all_fast.sh bash examples/onnx/run_all_fast.sh -fi \ No newline at end of file +fi From f24d6441b9b50a1434797f06dbf766011a904c4a Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 12:13:58 +0000 Subject: [PATCH 195/200] Add maintainer label --- libs/libs-base-toolkit.Dockerfile | 3 ++- libs/libs-base.Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/libs-base-toolkit.Dockerfile b/libs/libs-base-toolkit.Dockerfile index 4daff9f..0eeeaf6 100644 --- a/libs/libs-base-toolkit.Dockerfile +++ b/libs/libs-base-toolkit.Dockerfile @@ -4,7 +4,8 @@ FROM ${BASE_IMAGE} as libs.base-toolkit # set metadata LABEL website="https://github.com/deephealthproject/" \ description="DeepHealth European Distributed Deep Learning Library" \ - software="deephealth-eddl,deephealth-ecvl" + software="deephealth-eddl,deephealth-ecvl" \ + maintainer="marcoenrico.piras@crs4.it" # set cmake version ARG cmake_release="3.14.6" diff --git a/libs/libs-base.Dockerfile b/libs/libs-base.Dockerfile index 4d7dd55..521e8ce 100644 --- a/libs/libs-base.Dockerfile +++ b/libs/libs-base.Dockerfile @@ -37,7 +37,8 @@ FROM ${BASE_IMAGE} AS base LABEL website="https://github.com/deephealthproject" \ description="DeepHealth European Distributed Deep Learning Library" \ - software="deephealth-eddl,deephealth-ecvl" + software="deephealth-eddl,deephealth-ecvl" \ + maintainer="marcoenrico.piras@crs4.it" # set build target ARG BUILD_TARGET From 684efee59daf586878326e575233c93aaea04899 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 14:09:01 +0000 Subject: [PATCH 196/200] Update PyECVL version --- settings.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.conf b/settings.conf index c11df6f..ae6a937 100644 --- a/settings.conf +++ b/settings.conf @@ -28,12 +28,12 @@ DOCKER_LOGIN_DONE=true # ECVL repository ECVL_REPOSITORY=https://github.com/deephealthproject/ecvl.git ECVL_BRANCH=master -ECVL_REVISION=627c803 +ECVL_REVISION=e873315 # PyECVL PYECVL_REPOSITORY=https://github.com/deephealthproject/pyecvl.git PYECVL_BRANCH=master -PYECVL_REVISION=56f9de5 +PYECVL_REVISION=8effe45 # EDDL repository EDDL_REPOSITORY=https://github.com/deephealthproject/eddl.git From 9b3bffbf47e09da48de8e3d3489b9b1b9b7b5bc4 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 14:13:49 +0000 Subject: [PATCH 197/200] Update version number --- jenkins.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins.sh b/jenkins.sh index 8a580bd..538ddab 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -22,7 +22,7 @@ DOCKER_PASSWORD=${DOCKER_PASSWORD:-} GIT_URL=${GIT_URL:-} # set script version -VERSION=0.2.1 +VERSION=0.3.0 function abspath() { local path="${*}" From aaa1f3a5588f556351b8ed3b6316a56e6b357092 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 14:14:28 +0000 Subject: [PATCH 198/200] Disable alias '_build' --- jenkins.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins.sh b/jenkins.sh index 538ddab..b7a63ec 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -170,7 +170,7 @@ function run() { # define Docker image tags export BUILD_NUMBER=${BUILD_NUMBER:-$(date '+%Y%m%d%H%M%S')} - export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" + #export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_PREFIX}_build${BUILD_NUMBER}" #export DOCKER_IMAGE_TAG_EXTRA="${DOCKER_IMAGE_TAG_EXTRA} ${NORMALIZED_BRANCH_NAME}_build${BUILD_NUMBER}" # set branch From fda100a133dcfeddec7ca0e312fc2d45aeb26288 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 22:18:49 +0000 Subject: [PATCH 199/200] Rename test --- ...a31c35d7fc8.sh => 8effe452abc060e8a748c1cde54d8e03c2b7580b.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/pyecvl/{f0e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh => 8effe452abc060e8a748c1cde54d8e03c2b7580b.sh} (100%) diff --git a/tests/pyecvl/f0e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh b/tests/pyecvl/8effe452abc060e8a748c1cde54d8e03c2b7580b.sh similarity index 100% rename from tests/pyecvl/f0e351acc62aaa915c09d390bc5e8a31c35d7fc8.sh rename to tests/pyecvl/8effe452abc060e8a748c1cde54d8e03c2b7580b.sh From e3c2b7a739fdf539a530454200124a922021bef4 Mon Sep 17 00:00:00 2001 From: Marco Enrico Piras Date: Mon, 27 Apr 2020 22:21:12 +0000 Subject: [PATCH 200/200] Fix test inventory --- tests/inventory.py | 47 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/tests/inventory.py b/tests/inventory.py index 801993c..c44b9e5 100644 --- a/tests/inventory.py +++ b/tests/inventory.py @@ -30,42 +30,31 @@ def get_current_repo_revision(repo_path): return repo_list -def get_test_revisions(tests_path=".", order_by=None): - revisions = {os.path.basename(v).split(".")[0]: v \ - for v in glob(os.path.join(tests_path, "*.sh"))} - return revisions if not order_by else \ - [rev for x in order_by for rev in revisions.items() if rev[0] == x] +def get_test_revisions(tests_path=".", commits=None, reverse=False): + revisions = sorted([(os.path.basename(v).split(".")[0],v) \ + for v in glob(os.path.join(tests_path, "*.sh"))], \ + key=lambda x: commits.index(x[0]), reverse=reverse) + _logger.debug("revisions %r", revisions) + return revisions def find_test_revision(repo_path=".", tests_path="."): found_revision = None - commits = get_repo_commits(repo_path) current_revision = get_current_repo_revision(repo_path) - test_revision_order = commits.copy() - test_revision_order.reverse() - test_revisions = get_test_revisions(tests_path, test_revision_order) - - _logger.debug("List of commits %r", commits) - _logger.debug("Current revision %r", current_revision) - _logger.debug("Test revisions %r", test_revisions) - - remaining_revisions = test_revisions - while len(remaining_revisions) > 0: - found_revision = remaining_revisions.pop() - _logger.debug("Current found %r", found_revision) - _logger.debug("Remaining revisions: %r", len(remaining_revisions)) - - if len(remaining_revisions) == 0 \ - or commits.index(current_revision) < commits.index(found_revision[0]): - break - _logger.debug("indexes %d %d", commits.index(found_revision[0]), commits.index(remaining_revisions[-1][0])) - current_slice = [commits[x] \ - for x in range(commits.index(found_revision[0]), \ - commits.index(remaining_revisions[-1][0]))] - if current_revision in current_slice: + test_revisions = get_test_revisions(tests_path, commits, reverse=True) + if len(test_revisions) == 0: + return None + current_candidate = test_revisions.pop() + while (len(test_revisions)>0): + next_candidate = test_revisions.pop() + if commits.index(current_revision) < commits.index(current_candidate[0]) \ + or commits.index(current_revision) >= commits.index(current_candidate[0]) \ + and commits.index(current_revision) < commits.index(next_candidate[0]): break - return found_revision + else: + current_candidate = next_candidate + return current_candidate def main():