This repository was archived by the owner on Nov 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +27
-12
lines changed
Expand file tree Collapse file tree 6 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ if [[ ! -f "$BASE/linux/Dockerfile.package-$1" ]]; then
1212 exit 1
1313fi
1414
15- docker image build --build-arg SEABOLT_VERSION=$SEABOLT_VERSION -t seabolt-package -f $BASE /linux/Dockerfile.package-$1 $BASE /..
15+ GIT_HASH=$( git log -1 --pretty=format:%h $BASE 2> /dev/null || echo " unknown" )
16+
17+ docker image build --build-arg SEABOLT_VERSION=$SEABOLT_VERSION --build-arg SEABOLT_VERSION_HASH=$GIT_HASH -t seabolt-package -f $BASE /linux/Dockerfile.package-$1 $BASE /..
1618if [[ " $? " -ne " 0" ]]; then
1719 echo " FATAL: docker image build failed, possible compilation failure."
1820 exit 1
Original file line number Diff line number Diff line change 11FROM alpine:3.8
22RUN apk add --no-cache ca-certificates cmake make g++ openssl-dev git
33ARG SEABOLT_VERSION
4+ ARG SEABOLT_VERSION_HASH
45ENV SEABOLT_VERSION=$SEABOLT_VERSION
6+ ENV SEABOLT_VERSION_HASH=$SEABOLT_VERSION_HASH
57ADD . /tmp/seabolt
68WORKDIR /tmp/seabolt/build-docker
79RUN cmake -D CMAKE_BUILD_TYPE=Release /tmp/seabolt \
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ RUN yum -y install openssl-devel openssl-static wget pkg-config ca-certificates
33 && (mkdir -p /cmake && wget --no-verbose --output-document=- https://cmake.org/files/v3.12/cmake-3.12.3-Linux-x86_64.tar.gz | tar xvz -C /cmake --strip 1) \
44 && yum -y clean all
55ARG SEABOLT_VERSION
6+ ARG SEABOLT_VERSION_HASH
67ENV SEABOLT_VERSION=$SEABOLT_VERSION
8+ ENV SEABOLT_VERSION_HASH=$SEABOLT_VERSION_HASH
79ADD . /tmp/seabolt
810WORKDIR /tmp/seabolt/build-docker
911RUN /cmake/bin/cmake -D CMAKE_BUILD_TYPE=Release /tmp/seabolt \
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ RUN apt-get update \
44 && (mkdir -p /cmake && wget --no-verbose --output-document=- https://cmake.org/files/v3.12/cmake-3.12.3-Linux-x86_64.tar.gz | tar xvz -C /cmake --strip 1) \
55 && rm -rf /var/lib/apt/lists/*
66ARG SEABOLT_VERSION
7+ ARG SEABOLT_VERSION_HASH
78ENV SEABOLT_VERSION=$SEABOLT_VERSION
9+ ENV SEABOLT_VERSION_HASH=$SEABOLT_VERSION_HASH
810ADD . /tmp/seabolt
911WORKDIR /tmp/seabolt/build-docker
1012RUN /cmake/bin/cmake -D CMAKE_BUILD_TYPE=Release /tmp/seabolt \
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ RUN apt-get update \
44 && (mkdir -p /cmake && wget --no-verbose --output-document=- https://cmake.org/files/v3.12/cmake-3.12.3-Linux-x86_64.tar.gz | tar xvz -C /cmake --strip 1) \
55 && rm -rf /var/lib/apt/lists/*
66ARG SEABOLT_VERSION
7+ ARG SEABOLT_VERSION_HASH
78ENV SEABOLT_VERSION=$SEABOLT_VERSION
9+ ENV SEABOLT_VERSION_HASH=$SEABOLT_VERSION_HASH
810ADD . /tmp/seabolt
911WORKDIR /tmp/seabolt/build-docker
1012RUN /cmake/bin/cmake -D CMAKE_BUILD_TYPE=Release /tmp/seabolt \
Original file line number Diff line number Diff line change 11# in case Git is not available, we default to "unknown"
22set (VERSION_HASH "unknown" )
33
4- # find Git and if available set GIT_HASH variable
5- find_package (Git QUIET )
6- if (GIT_FOUND)
7- execute_process (
8- COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%h
9- OUTPUT_VARIABLE VERSION_HASH
10- OUTPUT_STRIP_TRAILING_WHITESPACE
11- ERROR_QUIET
12- )
13- endif ()
4+ if (DEFINED ENV{SEABOLT_VERSION_HASH})
5+ set (VERSION_HASH $ENV{SEABOLT_VERSION_HASH} )
6+ message (STATUS "Using Git hash from environment: ${VERSION_HASH} " )
7+ else ()
8+ # find Git and if available set GIT_HASH variable
9+ find_package (Git QUIET )
10+ if (GIT_FOUND)
11+ execute_process (
12+ COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%h
13+ OUTPUT_VARIABLE VERSION_HASH
14+ OUTPUT_STRIP_TRAILING_WHITESPACE
15+ ERROR_QUIET
16+ )
17+ endif ()
1418
15- message (STATUS "Git hash is ${VERSION_HASH} " )
19+ message (STATUS "Using Git hash from git command: ${VERSION_HASH} " )
20+ endif ()
1621
1722# generate file version.hpp based on version.hpp.in
1823configure_file (
You can’t perform that action at this time.
0 commit comments