From 42a10b0960b7785669b97a3c850fb41373e9840e Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Wed, 23 Aug 2023 11:34:41 -0400 Subject: [PATCH 1/2] Add basic build machinery for CI Signed-off-by: Jason Tang --- .gitmodules | 3 +++ Makefile | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ build | 1 + 3 files changed, 82 insertions(+) create mode 100644 .gitmodules create mode 100644 Makefile create mode 160000 build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c2fad47 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "build"] + path = build + url = https://github.com/upbound/build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..66da1dd --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +# Project Setup +PROJECT_NAME := configuration-caas +PROJECT_REPO := github.com/upbound/$(PROJECT_NAME) + +# NOTE(hasheddan): the platform is insignificant here as Configuration package +# images are not architecture-specific. We constrain to one platform to avoid +# needlessly pushing a multi-arch image. +PLATFORMS ?= linux_amd64 +-include build/makelib/common.mk + +# ==================================================================================== +# Setup Kubernetes tools + +UP_VERSION = v0.18.0 +UP_CHANNEL = stable +UPTEST_VERSION = v0.2.1 + +-include build/makelib/k8s_tools.mk +# ==================================================================================== +# Setup XPKG + +# NOTE(jastang): Configurations deployed in Upbound do not currently follow +# certain conventions such as the default examples root or package directory. +XPKG_DIR = $(shell pwd) +XPKG_EXAMPLES_DIR = .up/examples + +XPKG_REG_ORGS ?= xpkg.upbound.io/upbound +# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are +# inferred. +XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/upbound +XPKGS = $(PROJECT_NAME) +-include build/makelib/xpkg.mk + +CROSSPLANE_NAMESPACE = upbound-system +CROSSPLANE_ARGS = "--enable-environment-configs" +-include build/makelib/local.xpkg.mk +-include build/makelib/controlplane.mk + +# ==================================================================================== +# Targets + +# run `make help` to see the targets and options + +# We want submodules to be set up the first time `make` is run. +# We manage the build/ folder and its Makefiles as a submodule. +# The first time `make` is run, the includes of build/*.mk files will +# all fail, and this target will be run. The next time, the default as defined +# by the includes will be run instead. +fallthrough: submodules + @echo Initial setup complete. Running make again . . . + @make + +# Update the submodules, such as the common build scripts. +submodules: + @git submodule sync + @git submodule update --init --recursive + +# We must ensure up is installed in tool cache prior to build as including the k8s_tools machinery prior to the xpkg +# machinery sets UP to point to tool cache. +build.init: $(UP) + +# ==================================================================================== +# End to End Testing + +# This target requires the following environment variables to be set: +# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials) +# - To ensure the proper functioning of the end-to-end test resource pre-deletion hook, it is crucial to arrange your resources appropriately. +# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/templates/01-delete.yaml.tmpl. +uptest: $(UPTEST) $(KUBECTL) $(KUTTL) + @$(INFO) running automated tests + @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/app-claim.yaml,examples/mariadb-claim.yaml,examples/cluster-claim.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL) + @$(OK) running automated tests + +# This target requires the following environment variables to be set: +# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials) +e2e: build controlplane.up local.xpkg.deploy.configuration.$(PROJECT_NAME) uptest + +.PHONY: uptest e2e \ No newline at end of file diff --git a/build b/build new file mode 160000 index 0000000..a6e25af --- /dev/null +++ b/build @@ -0,0 +1 @@ +Subproject commit a6e25afa0d43da62b11af96a5d29627a52f32cd9 From 6759d70beb72cc08246a73ede099cae693efe014 Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Wed, 23 Aug 2023 11:49:31 -0400 Subject: [PATCH 2/2] Remove E2E configs for now. Signed-off-by: Jason Tang --- Makefile | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/Makefile b/Makefile index 66da1dd..e165b15 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,6 @@ XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/upbound XPKGS = $(PROJECT_NAME) -include build/makelib/xpkg.mk -CROSSPLANE_NAMESPACE = upbound-system -CROSSPLANE_ARGS = "--enable-environment-configs" -include build/makelib/local.xpkg.mk -include build/makelib/controlplane.mk @@ -58,21 +56,3 @@ submodules: # We must ensure up is installed in tool cache prior to build as including the k8s_tools machinery prior to the xpkg # machinery sets UP to point to tool cache. build.init: $(UP) - -# ==================================================================================== -# End to End Testing - -# This target requires the following environment variables to be set: -# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials) -# - To ensure the proper functioning of the end-to-end test resource pre-deletion hook, it is crucial to arrange your resources appropriately. -# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/templates/01-delete.yaml.tmpl. -uptest: $(UPTEST) $(KUBECTL) $(KUTTL) - @$(INFO) running automated tests - @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/app-claim.yaml,examples/mariadb-claim.yaml,examples/cluster-claim.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL) - @$(OK) running automated tests - -# This target requires the following environment variables to be set: -# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials) -e2e: build controlplane.up local.xpkg.deploy.configuration.$(PROJECT_NAME) uptest - -.PHONY: uptest e2e \ No newline at end of file