Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Makefile.wolfspyrelabs 3.72 KiB
PATH=$(shell pwd)/src/bin:$(shell echo $$PATH)
#
default: clean prepare build

build:
#	@cp -vr target/ /cache
	@ls -la target target/bundle
	@cat target/bundle/Makefile
	@make -f target/bundle/Makefile || (cat target/bundle/build.log && exit 1)

clean:
	@rm -rf target

build-debug: src/bin/buildx
	@make -f target/bundle/Makefile DEBUG=true

prepare: src/bin/buildx
	@rm -rf target/bundle
#	@docker run --rm -i  --entrypoint "/bin/ls" -v /cache:/cache -v $$(pwd):/work -u $$(id -u) "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}"/klakegg/docker-project-prepare:edge  /work /cache
	@docker run --rm -i -v $$(pwd):/work -v /cache:/cache  -u $$(id -u) "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}"/klakegg/docker-project-prepare:edge -s /work/src -t target/bundle
	@mv target/bundle/Makefile target/bundle/Makefile.original
	@echo -e "Emitting some vars:\n version: [ ${version} or $(__version) ]\n VERSION: [ ${VERSION} or $(VERSION) ]\n wpl_go_version: [`__wpl_go_version` or  $(__wpl_go_version:-0 ) or ${wpl_go_version} ]\n"
#	@cat target/bundle/Makefile.original | sed "s:DOCKER_CLI_EXPERIMENTAL=enabled docker buildx:buildx:g" > target/bundle/Makefile
	@cat target/bundle/Makefile.original | sed "s:DOCKER_CLI_EXPERIMENTAL=enabled docker buildx:buildx --builder hugoblder:g" > target/bundle/Makefile

test: test-docsy test-docuapi

test-docsy:
	@rm -rf target/test/docsy
	@git clone --recurse-submodules --depth 1 https://gitlab.wolfspyre.io/mirrored_repos/google/docsy.git target/test/docsy
	@docker run --rm -i -v $$(pwd)/target/test/docsy:/src -u $$(id -u) --entrypoint npm wpl_containers/docker-hugo/hugo:ext-alpine install
	@docker run --rm -i -v $$(pwd)/target/test/docsy:/src -u $$(id -u) wpl_containers/docker-hugo/hugo:ext-alpine

test-docuapi:
	@rm -rf target/test/docuapi
	@git clone --depth 1 https://gitlab.wolfspyre.io/mirrored_repos/hugo_related/docuapi.git target/test/docuapi
	@docker run --rm -i -v $$(pwd)/target/test/docuapi:/src -u $$(id -u) --entrypoint npm "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}"/wpl_containers/docker-hugo/hugo:ext-alpine install
	@docker run --rm -i -v $$(pwd)/target/test/docuapi:/src -u $$(id -u) "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}"/wpl_containers/docker-hugo/hugo:ext-alpine

push-gitlab:
	@pwd
	@ls -la target target/bundle
	@cat target/bundle/Makefile
	@echo "Logging into registry ${CI_REGISTRY}"
	@echo -n "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
	@echo -n "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
	@env
	@echo "running @make -f target/bundle/Makefile push-edge"
	@make -f target/bundle/Makefile push-edge || (cat target/bundle/build.log && exit 1)
	@echo "running wpl_docker_push for all the things"
	@make -f target/bundle/Makefile push-stable || (cat target/bundle/build.log && exit 1)

push-edge:
	@echo "Logging into registry ${CI_REGISTRY}"
	@echo -n "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
	@make -f target/bundle/Makefile push-edge

push-release:
	@echo "Logging into registry ${CI_REGISTRY}"
	@echo -n "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
	@make -f target/bundle/Makefile push-stable

push-stable: push-release

bump:
	@RELEASE=$(version) bump

src/bin/buildx:
# https://github.com/docker/buildx/releases/download/v0.10.3/buildx-v0.10.3.linux-amd64
	wget -q -O src/bin/buildx https://dog.wolfspyre.io/chewtoy/docker/buildx/releases/0.11.2/buildx-v0.11.2.linux-amd64
	chmod a+x src/bin/buildx
	docker buildx use --builder hugoblder

enable-qemu:
	@sudo docker run --rm --privileged "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/"multiarch/qemu-user-static --reset -p yes
	@sudo update-binfmts --enable