Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from "up xpkg" to "crossplane xpkg" #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion makelib/k8s_tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ UP_CHANNEL ?= stable
UP := $(TOOLS_HOST_DIR)/up-$(UP_VERSION)

# the version of crossplane cli to use
CROSSPLANE_CLI_VERSION ?= v1.14.5
CROSSPLANE_CLI_VERSION ?= v1.17.0
CROSSPLANE_CLI_CHANNEL ?= stable
CROSSPLANE_CLI := $(TOOLS_HOST_DIR)/crossplane-cli-$(CROSSPLANE_CLI_VERSION)

Expand Down
27 changes: 8 additions & 19 deletions makelib/xpkg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ ifeq ($(origin XPKG_DIR),undefined)
XPKG_DIR := $(ROOT_DIR)/package
endif

# xref https://github.com/upbound/provider-aws/pull/647, https://github.com/upbound/up/pull/309
# in up v0.16.0, support for ProviderConfig documentation via object annotations was added.
# by convention, we will assume the extensions file resides in the package directory.
ifeq ($(origin XPKG_AUTH_EXT),undefined)
XPKG_AUTH_EXT := $(XPKG_DIR)/auth.yaml
endif
Comment on lines -22 to -27
Copy link
Author

Choose a reason for hiding this comment

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

I do not quite understand what this is for. but does not seem to be supported by the crossplane-cli

Copy link
Member

Choose a reason for hiding this comment

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

I don't recall the history here. 🤔

@turkehnf @sergenyalcin do you know if removing this will be a problem for upjet providers?


ifeq ($(origin XPKG_EXAMPLES_DIR),undefined)
XPKG_EXAMPLES_DIR := $(ROOT_DIR)/examples
endif
Expand Down Expand Up @@ -62,27 +55,23 @@ XPKG_PLATFORMS_LIST := $(subst _,/,$(filter linux_%,$(PLATFORMS)))
XPKG_PLATFORM := $(subst _,/,$(PLATFORM))
XPKG_CLEANUP_EXAMPLES_VERSION ?= v0.12.1

# TODO(negz): Update these targets to use the crossplane CLI, not up.
UP ?= up

# =====================================================================================
# XPKG Targets

# 1: xpkg
define xpkg.build.targets
xpkg.build.$(1):
xpkg.build.$(1): $(CROSSPLANE_CLI)
@rm -rf $(WORK_DIR)/xpkg-cleaned-examples
@GOOS=$(HOSTOS) GOARCH=$(TARGETARCH) go run github.com/upbound/uptest/cmd/cleanupexamples@$(XPKG_CLEANUP_EXAMPLES_VERSION) $(XPKG_EXAMPLES_DIR) $(WORK_DIR)/xpkg-cleaned-examples || $(FAIL)
@$(INFO) Building package $(1)-$(VERSION).xpkg for $(PLATFORM)
@mkdir -p $(OUTPUT_DIR)/xpkg/$(PLATFORM)
@controller_arg=$$$$(grep -E '^kind:\s+Provider\s*$$$$' $(XPKG_DIR)/crossplane.yaml > /dev/null && echo "--controller $(BUILD_REGISTRY)/$(1)-$(ARCH)"); \
$(UP) xpkg build \
$$$${controller_arg} \
@embed_image_arg=$$$$(grep -E '^kind:\s+Provider\s*$$$$' $(XPKG_DIR)/crossplane.yaml > /dev/null && echo "--embed-runtime-image $(BUILD_REGISTRY)/$(1)-$(ARCH)"); \
$(CROSSPLANE_CLI) xpkg build \
$$$${embed_image_arg} \
--package-root $(XPKG_DIR) \
--auth-ext $(XPKG_AUTH_EXT) \
--examples-root $(WORK_DIR)/xpkg-cleaned-examples \
--ignore $(XPKG_IGNORE) \
--output $(XPKG_OUTPUT_DIR)/$(PLATFORM)/$(1)-$(VERSION).xpkg || $(FAIL)
--package-file $(XPKG_OUTPUT_DIR)/$(PLATFORM)/$(1)-$(VERSION).xpkg || $(FAIL)
@$(OK) Built package $(1)-$(VERSION).xpkg for $(PLATFORM)
@rm -rf $(WORK_DIR)/xpkg-cleaned-examples
xpkg.build: xpkg.build.$(1)
Expand All @@ -91,10 +80,10 @@ $(foreach x,$(XPKGS),$(eval $(call xpkg.build.targets,$(x))))

# 1: registry/org 2: repo
define xpkg.release.targets
xpkg.release.publish.$(1).$(2):
xpkg.release.publish.$(1).$(2): $(CROSSPLANE_CLI)
@$(INFO) Pushing package $(1)/$(2):$(VERSION)
@$(UP) xpkg push \
$(foreach p,$(XPKG_LINUX_PLATFORMS),--package $(XPKG_OUTPUT_DIR)/$(p)/$(2)-$(VERSION).xpkg ) \
@$(CROSSPLANE_CLI) xpkg push --package-files \
$(subst $(SPACE),$(COMMA),$(foreach p,$(XPKG_LINUX_PLATFORMS),$(XPKG_OUTPUT_DIR)/$(p)/$(2)-$(VERSION).xpkg)) \
$(1)/$(2):$(VERSION) || $(FAIL)
@$(OK) Pushed package $(1)/$(2):$(VERSION)
xpkg.release.publish: xpkg.release.publish.$(1).$(2)
Expand Down