Commit fcb50055 authored by aviau's avatar aviau Committed by Alexandre Viau
Browse files

Packaging: Avoid conflicts with multiple concurrent builds

This patch helps to avoid conflicts with multiple concurrent builds.

Running package-debian8 two times on the same machine could have
resulted in the wrong docker image being used for a build, creating
confusing outputs.

We haven't hit that case yet, but it could happen if we run the weekly
packaging publishing job at the same time as we run tests.

Change-Id: I0272c510dec77f43867ff85a95bdac8fda038936
Tuleap: #872
parent 9c5c4ad2
......@@ -28,6 +28,16 @@ target_template = """\
## Distro: %(distribution)s
# We don't simply use ring-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND:= docker run \\
--rm \\
......@@ -37,19 +47,19 @@ PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND:= docker run \\
-v $(CURDIR):/opt/ring-project-ro:ro \\
-v $(CURDIR)/packages/%(distribution)s:/opt/output \\
-t ring-packaging-%(distribution)s
-t $(PACKAGE_%(distribution)s_DOCKER_IMAGE_NAME)
.docker-image-%(distribution)s: docker/Dockerfile_%(distribution)s
$(PACKAGE_%(distribution)s_DOCKER_IMAGE_FILE): docker/Dockerfile_%(distribution)s
docker build \\
-t ring-packaging-%(distribution)s \\
-t $(PACKAGE_%(distribution)s_DOCKER_IMAGE_NAME) \\
-f docker/Dockerfile_%(distribution)s \\
touch .docker-image-%(distribution)s
touch $(PACKAGE_%(distribution)s_DOCKER_IMAGE_FILE)
mkdir -p packages/%(distribution)s
packages/%(distribution)s/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/%(distribution)s .docker-image-%(distribution)s
packages/%(distribution)s/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/%(distribution)s $(PACKAGE_%(distribution)s_DOCKER_IMAGE_FILE)
touch packages/%(distribution)s/*
......@@ -57,7 +67,7 @@ packages/%(distribution)s/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) pa
package-%(distribution)s: packages/%(distribution)s/$(DEBIAN_DSC_FILENAME)
.PHONY: package-%(distribution)s-interactive
package-%(distribution)s-interactive: $(RELEASE_TARBALL_FILENAME) packages/%(distribution)s .docker-image-%(distribution)s
package-%(distribution)s-interactive: $(RELEASE_TARBALL_FILENAME) packages/%(distribution)s $(PACKAGE_%(distribution)s_DOCKER_IMAGE_FILE)
$(PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND) bash
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment