Selaa lähdekoodia

HPCC-23586 Speed up incremental container builds

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 vuotta sitten
vanhempi
commit
6e2dc55533
2 muutettua tiedostoa jossa 28 lisäystä ja 26 poistoa
  1. 26 24
      dockerfiles/incr.sh
  2. 2 2
      dockerfiles/platform-build-incremental/Dockerfile

+ 26 - 24
dockerfiles/incr.sh

@@ -32,30 +32,32 @@ BUILD_TYPE=Debug
 BUILD_LABEL=${HEAD}-Debug
 GITHUB_USER=$(git remote get-url origin | sed s/.*:// | sed s+/.*++)
 
-if [[ "$HEAD" == "$PREV$FORCE" ]]  # set environment variable FORCE before running to override this check
-then
+if [[ "$BUILD_LABEL" == "$PREV" ]] ; then
     echo Docker image hpccsystems/platform-core:${HEAD} already exists
-else
-    set -e
-    
-    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-    pushd $DIR 2>&1 > /dev/null
-    
-    echo Building local incremental images based on ${PREV}
-        
-    if [[ -n "$FORCE" ]] ; then
-      docker image build -t hpccsystems/platform-build:${BUILD_LABEL} --build-arg PREV_LABEL=${HEAD}-Debug --build-arg BASE_VER=7.8 --build-arg BUILD_TYPE=Debug platform-build/
-    else
-      docker image build -t hpccsystems/platform-build:${BUILD_LABEL} --build-arg PREV_LABEL=${PREV} --build-arg COMMIT=${HEAD} --build-arg USER=${GITHUB_USER} platform-build-incremental/
-    fi
-    docker image build -t hpccsystems/platform-core:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} platform-core-debug/  
-    
-    docker image build -t hpccsystems/roxie:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} roxie/  
-    docker image build -t hpccsystems/dali:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} dali/  
-    docker image build -t hpccsystems/esp:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} esp/  
-    docker image build -t hpccsystems/eclccserver:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} eclccserver/  
-    docker image build -t hpccsystems/eclagent:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} eclagent/  
-    docker image build -t hpccsystems/toposerver:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} toposerver/  
+    PREV=$(git log --format=format:%h-Debug $(git describe --abbrev=0 --tags)..HEAD | grep `docker images hpccsystems/platform-build --format {{.Tag}} | head -n 2 | tail -n 1`)
+    [[ -z ${PREV} ]] && PREV=$(git describe --abbrev=0 --tags)-Debug
+fi
+
+set -e
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+pushd $DIR 2>&1 > /dev/null
+
+echo Building local incremental images based on ${PREV}
     
-    echo Built hpccsystems/*:${BUILD_LABEL}
+if [[ -n "$FORCE" ]] ; then
+  docker image build -t hpccsystems/platform-build:${BUILD_LABEL} --build-arg PREV_LABEL=${HEAD}-Debug --build-arg BASE_VER=7.8 --build-arg BUILD_TYPE=Debug platform-build/
+else
+  docker image build -t hpccsystems/platform-build:${BUILD_LABEL} --build-arg PREV_LABEL=${PREV} --build-arg COMMIT=${HEAD} --build-arg USER=${GITHUB_USER} platform-build-incremental/
 fi
+docker image build -t hpccsystems/platform-core:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} platform-core-debug/  
+
+docker image build -t hpccsystems/roxie:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} roxie/  
+docker image build -t hpccsystems/dali:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} dali/  
+docker image build -t hpccsystems/esp:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} esp/  
+docker image build -t hpccsystems/eclccserver:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} eclccserver/  
+docker image build -t hpccsystems/eclagent:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} eclagent/  
+docker image build -t hpccsystems/toposerver:${BUILD_LABEL} --build-arg BUILD_LABEL=${BUILD_LABEL} toposerver/  
+
+echo Built hpccsystems/*:${BUILD_LABEL}
+

+ 2 - 2
dockerfiles/platform-build-incremental/Dockerfile

@@ -28,7 +28,7 @@ RUN if ! git config remote.${USER}.url > /dev/null ; then git remote add ${USER}
 
 ARG COMMIT
 
-RUN git fetch ${USER} && git checkout ${COMMIT} 
+RUN git fetch ${USER} && git checkout ${COMMIT} && git submodule update --init --recursive
+
 WORKDIR /hpcc-dev/build
-RUN cmake /hpcc-dev/HPCC-Platform -Wno-dev -DCONTAINERIZED=1 -DCMAKE_BUILD_TYPE=Debug
 RUN make -j$(($(nproc)*3/2)) install