Skip to content

Commit

Permalink
Remove podman option from Makefile and modify html target
Browse files Browse the repository at this point in the history
CI was failing, removing the podman option from the Makefile and
modifying the html target to run docker in non-interative mode seems to
have resolved the issue.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
  • Loading branch information
dylandreimerink committed Dec 29, 2024
1 parent 7b5e33e commit 41c7c94
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
REPODIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
UIDGID := $(shell stat -c '%u:%g' ${REPODIR})

# Prefer podman if installed, otherwise use docker.
# Note: Setting the var at runtime will always override.
CONTAINER_ENGINE ?= $(if $(shell command -v podman), podman, docker)
CONTAINER_RUN_ARGS ?= $(if $(filter ${CONTAINER_ENGINE}, podman), --log-driver=none, --user "${UIDGID}")

IMAGE := ghcr.io/isovalent/ebpf-docs
VERSION := $(shell cat ${REPODIR}/tools/image-version)

Expand All @@ -20,22 +15,22 @@ default: serve ;
.PHONY: build-container
build-container:
$(eval EPOCH := $(shell date +%s))
${CONTAINER_ENGINE} build -f ${REPODIR}/tools/Dockerfile -t ${IMAGE}:$(EPOCH) ${REPODIR}
docker build -f ${REPODIR}/tools/Dockerfile -t ${IMAGE}:$(EPOCH) ${REPODIR}
echo $(EPOCH) > ${REPODIR}/tools/image-version

.PHONY: push-container
push-container:
${CONTAINER_ENGINE} push ${IMAGE}:${VERSION}
docker push ${IMAGE}:${VERSION}

.PHONY: container-shell
container-shell:
${CONTAINER_ENGINE} run --rm -it -v "${REPODIR}:/docs" -e "GH_TOKEN=${GH_TOKEN}" \
docker run --rm -it -v "${REPODIR}:/docs" -e "GH_TOKEN=${GH_TOKEN}" \
-e "AS_USER=$$(id -u $${USER})" -e "AS_GROUP=$$(id -g $${USER})" \
-w /docs "${IMAGE}:${VERSION}"

.PHONY: html
html:
${CONTAINER_ENGINE} run --rm -it -v "${REPODIR}:/docs" \
docker run --rm -v "${REPODIR}:/docs" \
-e "PROD=${PROD}" -e "GH_TOKEN=${GH_TOKEN}" \
-e "AS_USER=$$(id -u $${USER})" -e "AS_GROUP=$$(id -g $${USER})" \
-w /docs "${IMAGE}:${VERSION}" "mkdocs build -d /docs/out"
Expand All @@ -46,19 +41,19 @@ clear-html:

.PHONY: serve
serve:
${CONTAINER_ENGINE} run --rm -it -p 8000:8000 -v "${REPODIR}:/docs" \
docker run --rm -p 8000:8000 -v "${REPODIR}:/docs" \
-e "PROD=${PROD}" -e "GH_TOKEN=${GH_TOKEN}" \
-w /docs -e "AS_USER=$$(id -u $${USER})" -e "AS_GROUP=$$(id -g $${USER})" \
"${IMAGE}:${VERSION}" "mkdocs serve -a 0.0.0.0:8000 --watch /docs/docs"

.PHONY: build-spellcheck
build-spellcheck:
${CONTAINER_ENGINE} run --rm -v "${REPODIR}:/docs" -w /docs golang:latest bash -c \
docker run --rm -v "${REPODIR}:/docs" -w /docs golang:latest bash -c \
"CGO_ENABLED=0 go build -buildvcs=false -o /docs/tools/bin/spellcheck /docs/tools/spellcheck/."

.PHONY: build-gen-tools
build-gen-tools:
${CONTAINER_ENGINE} run --rm -v "${REPODIR}:/docs" -w /docs golang:latest bash -c \
docker run --rm -v "${REPODIR}:/docs" -w /docs golang:latest bash -c \
"CGO_ENABLED=0 go build -buildvcs=false -o /docs/tools/bin/libbpf-tag-gen /docs/tools/libbpf-tag-gen/. && \
CGO_ENABLED=0 go build -buildvcs=false -o /docs/tools/bin/helper-ref-gen /docs/tools/helper-ref-gen/. && \
CGO_ENABLED=0 go build -buildvcs=false -o /docs/tools/bin/feature-gen /docs/tools/feature-gen/. && \
Expand All @@ -70,7 +65,7 @@ LIBBPF_REF := $(shell cat ${REPODIR}/tools/libbpf-ref)

.PHONY: generate-docs
generate-docs: build-gen-tools
${CONTAINER_ENGINE} run --rm -v "${REPODIR}:/docs" \
docker run --rm -v "${REPODIR}:/docs" \
-w /docs -e "AS_USER=$$(id -u $${USER})" -e "AS_GROUP=$$(id -g $${USER})" "${IMAGE}:${VERSION}" \
"/docs/tools/bin/helper-ref-gen --project-root /docs && \
/docs/tools/bin/libbpf-tag-gen --project-root /docs --libbpf-ref '${LIBBPF_REF}' && \
Expand All @@ -90,6 +85,6 @@ update-libbpf-ref:

.PHONY: spellcheck
spellcheck: build-spellcheck html
${CONTAINER_ENGINE} run --rm -v "${REPODIR}:/docs" \
docker run --rm -v "${REPODIR}:/docs" \
-w /docs -e "AS_USER=$$(id -u $${USER})" -e "AS_GROUP=$$(id -g $${USER})" "${IMAGE}:${VERSION}" \
"/docs/tools/bin/spellcheck --project-root /docs"

0 comments on commit 41c7c94

Please sign in to comment.