From 2f7215b3706eb03aa3367259901b2a29eed4e97c Mon Sep 17 00:00:00 2001
From: Cian Johnston <cian@coder.com>
Date: Fri, 17 May 2024 17:43:46 +0100
Subject: [PATCH 1/2] chore: fix test-registry Makefile target

---
 Makefile | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index c6d96bdb..aa93ae04 100644
--- a/Makefile
+++ b/Makefile
@@ -22,30 +22,36 @@ test-race:
 
 # Starts a local Docker registry on port 5000 with a local disk cache.
 .PHONY: test-registry
-test-registry: .registry-cache
+test-registry: test-registry-container test-images-pull test-images-push
+
+.PHONY: test-registry-container
+test-registry-container: .registry-cache
 	if ! curl -fsSL http://localhost:5000/v2/_catalog > /dev/null 2>&1; then \
 		docker rm -f envbuilder-registry && \
 		docker run -d -p 5000:5000 --name envbuilder-registry --volume $(PWD)/.registry-cache:/var/lib/registry registry:2; \
 	fi
 
 # Pulls images referenced in integration tests and pushes them to the local cache.
-.PHONY: test-images
-test-images: .registry-cache .registry-cache/docker/registry/v2/repositories/envbuilder-test-alpine .registry-cache/docker/registry/v2/repositories/envbuilder-test-ubuntu .registry-cache/docker/registry/v2/repositories/envbuilder-test-codercom-code-server
+.PHONY: test-images-push
+test-images-push: .registry-cache/docker/registry/v2/repositories/envbuilder-test-alpine .registry-cache/docker/registry/v2/repositories/envbuilder-test-ubuntu .registry-cache/docker/registry/v2/repositories/envbuilder-test-codercom-code-server
+
+.PHONY: test-images-pull
+test-images-pull:
+	docker pull alpine:latest
+	docker tag alpine:latest localhost:5000/envbuilder-test-alpine:latest
+	docker pull ubuntu:latest
+	docker tag ubuntu:latest localhost:5000/envbuilder-test-ubuntu:latest
+	docker pull codercom/code-server:latest
+	docker tag codercom/code-server:latest localhost:5000/envbuilder-test-codercom-code-server:latest
 
 .registry-cache:
 	mkdir -p .registry-cache && chmod -R ag+w .registry-cache
 
 .registry-cache/docker/registry/v2/repositories/envbuilder-test-alpine:
-	docker pull alpine:latest
-	docker tag alpine:latest localhost:5000/envbuilder-test-alpine:latest
 	docker push localhost:5000/envbuilder-test-alpine:latest
 
 .registry-cache/docker/registry/v2/repositories/envbuilder-test-ubuntu:
-	docker pull ubuntu:latest
-	docker tag ubuntu:latest localhost:5000/envbuilder-test-ubuntu:latest
 	docker push localhost:5000/envbuilder-test-ubuntu:latest
 
 .registry-cache/docker/registry/v2/repositories/envbuilder-test-codercom-code-server:
-	docker pull codercom/code-server:latest
-	docker tag codercom/code-server:latest localhost:5000/envbuilder-test-codercom-code-server:latest
 	docker push localhost:5000/envbuilder-test-codercom-code-server:latest
\ No newline at end of file

From fafd0d4097313e77088f60e76c970a35b2cbbe2c Mon Sep 17 00:00:00 2001
From: Cian Johnston <cian@coder.com>
Date: Fri, 17 May 2024 17:47:11 +0100
Subject: [PATCH 2/2] fixup! chore: fix test-registry Makefile target

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index aa93ae04..e25cc794 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ docs: options.go
 	go run ./scripts/docsgen/main.go
 
 .PHONY: test
-test: test-registry test-images
+test: test-registry
 	go test -count=1 ./...
 
 test-race: