diff --git a/Makefile b/Makefile index 8d57932f..e31644a3 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,6 @@ E2E_CONF_FILE ?= $(ROOT_DIR)/$(TEST_DIR)/e2e/config/operator.yaml GINKGO_ARGS ?= SKIP_RESOURCE_CLEANUP ?= false USE_EXISTING_CLUSTER ?= false -GITEA_CUSTOM_INGRESS ?= false GINKGO_NOCOLOR ?= false GINKGO_LABEL_FILTER ?= short GINKGO_TESTS ?= $(ROOT_DIR)/$(TEST_DIR)/e2e/suites/... @@ -195,17 +194,11 @@ RELEASE_TAG ?= $(shell git describe --abbrev=0 --exclude 'test/*' 2>/dev/null) # Exclude the current RELEASE_TAG and any tags with the prefix 'test/' PREVIOUS_TAG ?= $(shell git describe --abbrev=0 --exclude $(RELEASE_TAG) --exclude 'test/*' 2>/dev/null) HELM_CHART_TAG := $(shell echo $(RELEASE_TAG) | cut -c 2-) -RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF) CHART_DIR := charts/rancher-turtles RELEASE_DIR ?= out CHART_PACKAGE_DIR ?= $(RELEASE_DIR)/package CHART_RELEASE_DIR ?= $(RELEASE_DIR)/$(CHART_DIR) -# Repo -GH_ORG_NAME ?= $ORG -GH_REPO_NAME ?= turtles -GH_REPO ?= $(GH_ORG_NAME)/$(GH_REPO_NAME) - # Allow overriding the imagePullPolicy PULL_POLICY ?= IfNotPresent @@ -367,21 +360,24 @@ docker-pull-prerequisites: docker pull $(GO_CONTAINER_IMAGE) docker pull gcr.io/distroless/static:latest -.PHONY: docker-build-etcdrestore ## Build the docker image for etcdrestore -docker-build-etcdrestore: buildx-machine docker-pull-prerequisites ## Build docker image for a specific architecture -## reads Dockerfile from stdin to avoid an incorrectly cached Dockerfile (https://github.com/moby/buildkit/issues/1368) +## -------------------------------------- +## Docker - turtles +## -------------------------------------- + +.PHONY: docker-build +docker-build: buildx-machine docker-pull-prerequisites ## Build docker image for a specific architecture # buildx does not support using local registry for multi-architecture images - cat $(EXP_ETCDRESTORE_DIR)/Dockerfile | DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ + DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ --platform $(ARCH) \ --load \ --build-arg builder_image=$(GO_CONTAINER_IMAGE) \ --build-arg goproxy=$(GOPROXY) \ - --build-arg package=./exp/etcdrestore \ - --build-arg ldflags="$(LDFLAGS)" . -t $(ETCDRESTORE_IMG):$(TAG) --file - --progress=plain + --build-arg package=. \ + --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG):$(TAG) -.PHONY: docker-build-and-push-etcdrestore -docker-build-and-push-etcdrestore: buildx-machine docker-pull-prerequisites ## Run docker-build-and-push-etcdrestore targets for all architectures - cat $(EXP_ETCDRESTORE_DIR)/Dockerfile | DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ +.PHONY: docker-build-and-push +docker-build-and-push: buildx-machine docker-pull-prerequisites ## Run docker-build-and-push targets for all architectures + DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ --platform $(TARGET_PLATFORMS) \ --push \ --sbom=true \ @@ -389,23 +385,28 @@ docker-build-and-push-etcdrestore: buildx-machine docker-pull-prerequisites ## R --iidfile=$(IID_FILE) \ --build-arg builder_image=$(GO_CONTAINER_IMAGE) \ --build-arg goproxy=$(GOPROXY) \ - --build-arg package=./exp/etcdrestore \ - --build-arg ldflags="$(LDFLAGS)" . -t $(ETCDRESTORE_IMG):$(TAG) --file - --progress=plain + --build-arg package=. \ + --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG):$(TAG) -.PHONY: docker-build -docker-build: buildx-machine docker-pull-prerequisites ## Build docker image for a specific architecture +## -------------------------------------- +## Docker - etcdrestore +## -------------------------------------- + +.PHONY: docker-build-etcdrestore ## Build the docker image for etcdrestore +docker-build-etcdrestore: buildx-machine docker-pull-prerequisites ## Build docker image for a specific architecture + ## reads Dockerfile from stdin to avoid an incorrectly cached Dockerfile (https://github.com/moby/buildkit/issues/1368) # buildx does not support using local registry for multi-architecture images - DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ + cat $(EXP_ETCDRESTORE_DIR)/Dockerfile | DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ --platform $(ARCH) \ --load \ --build-arg builder_image=$(GO_CONTAINER_IMAGE) \ --build-arg goproxy=$(GOPROXY) \ - --build-arg package=. \ - --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG):$(TAG) + --build-arg package=./exp/etcdrestore \ + --build-arg ldflags="$(LDFLAGS)" . -t $(ETCDRESTORE_IMG):$(TAG) --file - --progress=plain -.PHONY: docker-build-and-push -docker-build-and-push: buildx-machine docker-pull-prerequisites ## Run docker-build-and-push targets for all architectures - DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ +.PHONY: docker-build-and-push-etcdrestore +docker-build-and-push-etcdrestore: buildx-machine docker-pull-prerequisites ## Run docker-build-and-push-etcdrestore targets for all architectures + cat $(EXP_ETCDRESTORE_DIR)/Dockerfile | DOCKER_BUILDKIT=1 BUILDX_BUILDER=$(MACHINE) docker buildx build $(ADDITIONAL_COMMANDS) \ --platform $(TARGET_PLATFORMS) \ --push \ --sbom=true \ @@ -413,8 +414,8 @@ docker-build-and-push: buildx-machine docker-pull-prerequisites ## Run docker-bu --iidfile=$(IID_FILE) \ --build-arg builder_image=$(GO_CONTAINER_IMAGE) \ --build-arg goproxy=$(GOPROXY) \ - --build-arg package=. \ - --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG):$(TAG) + --build-arg package=./exp/etcdrestore \ + --build-arg ldflags="$(LDFLAGS)" . -t $(ETCDRESTORE_IMG):$(TAG) --file - --progress=plain docker-list-all: @echo $(CONTROLLER_IMG):${TAG} diff --git a/exp/etcdrestore/Dockerfile b/exp/etcdrestore/Dockerfile index 5f2d775a..bc11e7e3 100644 --- a/exp/etcdrestore/Dockerfile +++ b/exp/etcdrestore/Dockerfile @@ -18,9 +18,6 @@ # Run this with docker build --build-arg builder_image= ARG builder_image -# Build architecture -ARG ARCH - # Ignore Hadolint rule "Always tag the version of an image explicitly." # It's an invalid finding since the image is explicitly set in the Makefile. # https://github.com/hadolint/hadolint/wiki/DL3006 @@ -38,13 +35,12 @@ ENV GOPROXY=$goproxy COPY ./ ./ # Build -ARG ARCH ARG ldflags # Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ - CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \ + CGO_ENABLED=0 GOOS=linux \ sh -c "cd exp/etcdrestore && ls && go build -trimpath -ldflags \"${ldflags} -extldflags '-static'\" -o manager ${package}" # Production image