-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make base dapper logic project agnostic so that it can be consumed by projects outside the submariner org. This mainly involves moving out basic dapper functions out to `Makefile.dapper.base` and adding an `ORG` argument to specify the organization. References to `submariner-io` have been removed where possible. Signed-off-by: Mike Kolesnik <[email protected]>
- Loading branch information
Showing
7 changed files
with
91 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# This Makefile contains the rules required to set up our | ||
# Dapper-based build environment | ||
|
||
, := , | ||
BASE_DAPPER := Dockerfile.dapper | ||
USING = $(subst $(,), ,$(using)) | ||
LINTING_DAPPER := Dockerfile.linting | ||
LINTING_GOALS := gitlint shellcheck yamllint markdownlint | ||
NON_DAPPER_GOALS += .dapper shell targets $(LINTING_GOALS) | ||
export MAKEFLAGS | ||
export USING | ||
|
||
# Define LOCAL_BUILD to build directly on the host and not inside a Dapper container | ||
ifdef LOCAL_BUILD | ||
DAPPER_HOST_ARCH ?= $(shell go env GOHOSTARCH) | ||
SHIPYARD_DIR ?= ../shipyard | ||
SCRIPTS_DIR ?= $(SHIPYARD_DIR)/scripts/shared | ||
|
||
export DAPPER_HOST_ARCH | ||
export SHIPYARD_DIR | ||
export SCRIPTS_DIR | ||
|
||
RUN_IN_DAPPER := | ||
|
||
.dapper: | ||
|
||
else | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
@curl -sfLO https://raw.githubusercontent.com/submariner-io/shipyard/$(BASE_BRANCH)/$@ | ||
@chmod +x .dapper | ||
@./.dapper -v | ||
|
||
SELINUX_CONTEXT := $(shell (selinuxenabled && echo -S z) 2>/dev/null) | ||
RUN_IN_DAPPER = ./.dapper $(DAPPER_ARGS) $(SELINUX_CONTEXT) -- | ||
|
||
endif | ||
|
||
ifeq (true,$(DEBUG_PRINT)) | ||
MAKE_DEBUG_FLAG = --debug=b | ||
endif | ||
|
||
USING = $(subst $(,), ,$(using)) | ||
_using = ${USING} | ||
|
||
ifneq (,$(filter dual-stack,$(_using))) | ||
IPV6_FLAGS = --ipv6 --subnet fc00:1234:4444::/64 | ||
endif | ||
|
||
# Only run command line goals in dapper (except things that have to run outside of dapper). | ||
# Otherwise, make applies this rule to various files and tries to build them in dapper (which doesn't work, obviously). | ||
$(filter-out .dapper prune-images shell targets $(NON_DAPPER_GOALS),$(MAKECMDGOALS)): .dapper $(BASE_DAPPER) | ||
@[ -z "$$CI" ] || echo "::group::Launching a container to run 'make $@'" | ||
-docker network create $(IPV6_FLAGS) -d bridge kind | ||
+$(RUN_IN_DAPPER) make $(MAKE_DEBUG_FLAG) $@ | ||
|
||
# The original dockerfiles will live in Shipyard and be downloaded by consuming projects. | ||
$(BASE_DAPPER) $(LINTING_DAPPER): | ||
@echo Downloading $@ | ||
@curl -sfLO https://raw.githubusercontent.com/submariner-io/shipyard/$(BASE_BRANCH)/$@ | ||
|
||
# Run silently as the commands are pretty straightforward and `make` hasn't a lot to do | ||
$(LINTING_GOALS): DAPPER_ARGS := -f $(LINTING_DAPPER) | ||
$(LINTING_GOALS): .dapper $(LINTING_DAPPER) | ||
@[ -z "$$CI" ] || echo "::group::Launching a container to run 'make $@'" | ||
@$(RUN_IN_DAPPER) make $@ | ||
|
||
shell: DAPPER_ARGS := -s | ||
shell: .dapper $(BASE_DAPPER) | ||
$(RUN_IN_DAPPER) | ||
|
||
# Run silently to just list the targets (hence we can't use the generic dapper wrapper recipe). | ||
# This only lists targets accessible inside dapper (which are 99% of targets we use) | ||
targets: DAPPER_ARGS := -f $(LINTING_DAPPER) | ||
targets: $(LINTING_DAPPER) | ||
@$(RUN_IN_DAPPER) eval "\$${SCRIPTS_DIR}/targets.sh" | ||
|
||
.PHONY: shell targets $(LINTING_GOALS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters