Skip to content

Commit 45ac0e2

Browse files
imjoeynic-chen
andauthored
fix: the git commit hash in the docker is empty string (apache#1446) (apache#1454)
Co-authored-by: nic-chen <[email protected]>
1 parent 37492e4 commit 45ac0e2

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ FROM alpine:latest as pre-build
1919
ARG APISIX_DASHBOARD_VERSION=master
2020

2121
RUN set -x \
22-
&& wget https://github.com/apache/apisix-dashboard/archive/${APISIX_DASHBOARD_VERSION}.tar.gz -O /tmp/apisix-dashboard.tar.gz \
23-
&& mkdir /usr/local/apisix-dashboard \
24-
&& tar -xvf /tmp/apisix-dashboard.tar.gz -C /usr/local/apisix-dashboard --strip 1
22+
&& apk add --no-cache --virtual .builddeps git \
23+
&& git clone https://github.com/apache/apisix-dashboard.git -b ${APISIX_DASHBOARD_VERSION} /usr/local/apisix-dashboard \
24+
&& cd /usr/local/apisix-dashboard && git clean -Xdf \
25+
&& rm -f ./.githash && git log --pretty=format:"%h" -1 > ./.githash
2526

2627
FROM golang:1.14 as api-builder
2728

api/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
master
1+
2.3

api/test/shell/manager_smoking.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ else
5252
echo "no Version output"
5353
exit 1
5454
fi
55+
# Version output
56+
hashline=$(docker logs docker-deploy_managerapi_1 | grep -E "^GitHash : [A-Za-z0-9\-\_\.]+")
57+
if [ -z "$hashline" ];then
58+
echo "no GitHash output"
59+
exit 1
60+
fi
5561
fi
5662

5763

0 commit comments

Comments
 (0)