diff --git a/.buildkite/scripts/Dockerfile-testval-amd64 b/.buildkite/scripts/Dockerfile-testval-amd64 index 75d3f6072..12f6bffe4 100644 --- a/.buildkite/scripts/Dockerfile-testval-amd64 +++ b/.buildkite/scripts/Dockerfile-testval-amd64 @@ -1,5 +1,7 @@ FROM erlang:23.3.4.4-alpine as builder +ARG version + RUN apk add --no-cache --update \ git tar build-base linux-headers autoconf automake libtool pkgconfig \ dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \ @@ -19,7 +21,7 @@ ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \ # Add our code ADD . /usr/src/miner/ -RUN ./rebar3 as docker_testval tar +RUN ./rebar3 as docker_testval tar -n miner -v ${version} RUN mkdir -p /opt/docker/update RUN tar -zxvf _build/docker_testval/rel/*/*.tar.gz -C /opt/docker diff --git a/.buildkite/scripts/Dockerfile-testval-arm64 b/.buildkite/scripts/Dockerfile-testval-arm64 index 7f7808d02..55119d671 100644 --- a/.buildkite/scripts/Dockerfile-testval-arm64 +++ b/.buildkite/scripts/Dockerfile-testval-arm64 @@ -1,5 +1,7 @@ FROM arm64v8/erlang:23.3.4.4-alpine as builder +ARG version + RUN apk add --no-cache --update \ git tar build-base linux-headers autoconf automake libtool pkgconfig \ dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \ @@ -19,7 +21,7 @@ ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \ # Add our code ADD . /usr/src/miner/ -RUN ./rebar3 as docker_testval tar +RUN ./rebar3 as docker_testval tar -n miner -v ${version} RUN mkdir -p /opt/docker/update RUN tar -zxvf _build/docker_testval/rel/*/*.tar.gz -C /opt/docker diff --git a/.buildkite/scripts/Dockerfile-val-amd64 b/.buildkite/scripts/Dockerfile-val-amd64 index 97e938ac5..84197bcd2 100644 --- a/.buildkite/scripts/Dockerfile-val-amd64 +++ b/.buildkite/scripts/Dockerfile-val-amd64 @@ -1,5 +1,7 @@ FROM erlang:23.3.4.4-alpine as builder +ARG version + RUN apk add --no-cache --update \ git tar build-base linux-headers autoconf automake libtool pkgconfig \ dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \ @@ -19,7 +21,7 @@ ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \ # Add our code ADD . /usr/src/miner/ -RUN ./rebar3 as docker_val tar +RUN ./rebar3 as docker_val tar -n miner -v ${version} RUN mkdir -p /opt/docker/update RUN tar -zxvf _build/docker_val/rel/*/*.tar.gz -C /opt/docker diff --git a/.buildkite/scripts/Dockerfile-val-arm64 b/.buildkite/scripts/Dockerfile-val-arm64 index 7da835cbf..4fb70f3df 100644 --- a/.buildkite/scripts/Dockerfile-val-arm64 +++ b/.buildkite/scripts/Dockerfile-val-arm64 @@ -1,5 +1,7 @@ FROM arm64v8/erlang:23.3.4.4-alpine as builder +ARG version + RUN apk add --no-cache --update \ git tar build-base linux-headers autoconf automake libtool pkgconfig \ dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \ @@ -19,7 +21,7 @@ ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \ # Add our code ADD . /usr/src/miner/ -RUN ./rebar3 as docker_val tar +RUN ./rebar3 as docker_val tar -n miner -v ${version} RUN mkdir -p /opt/docker/update RUN tar -zxvf _build/docker_val/rel/*/*.tar.gz -C /opt/docker diff --git a/.buildkite/scripts/make_testval_image.sh b/.buildkite/scripts/make_testval_image.sh index cbf7317cd..af4238089 100755 --- a/.buildkite/scripts/make_testval_image.sh +++ b/.buildkite/scripts/make_testval_image.sh @@ -11,8 +11,10 @@ MINER_REGISTRY_NAME="$REGISTRY_HOST/team-helium/$REGISTRY_NAME" DOCKER_NAME="$(basename $(pwd))-${IMAGE_ARCH}_testnet_${BUILDKITE_TAG}" DOCKERFILE_NAME=".buildkite/scripts/Dockerfile-testval-${IMAGE_ARCH}" +VERSION=$(git describe --abbrev=0 | sed -e 's,val,,') + docker login -u="team-helium+buildkite" -p="${QUAY_BUILDKITE_PASSWORD}" ${REGISTRY_HOST} -docker build -t helium:$DOCKER_NAME -f "${DOCKERFILE_NAME}" . +docker build --build-arg version=$VERSION -t helium:$DOCKER_NAME -f "${DOCKERFILE_NAME}" . docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:$DOCKER_NAME" docker push "$MINER_REGISTRY_NAME:$DOCKER_NAME" docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:latest-val-${IMAGE_ARCH}" diff --git a/.buildkite/scripts/make_val_image.sh b/.buildkite/scripts/make_val_image.sh index 3c3193e34..260c06aad 100755 --- a/.buildkite/scripts/make_val_image.sh +++ b/.buildkite/scripts/make_val_image.sh @@ -11,9 +11,9 @@ MINER_REGISTRY_NAME="$REGISTRY_HOST/team-helium/$REGISTRY_NAME" DOCKER_NAME="$(basename $(pwd))-${IMAGE_ARCH}_${BUILDKITE_TAG}" DOCKERFILE_NAME=".buildkite/scripts/Dockerfile-val-${IMAGE_ARCH}" +VERSION=$(git describe --abbrev=0 | sed -e 's,validator,,') + docker login -u="team-helium+buildkite" -p="${QUAY_BUILDKITE_PASSWORD}" ${REGISTRY_HOST} -docker build -t helium:$DOCKER_NAME -f "${DOCKERFILE_NAME}" . +docker build --build-arg version=$VERSION -t helium:$DOCKER_NAME -f "${DOCKERFILE_NAME}" . docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:$DOCKER_NAME" docker push "$MINER_REGISTRY_NAME:$DOCKER_NAME" -# docker tag helium:$DOCKER_NAME "$MINER_REGISTRY_NAME:latest-validator-${IMAGE_ARCH}" -# docker push "$MINER_REGISTRY_NAME:latest-validator-${IMAGE_ARCH}" diff --git a/Makefile b/Makefile index 616a2e282..346dcb2e6 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .PHONY: deps compile test typecheck cover REBAR=./rebar3 +VAL_VERSION=$(shell git describe --abbrev=0 | sed -e 's,validator,,') ifeq ($(BUILDKITE), true) # get branch name and replace any forward slashes it may contain CIBRANCH=$(subst /,-,$(BUILDKITE_BRANCH)) @@ -31,6 +32,9 @@ ci: compile release: $(REBAR) as prod release -n miner +validator: + $(REBAR) as validator release -n miner -v $(VAL_VERSION) + cover: $(REBAR) cover