...

Text file src/github.com/datawire/ambassador/v2/build-aux/check.mk

Documentation: github.com/datawire/ambassador/v2/build-aux

     1include build-aux/tools.mk
     2
     3#
     4# Auxiliary Docker images needed for the tests
     5
     6# Keep this list in-sync with python/tests/integration/manifests.py
     7push-pytest-images: docker/emissary.docker.push.remote
     8push-pytest-images: docker/test-auth.docker.push.remote
     9push-pytest-images: docker/test-shadow.docker.push.remote
    10push-pytest-images: docker/test-stats.docker.push.remote
    11push-pytest-images: docker/kat-client.docker.push.remote
    12push-pytest-images: docker/kat-server.docker.push.remote
    13.PHONY: push-pytest-images
    14
    15# test-{auth,shadow,stats}.docker
    16test_svcs = auth shadow stats
    17$(foreach svc,$(test_svcs),docker/.test-$(svc).docker.stamp): docker/.%.docker.stamp: docker/%/Dockerfile FORCE
    18	docker build --iidfile=$@ $(<D)
    19clean: $(foreach svc,$(test_svcs),docker/test-$(svc).docker.clean)
    20
    21# kat-client.docker
    22docker/kat-client.go.layer.tar: $(tools/ocibuild) $(tools/write-ifchanged) FORCE
    23	GOFLAGS=-mod=mod $(tools/ocibuild) layer gobuild ./cmd/kat-client | $(tools/write-ifchanged) $@
    24docker/kat-client.fs.layer.tar: $(tools/ocibuild) $(tools/write-ifchanged) FORCE
    25	{ $(tools/ocibuild) layer dir \
    26	  --prefix=work \
    27	  --chown-uid=0 --chown-uname=root \
    28	  --chown-gid=0 --chown-uname=root \
    29	  docker/kat-client; } | $(tools/write-ifchanged) $@
    30docker/.kat-client.img.tar.stamp: $(tools/ocibuild) docker/base.img.tar docker/kat-client.go.layer.tar docker/kat-client.fs.layer.tar
    31	{ $(tools/ocibuild) image build \
    32	  --base=docker/base.img.tar \
    33	  --config.Cmd='sleep' --config.Cmd='3600' \
    34	  --tag=emissary.local/kat-client:latest \
    35	  <($(tools/ocibuild) layer squash $(filter %.layer.tar,$^)); } > $@
    36
    37# kat-server.docker
    38docker/kat-server.go.layer.tar: $(tools/ocibuild) $(tools/write-ifchanged) FORCE
    39	GOFLAGS=-mod=mod $(tools/ocibuild) layer gobuild ./cmd/kat-server | $(tools/write-ifchanged) $@
    40docker/kat-server.certs.layer.tar: $(tools/ocibuild) $(tools/write-ifchanged) docker/kat-server/server.crt docker/kat-server/server.key
    41	$(tools/ocibuild) layer dir --prefix=work docker/kat-server | $(tools/write-ifchanged) $@
    42docker/kat-server/server.crt: $(tools/testcert-gen)
    43	mkdir -p $(@D)
    44	$(tools/testcert-gen) --out-cert=$@ --out-key=/dev/null --hosts=kat-server.test.getambassador.io
    45docker/kat-server/server.key: $(tools/testcert-gen)
    46	mkdir -p $(@D)
    47	$(tools/testcert-gen) --out-cert=/dev/null --out-key=$@ --hosts=kat-server.test.getambassador.io
    48docker/.kat-server.img.tar.stamp: $(tools/ocibuild) docker/base.img.tar docker/kat-server.go.layer.tar docker/kat-server.certs.layer.tar
    49	{ $(tools/ocibuild) image build \
    50	  --base=docker/base.img.tar \
    51	  --config.Env.append=GRPC_VERBOSITY=debug \
    52	  --config.Env.append=GRPC_TRACE=tcp,http,api \
    53	  --config.WorkingDir='/work' \
    54	  --config.Cmd='kat-server' \
    55	  --tag=emissary.local/kat-server:latest \
    56	  <($(tools/ocibuild) layer squash $(filter %.layer.tar,$^)); } > $@
    57docker/kat-server.img.tar.clean: docker/kat-server.rm-r
    58
    59#
    60# Helm tests
    61
    62test-chart-values.yaml: docker/emissary.docker.push.remote
    63	{ \
    64	  echo 'image:'; \
    65	  sed -E -n '2s/^(.*):.*/  repository: \1/p' < $<; \
    66	  sed -E -n '2s/.*:/  tag: /p' < $<; \
    67	} >$@
    68clean: test-chart-values.yaml.rm
    69build-output/chart-%/ci: build-output/chart-% test-chart-values.yaml
    70	rm -rf $@
    71	cp -a $@.in $@
    72	for file in $@/*-values.yaml; do cat test-chart-values.yaml >> "$$file"; done
    73
    74test-chart: $(tools/ct) $(tools/kubectl) $(chart_dir)/ci build-output/yaml-$(patsubst v%,%,$(VERSION)) $(if $(DEV_USE_IMAGEPULLSECRET),push-pytest-images $(OSS_HOME)/venv)
    75ifneq ($(DEV_USE_IMAGEPULLSECRET),)
    76	. venv/bin/activate && KUBECONFIG=$(DEV_KUBECONFIG) python3 -c 'from tests.integration.utils import install_crds; install_crds()'
    77else
    78	$(tools/kubectl) --kubeconfig=$(DEV_KUBECONFIG) apply -f build-output/yaml-$(patsubst v%,%,$(VERSION))/emissary-crds.yaml
    79endif
    80	$(tools/kubectl) --kubeconfig=$(DEV_KUBECONFIG) --namespace=emissary-system wait --timeout=90s --for=condition=available Deployments/emissary-apiext
    81	cd $(chart_dir) && KUBECONFIG=$(DEV_KUBECONFIG) $(abspath $(tools/ct)) install --config=./ct.yaml
    82.PHONY: test-chart
    83
    84#
    85# Other
    86
    87clean: .pytest_cache.rm-r .coverage.rm
    88
    89dtest.clean:
    90	docker container list --filter=label=scope=dtest --quiet | xargs -r docker container kill
    91clean: dtest.clean

View as plain text