mirror of
https://github.com/containers/podman.git
synced 2025-08-02 17:22:30 +08:00
Add validate-in-container target
This change adds a validate-in-container make target that can be used to run the make validate target in a container instead of requiring the dependencies to be available on the system. This mirrors what is already done for the vendor target and allows additional targets to be added. A PODMANCMD make variable is also added to allow for the podman binary to be overridden in cases where this is not available. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
16
Makefile
16
Makefile
@ -289,13 +289,21 @@ vendor:
|
|||||||
$(GO) mod vendor
|
$(GO) mod vendor
|
||||||
$(GO) mod verify
|
$(GO) mod verify
|
||||||
|
|
||||||
.PHONY: vendor-in-container
|
|
||||||
vendor-in-container:
|
# We define *-in-container targets for the following make targets. This allow the targets to be run in a container.
|
||||||
podman run --rm --env HOME=/root \
|
# Note that the PODMANCMD can also be overridden to allow a different container CLI to be used on systems where podman is not already available.
|
||||||
|
IN_CONTAINER_TARGETS = vendor validate
|
||||||
|
PODMANCMD ?= podman
|
||||||
|
IN_CONTAINER = $(patsubst %,%-in-container,$(IN_CONTAINER_TARGETS))
|
||||||
|
|
||||||
|
.PHONY: $(IN_CONTAINER)
|
||||||
|
$(IN_CONTAINER): %-in-container:
|
||||||
|
$(PODMANCMD) run --rm --env HOME=/root \
|
||||||
-v $(CURDIR):/src -w /src \
|
-v $(CURDIR):/src -w /src \
|
||||||
--security-opt label=disable \
|
--security-opt label=disable \
|
||||||
docker.io/library/golang:1.17 \
|
docker.io/library/golang:1.17 \
|
||||||
make vendor
|
make $(*)
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
### Primary binary-build targets
|
### Primary binary-build targets
|
||||||
|
Reference in New Issue
Block a user