implement first pass at cached image data source ()

implements envbuilder_cached_image data source
This commit is contained in:
Cian Johnston 2024-08-01 21:26:44 +01:00 committed by GitHub
commit c9e7cb8178
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1698 additions and 147 deletions

View file

@ -17,3 +17,34 @@ build: terraform-provider-envbuilder
terraform-provider-envbuilder: internal/provider/*.go main.go
CGO_ENABLED=0 go build .
.PHONY: update-envbuilder-version
update-envbuilder-version:
go get github.com/coder/envbuilder@main
go mod tidy
# Starts a local Docker registry on port 5000 with a local disk cache.
.PHONY: test-registry
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 tfprov-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-push
test-images-push: .registry-cache/docker/registry/v2/repositories/test-ubuntu
.PHONY: test-images-pull
test-images-pull:
docker pull ubuntu:latest
docker tag ubuntu:latest localhost:5000/test-ubuntu:latest
.registry-cache:
mkdir -p .registry-cache && chmod -R ag+w .registry-cache
.registry-cache/docker/registry/v2/repositories/test-ubuntu:
docker push localhost:5000/test-ubuntu:latest