Skip to content

Commit a8af71a

Browse files
committed
Fix docker image tag (remove invalid chars)
1 parent 4e5ae71 commit a8af71a

2 files changed

Lines changed: 16 additions & 24 deletions

File tree

.drone-github.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,25 @@ steps:
249249
DOCKER_HOST: unix:///run/docker.sock
250250
DOCKER_CONFIG_JSON:
251251
from_secret: dockerconfig
252-
# shell: /bin/bash
253252
commands:
254-
- find cmd -name "*-linux-amd64" -print | while read -r binary ; do cp -a "$$binary" "$${binary//-linux-amd64/}" ; done
255-
- make docker
253+
- mkdir -p docker/bin
254+
- find cmd -maxdepth 1 -and -not -name cmd | sed -e 's#^cmd/##' | while read -r app ; do
255+
cp -a "cmd/$$app/$$app-linux-amd64" "docker/bin/$$app" || exit 1 ;
256+
done
257+
- tmptag="$$(openssl rand -hex 10)"
258+
- docker build -t "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag" docker/
259+
- rm -rf docker/bin
256260
- mkdir -p "$$HOME/.docker" ; echo "$$DOCKER_CONFIG_JSON" >"$$HOME/.docker/config.json" ; unset DOCKER_CONFIG_JSON
257-
- tag="$$(bash -c 'source script/build.sh && set_version && echo "$$version"')"
258-
- docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$tag"
261+
- if test -n "$$DRONE_TAG" ; then
262+
docker tag "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag" "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_TAG" ;
263+
docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_TAG" ;
264+
fi
259265
- if test -n "$$DRONE_BRANCH" ; then
260-
docker tag "docker.pkg.github.com/vegaprotocol/vega/vega:$$tag" "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_BRANCH" ;
261-
docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_BRANCH" ;
266+
sanitised_branch="$$(echo -n "$$DRONE_BRANCH" | tr -c 'A-Za-z0-9._' '-')"
267+
docker tag "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag" "docker.pkg.github.com/vegaprotocol/vega/vega:$$sanitised_branch" ;
268+
docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$sanitised_branch" ;
262269
fi
270+
- docker rmi "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag"
263271
depends_on:
264272
- build-branch
265273
when:
@@ -292,7 +300,7 @@ steps:
292300
- unset GITHUB_DEPLOY_SSH_PRIVATE_KEY
293301
- ./script/build.sh -a build -T
294302
depends_on:
295-
- build-branch
303+
- build_docker_image
296304
when:
297305
event: tag
298306

Makefile

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,6 @@ print_check: ## Check for fmt.Print functions in Go code
124124
rm -f "$$f" && \
125125
if test "$$count" -gt 0 ; then exit 1 ; fi
126126

127-
.PHONY: docker
128-
docker: SHELL:=/usr/bin/env bash
129-
docker: ## Make docker container image using pre-existing binaries
130-
@source ./script/build.sh && set_version && \
131-
mkdir -p docker/bin && \
132-
for app in "$${apps[@]}" ; do \
133-
f="cmd/$$app/$$app" ; \
134-
if ! test -f "$$f" ; then \
135-
echo "Failed to find: $$f" ; \
136-
exit 1 ; \
137-
fi ; \
138-
cp -a "$$f" docker/bin/ || exit 1 ; \
139-
done && \
140-
docker build -t "docker.pkg.github.com/vegaprotocol/vega/vega:$$version" docker && \
141-
rm -rf docker/bin
142-
143127
.PHONY: gettools_build
144128
gettools_build:
145129
@./script/gettools.sh build

0 commit comments

Comments
 (0)