From 6f945bd0901107a54ac5b846d601b7d63791b417 Mon Sep 17 00:00:00 2001 From: Semen Medvedev Date: Wed, 14 Aug 2019 16:32:53 +0700 Subject: [PATCH] Enable publish image for version tags --- .buildkite/pipeline.yml | 2 +- .buildkite/steps/build-image.sh | 5 ++++- Docker/Dockerfile | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 1c79025..5b12261 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -7,7 +7,7 @@ steps: - label: ":floppy_disk: upload image" command: ".buildkite/steps/publish-image.sh" - branches: "master alfa develop ci-*" + branches: "master alfa develop ci-* v*.*.*" timeout: 20 - wait diff --git a/.buildkite/steps/build-image.sh b/.buildkite/steps/build-image.sh index c0b8ea8..8ae4618 100755 --- a/.buildkite/steps/build-image.sh +++ b/.buildkite/steps/build-image.sh @@ -6,6 +6,9 @@ IMAGETAG=${BUILDKITE_BRANCH:-master} BRANCHNAME=${BUILDKITE_BRANCH:-master} COMPILETYPE=RelWithDebInfo +TAGREF=${BUILDKITE_TAG:+"tags/$BUILDKITE_TAG"} +REF=${TAGREF:-"heads/$BUILDKITE_BRANCH"} + if [[ "${IMAGETAG}" == "master" ]]; then BUILDTYPE="stable" COMPILETYPE=Release @@ -16,4 +19,4 @@ else fi cd Docker -docker build -t cyberway/cyberway-notifier:${IMAGETAG} --build-arg=branch=${BRANCHNAME} --build-arg buildtype=${BUILDTYPE} --build-arg compiletype=${COMPILETYPE} . +docker build -t cyberway/cyberway-notifier:${IMAGETAG} --build-arg=branch=${BRANCHNAME} --build-arg buildtype=${BUILDTYPE} --build-arg compiletype=${COMPILETYPE} --build-arg ref=${REF}. diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 36cc46b..d152611 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -3,6 +3,7 @@ FROM cyberway/builder:$buildtype as builder ARG branch=master ARG compiletype=RelWithDebInfo +ARG ref=heads/$branch RUN cd /opt && wget https://github.com/nats-io/cnats/archive/v1.8.0.tar.gz && tar -xzf v1.8.0.tar.gz \ && ln -s /opt/nats.c-1.8.0 /opt/nats.c \ @@ -10,7 +11,7 @@ RUN cd /opt && wget https://github.com/nats-io/cnats/archive/v1.8.0.tar.gz && ta RUN echo "/opt/cnats-1.8.0/pbuf/lib/linux/" > /etc/ld.so.conf.d/protobuf-c.conf && ldconfig -ADD https://api.github.com/repos/cyberway/cyberway.notifier/git/refs/heads/$branch /etc/version.json +ADD https://api.github.com/repos/cyberway/cyberway.notifier/git/refs/$ref /etc/version.json RUN cd /opt && git clone -b $branch https://github.com/cyberway/cyberway.notifier.git --recursive