Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4baba63
Add Makefile for running complicated tasks with a single command
gvmw Nov 22, 2021
9c28c2d
Tell git to ingore .env and .config paths
gvmw Nov 24, 2021
52c7c0a
Add KiND cluster config
gvmw Nov 24, 2021
933a6ea
Install gh cli
gvmw Nov 25, 2021
3b5570a
Add descriptions for install-* targets
gvmw Nov 26, 2021
96f9231
Bump k9s to latest
gvmw Nov 29, 2021
515199c
Install kn CLI
gvmw Nov 29, 2021
ae48b68
Move KO_URL after KO_BIN_DIR
gvmw Nov 30, 2021
4c7b94e
Use make variables that expand only once
gvmw Nov 30, 2021
dadc476
Install serving part of the e2e setup
gvmw Dec 2, 2021
2cb1d7f
Install Kourier for ingress part of Knative Serving
gvmw Dec 2, 2021
0a4972f
Respect KUBECONFIG from env & do not hard-code to kind
gvmw Dec 6, 2021
30f182a
Bump cert-manager to 1.5.4
gvmw Dec 7, 2021
8870f73
Fix missing OPEN
gvmw Dec 7, 2021
b05b259
Make test-e2e depend on KUBECONFIG, no more roundabouts
gvmw Dec 7, 2021
9f5ba25
Remove kind setup scripts
gvmw Dec 7, 2021
0807d8e
Use the existing context for the default install
gvmw Dec 7, 2021
11c1e64
Make install & test-e2e behaviour is more intuitive
gvmw Dec 7, 2021
d009188
Make the default help target more helpful for newcomers
gvmw Dec 7, 2021
e5e6bbf
Rename build to test-compilation
gvmw Dec 10, 2021
202c7cc
List test-unit-uncached in help
gvmw Dec 10, 2021
4e6fa74
Use Makefile in kind conformance standalone GitHub Action
gvmw Dec 15, 2021
1ad36a2
Fix envsubst variables in kind.yaml
gvmw Dec 15, 2021
76e034f
Do not link ko to gcloud
gvmw Dec 15, 2021
cac3d5c
Uppercase all instances of KiND & K8s
gvmw Dec 15, 2021
5579e6f
Export updated PATH so that all targets work correctly
gvmw Dec 15, 2021
11fdb17
Bump gh, k9s, kn & Knative versions to latest
gvmw Dec 15, 2021
ee89e77
Use make targets in kind e2e test GitHub Action
gvmw Dec 15, 2021
1e44192
Install standalone broker for standalone conformance tests
gvmw Dec 15, 2021
7a12f6c
Separate standalone conformance tests from the regular ones
gvmw Dec 16, 2021
486d907
Make test-conformance targets leaner
gvmw Dec 16, 2021
4402657
Convert standard conformance tests to use make targets
gvmw Dec 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ cover.out
bin/
*.swp
.history
.envrc
.envrc
.env
.config
378 changes: 378 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,378 @@
### CONFIG #
#
SHELL := bash # we want bash behaviour in all shell invocations
PLATFORM := $(shell uname)
platform := $(shell echo $(PLATFORM) | tr A-Z a-z)
ifeq ($(PLATFORM),Darwin)
platform_alt = macOS
else
platform_alt = $(platform)
endif
ARCH := $(shell uname -m)

# https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
MAGENTA := \033[0;35m
CYAN := \033[0;36m
BOLD := \033[1m
NORMAL := \033[0m
INFO := $(CYAN)
WARN := $(MAGENTA)

XDG_CONFIG_HOME ?= $(CURDIR)/.config
env::
@echo 'export XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)"'
KUBECONFIG_DIR = $(XDG_CONFIG_HOME)/kubectl
KUBECONFIG ?= $(KUBECONFIG_DIR)/config
$(KUBECONFIG_DIR):
mkdir -p $(@)
env::
@echo 'export KUBECONFIG="$(KUBECONFIG)"'

LOCAL_BIN := $(CURDIR)/bin
$(LOCAL_BIN):
mkdir -p $@
env::
@echo 'export PATH="$(LOCAL_BIN):$$PATH"'



### DEPS #
#
ifeq ($(PLATFORM),Darwin)
OPEN := open
else
OPEN := xdg-open
endif

GCLOUD_SDK_VERSION := 365.0.0
GCLOUD_BIN := gcloud-$(GCLOUD_SDK_VERSION)-$(PLATFORM)-x86_64
GCLOUD := $(LOCAL_BIN)/$(GCLOUD_BIN)
GCLOUD_SDK_FILE := google-cloud-sdk-$(GCLOUD_SDK_VERSION)-$(PLATFORM)-x86_64.tar.gz
GCLOUD_SDK_URL := https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$(GCLOUD_SDK_FILE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like downloading tools directly from the network. I have them installed on my machine, securely. Without checking for consistency (signs, checksums) you are introducing a vulnerability into Knative supply chain.

Copy link
Contributor Author

@gvmw gvmw Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely think that this area should be improved.

I also think the zero-trust approach promoted by chainguard.dev is the right way to go, and considering the people that are behind this idea - @mattmoor @vaikas @n3wscott - I think that they would agree with this too.

Given that we adopt the same approach in our existing GitHub Actions, and we suggest the same in the Knative development guide, I don't see the approach in this PR being worse. Having said that, I'm glad that this is on your radar and I also think that we should close this gap as soon as possible, but not part of this PR.

https://github.com/knative-sandbox/eventing-rabbitmq/blob/cceea87c1c3ddce8bcb696b4fed9bb1015c48550/.github/workflows/kind-e2e.yaml#L70-L73

$(GCLOUD): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(LOCAL_BIN)/$(GCLOUD_SDK_FILE) "$(GCLOUD_SDK_URL)"
cd $(LOCAL_BIN) && \
tar -xzf $(GCLOUD_SDK_FILE) && \
rm -rf $(GCLOUD_SDK_FILE) && \
cd google-cloud-sdk && \
./install.sh --quiet --usage-reporting=false
ln -sf $(LOCAL_BIN)/google-cloud-sdk/bin/gcloud $(GCLOUD)
ln -sf $(GCLOUD) $(LOCAL_BIN)/gcloud
@printf "$(INFO)ko requires $(BOLD)docker-credential-gcloud$(NORMAL)\n"
PATH=$(GOOGLE_CLOUD_SDK_BIN):$$PATH $(GCLOUD) auth configure-docker
@printf "$(RED)Remember to run: $(BOLD)make .env -B && . .env$(NORMAL)\n"

GOOGLE_CLOUD_SDK_BIN := $(CURDIR)/bin/google-cloud-sdk/bin
env::
@echo 'export PATH="$(GOOGLE_CLOUD_SDK_BIN):$$PATH"'
.PHONY: gcloud
gcloud: $(GCLOUD)
.PHONY: releases-gcloud
releases-gcloud:
$(OPEN) https://cloud.google.com/sdk/docs/quickstart

KO_RELEASES := https://github.com/google/ko/releases
KO_VERSION := 0.9.3
KO_BIN_DIR := $(LOCAL_BIN)/ko_$(KO_VERSION)_$(PLATFORM)_x86_64
KO_URL := $(KO_RELEASES)/download/v$(KO_VERSION)/$(notdir $(KO_BIN_DIR)).tar.gz
KO := $(KO_BIN_DIR)/ko
$(KO): | $(CURL) $(LOCAL_BIN) $(GCLOUD)
$(CURL) --progress-bar --fail --location --output $(KO_BIN_DIR).tar.gz "$(KO_URL)"
mkdir -p $(KO_BIN_DIR) && tar zxvf $(KO_BIN_DIR).tar.gz -C $(KO_BIN_DIR)
touch $(KO)
chmod +x $(KO)
$(KO) version | grep $(KO_VERSION)
ln -sf $(KO) $(LOCAL_BIN)/ko
.PHONY: ko
ko: $(KO)
.PHONY: releases-ko
releases-ko:
$(OPEN) $(KO_RELEASES)

KIND_RELEASES := https://github.com/kubernetes-sigs/kind/releases
KIND_VERSION := 0.11.1
KIND_URL := $(KIND_RELEASES)/download/v$(KIND_VERSION)/kind-$(platform)-amd64
KIND := $(LOCAL_BIN)/kind_$(KIND_VERSION)_$(platform)_amd64
$(KIND): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(KIND) "$(KIND_URL)"
touch $(KIND)
chmod +x $(KIND)
$(KIND) version | grep $(KIND_VERSION)
ln -sf $(KIND) $(LOCAL_BIN)/kind
.PHONY: kind
kind: $(KIND)
.PHONY: releases-kind
releases-kind:
$(OPEN) $(KIND_RELEASES)

# The envsubst that comes with gettext does not support this,
# using this Go version instead: https://github.com/a8m/envsubst#docs
ENVSUBST_RELEASES := https://github.com/a8m/envsubst/releases
ENVSUBST_VERSION := 1.2.0
ENVSUBST_URL := $(ENVSUBST_RELEASES)/download/v$(ENVSUBST_VERSION)/envsubst-$(PLATFORM)-x86_64
ENVSUBST := $(LOCAL_BIN)/envsubst-$(ENVSUBST_VERSION)-$(PLATFORM)-x86_64
# We want to fail if variables are not set or empty.
ENVSUBST_SAFE := $(ENVSUBST) -no-unset -no-empty
$(ENVSUBST): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(ENVSUBST) "$(ENVSUBST_URL)"
touch $(ENVSUBST)
chmod +x $(ENVSUBST)
ln -sf $(ENVSUBST) $(LOCAL_BIN)/envsubst
.PHONY: envsubst
envsubst: $(ENVSUBST)
.PHONY: releases-envsubst
releases-envsubst:
$(OPEN) $(ENVSUBST_RELEASES)

KUBECTL_RELEASES := https://github.com/kubernetes/kubernetes/tags
# Keep this in sync with KIND_K8s_VERSION
KUBECTL_VERSION := 1.20.7
KUBECTL_BIN := kubectl-$(KUBECTL_VERSION)-$(platform)-amd64
KUBECTL_URL := https://storage.googleapis.com/kubernetes-release/release/v$(KUBECTL_VERSION)/bin/$(platform)/amd64/kubectl
KUBECTL := $(LOCAL_BIN)/$(KUBECTL_BIN)
$(KUBECTL): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(KUBECTL) "$(KUBECTL_URL)"
touch $(KUBECTL)
chmod +x $(KUBECTL)
$(KUBECTL) version | grep $(KUBECTL_VERSION)
ln -sf $(KUBECTL) $(LOCAL_BIN)/kubectl
.PHONY: kubectl
kubectl: $(KUBECTL)
.PHONY: releases-kubectl
releases-kubectl:
$(OPEN) $(KUBECTL_RELEASES)
K_CMD ?= apply
# Dump all objects (do not apply) if DEBUG variable is set
ifneq (,$(DEBUG))
K_CMD = create --dry-run=client --output=yaml
endif

K9S_RELEASES := https://github.com/derailed/k9s/releases
K9S_VERSION := 0.25.7
K9S_BIN_DIR := $(LOCAL_BIN)/k9s-$(K9S_VERSION)-$(platform)-x86_64
K9S_URL := $(K9S_RELEASES)/download/v$(K9S_VERSION)/k9s_$(platform)_x86_64.tar.gz
K9S := $(K9S_BIN_DIR)/k9s
$(K9S): | $(CURL) $(LOCAL_BIN) $(KUBECTL)
$(CURL) --progress-bar --fail --location --output $(K9S_BIN_DIR).tar.gz "$(K9S_URL)"
mkdir -p $(K9S_BIN_DIR) && tar zxf $(K9S_BIN_DIR).tar.gz -C $(K9S_BIN_DIR)
touch $(K9S)
chmod +x $(K9S)
$(K9S) version | grep $(K9S_VERSION)
ln -sf $(K9S) $(LOCAL_BIN)/k9s
.PHONY: releases-k9s
releases-k9s:
$(OPEN) $(K9S_RELEASES)
.PHONY: k9s
K9S_ARGS ?= --all-namespaces
k9s: | $(KUBECONFIG) $(K9S) ## Terminal ncurses UI for K8s
$(K9S) $(K9S_ARGS)

GH_RELEASES := https://github.com/cli/cli/releases
GH_VERSION := 2.2.0
GH_DIR := $(LOCAL_BIN)/gh_$(GH_VERSION)_$(platform_alt)_amd64
GH_URL := $(GH_RELEASES)/download/v$(GH_VERSION)/$(notdir $(GH_DIR)).tar.gz
GH := $(GH_DIR)/bin/gh
$(GH): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(GH_DIR).tar.gz $(GH_URL)
tar zxf $(GH_DIR).tar.gz -C $(LOCAL_BIN)
touch $(GH)
chmod +x $(GH)
$(GH) version | grep $(GH_VERSION)
ln -sf $(GH) $(LOCAL_BIN)/gh
.PHONY: gh
gh: $(GH)
.PHONY: releases-gh
releases-gh:
$(OPEN) $(GH_RELEASES)

KN_RELEASES := https://github.com/knative/client/releases
KN_VERSION := 1.0.0
KN_BIN := kn-$(KN_VERSION)-$(platform)-amd64
KN_URL := $(KN_RELEASES)/download/knative-v$(KN_VERSION)/kn-$(platform)-amd64
KN := $(LOCAL_BIN)/$(KN_BIN)
$(KN): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(KN) "$(KN_URL)"
touch $(KN)
chmod +x $(KN)
$(KN) version | grep $(KN_VERSION)
ln -sf $(KN) $(LOCAL_BIN)/kn
.PHONY: kn
kn: $(KN)
.PHONY: releases-kn
releases-kn:
$(OPEN) $(KN_RELEASES)



### TARGETS #
#
.DEFAULT_GOAL := help

.PHONY: env
env:: ## Configure shell env - eval "$(make env)" OR rm .env && make .env && source .env
@echo 'unalias m 2>/dev/null || true ; alias m=make'
.env:
$(MAKE) --file $(lastword $(MAKEFILE_LIST)) --no-print-directory env SILENT="1>/dev/null 2>&1" > .env

CURL ?= /usr/bin/curl
$(CURL):
@which $(CURL) \
|| ( printf "$(RED)$(BOLD)$(CURL)$(NORMAL)$(RED) is missing, install $(BOLD)curl$(NORMAL)\n" ; exit 1)
.PHONY: curl
curl: $(CURL)

HELP_TARGET_DEPTH ?= \#\#
.PHONY: help
help:
@printf "\nIf this is your first time running this, remember to run: $(BOLD)make .env && source .env$(NORMAL)\n"
@printf "Now just type $(BOLD)make <TAB>$(NORMAL) to enjoy shell autocompletion\n"
@printf "By the way, $(BOLD)m$(NORMAL) is an alias for $(BOLD)make$(NORMAL)\n\n"
@printf "Here is a list of all the make targets that you can run, e.g. $(BOLD)make test-e2e$(NORMAL) or $(BOLD)m test-e2e$(NORMAL)\n\n"
@awk -F':+ |$(HELP_TARGET_DEPTH)' '/^[^.][0-9a-zA-Z._%-]+:+.+$(HELP_TARGET_DEPTH).+$$/ { printf "\033[36m%-34s\033[0m %s\n", $$1, $$3 }' $(MAKEFILE_LIST) \
| sort

define MAKE_TARGETS
awk -F':+' '/^[^.%\t_][0-9a-zA-Z._%-]*:+.*$$/ { printf "%s\n", $$1 }' $(MAKEFILE_LIST)
endef

define BASH_AUTOCOMPLETE
complete -W \"$$($(MAKE_TARGETS) | sort | uniq)\" make gmake m
endef

.PHONY: bash-autocomplete
bash-autocomplete:
@echo "$(BASH_AUTOCOMPLETE)"
env:: bash-autocomplete

.PHONY: go-dep-update
go-dep-update: ## Update any Go dependency
@printf "Update dep in go.mod by running e.g. $(BOLD)go get -d github.com/rabbitmq/[email protected]$(NORMAL)\n" \
; read -rp " (press any key when done)" -n 1
$(CURDIR)/hack/update-deps.sh
$(CURDIR)/hack/update-codegen.sh

.PHONY: test-unit
test-unit: ## Run unit tests
@printf "$(INFO)Starting point: $(BOLD).github/workflows/knative-go-test.yaml$(NORMAL)\n"
go test -race $(GOTEST) ./... \
| grep -v "no test files"

.PHONY: test-unit-uncached
test-unit-uncached: GOTEST = -count=1
test-unit-uncached: test-unit

SERVING_NAMESPACE = knative-serving
EVENTING_NAMESPACE = knative-eventing
SYSTEM_NAMESPACE = $(EVENTING_NAMESPACE)
export SYSTEM_NAMESPACE
RABBITMQ_SYSTEM_NAMESPACE = rabbitmq-system
export RABBITMQ_SYSTEM_NAMESPACE
RABBITMQ_SOURCE_NAMESPACE = knative-sources
export RABBITMQ_SOURCE_NAMESPACE
CERT_MANAGER_NAMESPACE = cert-manager
export CERT_MANAGER_NAMESPACE
KIND_CLUSTER_NAME = eventing-rabbitmq-e2e
export KIND_CLUSTER_NAME
env::
@echo 'export KIND_CLUSTER_NAME="$(KIND_CLUSTER_NAME)"'
KO_DOCKER_REPO := kind.local
env::
@echo 'export KO_DOCKER_REPO="$(KO_DOCKER_REPO)"'
export KO_DOCKER_REPO
MIN_SUPPORTED_K8s_VERSION := 1.20
KIND_K8s_VERSION = $(MIN_SUPPORTED_K8s_VERSION)
export KIND_K8s_VERSION
# Find the corresponding version digest in https://github.com/kubernetes-sigs/kind/releases
KIND_K8s_DIGEST := sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9
export KIND_K8s_DIGEST

.PHONY: kind-cluster
kind-cluster: | $(KIND) $(ENVSUBST)
( $(KIND) get clusters | grep $(KIND_CLUSTER_NAME) ) \
|| ( cat $(CURDIR)/test/e2e/kind.yaml \
| $(ENVSUBST_SAFE) \
| $(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config - )

$(KUBECONFIG): | $(KUBECONFIG_DIR)
$(MAKE) --no-print-directory kind-cluster
$(KIND) get kubeconfig --name $(KIND_CLUSTER_NAME) > $(KUBECONFIG)

# https://github.com/rabbitmq/cluster-operator/releases
RABBITMQ_CLUSTER_OPERATOR_VERSION ?= 1.10.0
install-rabbitmq-cluster-operator: | $(KUBECONFIG) $(KUBECTL) ## Install RabbitMQ Cluster Operator
$(KUBECTL) $(K_CMD) --filename \
https://github.com/rabbitmq/cluster-operator/releases/download/v$(RABBITMQ_CLUSTER_OPERATOR_VERSION)/cluster-operator.yml

# https://github.com/jetstack/cert-manager/releases
# ⚠️ You may want to keep this in sync with RABBITMQ_TOPOLOGY_OPERATOR_VERSION
# In other words, don't upgrade cert-manager to a version that was released AFTER RABBITMQ_TOPOLOGY_OPERATOR_VERSION
CERT_MANAGER_VERSION ?= 1.5.4
install-cert-manager: | $(KUBECONFIG) $(KUBECTL) ## Install Cert Manager - dependency of RabbitMQ Topology Operator
$(KUBECTL) $(K_CMD) --filename \
https://github.com/jetstack/cert-manager/releases/download/v$(CERT_MANAGER_VERSION)/cert-manager.yaml
$(KUBECTL) wait --for=condition=available deploy/cert-manager-webhook --timeout=60s --namespace $(CERT_MANAGER_NAMESPACE)

# https://github.com/rabbitmq/messaging-topology-operator/releases
RABBITMQ_TOPOLOGY_OPERATOR_VERSION ?= 1.2.1
install-rabbitmq-topology-operator: | install-cert-manager $(KUBECTL) ## Install RabbitMQ Topology Operator
$(KUBECTL) $(K_CMD) --filename \
https://github.com/rabbitmq/messaging-topology-operator/releases/download/v$(RABBITMQ_TOPOLOGY_OPERATOR_VERSION)/messaging-topology-operator-with-certmanager.yaml

KNATIVE_VERSION ?= 1.0.0

# https://github.com/knative/serving/releases
install-knative-serving: | $(KUBECONFIG) $(KUBECTL) ## Install Knative Serving
$(KUBECTL) $(K_CMD) --filename \
https://github.com/knative/serving/releases/download/knative-v$(KNATIVE_VERSION)/serving-crds.yaml
$(KUBECTL) $(K_CMD) --filename \
https://github.com/knative/serving/releases/download/knative-v$(KNATIVE_VERSION)/serving-core.yaml
$(KUBECTL) wait --for=condition=available deploy/controller --timeout=60s --namespace $(SERVING_NAMESPACE)
$(KUBECTL) wait --for=condition=available deploy/webhook --timeout=60s --namespace $(SERVING_NAMESPACE)
$(KUBECTL) apply --filename https://github.com/knative/net-kourier/releases/download/knative-v$(KNATIVE_VERSION)/kourier.yaml
$(KUBECTL) patch configmap/config-network --namespace $(SERVING_NAMESPACE) --type merge \
--patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'

# https://github.com/knative/eventing/releases
install-knative-eventing: | $(KUBECONFIG) $(KUBECTL) ## Install Knative Eventing
$(KUBECTL) $(K_CMD) --filename \
https://github.com/knative/eventing/releases/download/knative-v$(KNATIVE_VERSION)/eventing-crds.yaml
$(KUBECTL) $(K_CMD) --filename \
https://github.com/knative/eventing/releases/download/knative-v$(KNATIVE_VERSION)/eventing-core.yaml
$(KUBECTL) wait --for=condition=available deploy/eventing-controller --timeout=60s --namespace $(EVENTING_NAMESPACE)
$(KUBECTL) wait --for=condition=available deploy/eventing-webhook --timeout=60s --namespace $(EVENTING_NAMESPACE)

install: | $(KUBECONFIG) $(KO) install-knative-serving install-knative-eventing install-rabbitmq-cluster-operator install-rabbitmq-topology-operator ## Install local dev Knative Eventing RabbitMQ - manages all dependencies, including K8s components
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script is sooo long. Why will be maintaining this? There are 20-30 knative repos. Are we realy like to copy and paste this so many times, and change couple of things, that needs adjusting, in between?!?

Copy link
Contributor Author

@gvmw gvmw Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that your perspective is the wider Knative ecosystem and I must agree that I have not thought about the big picture - my focus is to get this working in the context of this repository.

I recognise the tension between Make it work vs Make it right and while I welcome the second challenge, the focus is on small scope and trying to understand if this approach will even work.

I must emphasise that this is not a script, it's a collection of commands chained together. The distinction may seem insignificant, but it is an important mind shift for approaching Make the right way. This example illustrates Make approached from a different perspective which is valid for that context, but in my opinion it would be the wrong approach for Knative:

https://github.com/ninenines/erlang.mk/blob/d80984c1036ea81eb1f44b8d7cde85fc09b5e3c0/core/deps.mk#L197-L248

$(KO) apply --filename config/broker
$(KUBECTL) wait --for=condition=available deploy/rabbitmq-broker-controller --timeout=60s --namespace $(EVENTING_NAMESPACE)
$(KUBECTL) wait --for=condition=available deploy/rabbitmq-broker-webhook --timeout=60s --namespace $(EVENTING_NAMESPACE)
$(KO) apply --filename config/source
$(KUBECTL) wait --for=condition=available deploy/pingsource-mt-adapter --timeout=60s --namespace knative-eventing

.PHONY: test-e2e-publish
test-e2e-publish: | $(KUBECONFIG) ## Run TestKoPublish end-to-end tests - assumes a K8s with all necessary components installed (Knative & RabbitMQ)
go test -v -race -count=1 -timeout=15m -tags=e2e ./test/e2e/... -run 'TestKoPublish' \
| grep -v "no test files"

.PHONY: test-e2e-broker
test-e2e-broker: | $(KUBECONFIG) ## Run Broker end-to-end tests - assumes a K8s with all necessary components installed (Knative & RabbitMQ)
@printf "$(WARN)$(BOLD)rabbitmqcluster$(NORMAL)$(WARN) has large resource requirements 🤔$(NORMAL)\n"
go test -v -race -count=1 -timeout=15m -tags=e2e ./test/e2e/... -run 'Test.*Broker.*' \
| grep -v "no test files"

.PHONY: test-e2e-source
test-e2e-source: | $(KUBECONFIG) ## Run Source end-to-end tests - assumes a K8s with all necessary components installed (Knative & RabbitMQ)
go test -v -race -count=1 -timeout=15m -tags=e2e ./test/e2e/... -run 'Test.*Source.*' \
| grep -v "no test files"

.PHONY: test-e2e
test-e2e: install test-e2e-publish test-e2e-broker test-e2e-source ## Run all end-to-end tests - manages all dependencies, including K8s components

BUILD_TAGS=e2e
.PHONY: build
build: ## Build binaries with e2e tags
@printf "$(INFO)Starting point: $(BOLD).github/workflows/knative-go-build.yaml$(NORMAL)\n"
go test -vet=off -tags "$(BUILD_TAGS)" -exec echo ./... \
| grep -v "no test files"
Loading