Skip to content

Commit

Permalink
Merge pull request #227 from gardener/remove-vendoring
Browse files Browse the repository at this point in the history
Drop vendoring
  • Loading branch information
timuthy authored Jan 17, 2024
2 parents 47ac8aa + 5d36d25 commit 2a135ad
Show file tree
Hide file tree
Showing 5,660 changed files with 334 additions and 1,900,849 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .ci/component_descriptor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

COMPONENT_PREFIXES="europe-docker.pkg.dev/gardener-project/releases/cert-controller-manager" \
"$(dirname $0)"/../vendor/github.com/gardener/gardener/hack/.ci/component_descriptor "$(dirname $0)"/..
COMPONENT_PREFIXES="europe-docker.pkg.dev/gardener-project" \
"$(dirname $0)"/hack/component_descriptor "$(dirname $0)"/..

# print component descriptor for debugging
cat "${COMPONENT_DESCRIPTOR_PATH}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion .ci/prepare_release
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

"$(dirname $0)"/../vendor/github.com/gardener/gardener/hack/.ci/prepare_release "$(dirname $0)"/.. github.com/gardener gardener-extension-shoot-cert-service
"$(dirname $0)"/hack/prepare_release "$(dirname $0)"/.. github.com/gardener gardener-extension-shoot-cert-service
2 changes: 1 addition & 1 deletion .ci/set_dependency_version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

"$(dirname $0)"/../vendor/github.com/gardener/gardener/hack/.ci/set_dependency_version
"$(dirname $0)"/hack/set_dependency_version
5 changes: 0 additions & 5 deletions .ci/verify
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ cd "$(dirname $0)/.."
git config --global user.email "gardener@sap.com"
git config --global user.name "Gardener CI/CD"

# Required due to https://github.com/kubernetes/kubernetes/issues/86753 - can be removed once the issue is fixed.
mkdir -p /go/src/github.com/gardener/gardener-extension-shoot-cert-service
cp -r . /go/src/github.com/gardener/gardener-extension-shoot-cert-service
cd /go/src/github.com/gardener/gardener-extension-shoot-cert-service

make verify-extended
10 changes: 5 additions & 5 deletions .github/workflows/vendor_gardener.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Vendor Gardener
name: Update copied files from Gardener
on:
push:
branches:
- dependabot/go_modules/github.com/gardener/**
permissions: write-all
jobs:
run:
name: Run make revendor
name: Run make tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod

- name: Make revendor
run: make revendor
- name: Make tidy
run: make tidy
- name: Commit changes
run: |
# Exit early if there is nothing to commit. This can happen if someone pushes to the dependabot's PR (for example has to adapt to a breaking change).
Expand All @@ -27,5 +27,5 @@ jobs:
git config user.name gardener-robot-ci-1
git config user.email gardener.ci.user@gmail.com
git add .
git commit -m "[dependabot skip] make revendor"
git commit -m "[dependabot skip] make tidy"
git push origin
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
FROM golang:1.21.6 AS builder

WORKDIR /go/src/github.com/gardener/gardener-extension-shoot-cert-service

# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download

COPY . .
RUN make install

ARG EFFECTIVE_VERSION
RUN make install EFFECTIVE_VERSION=$EFFECTIVE_VERSION

############# gardener-extension-shoot-cert-service
FROM gcr.io/distroless/static-debian11:nonroot AS gardener-extension-shoot-cert-service
Expand Down
56 changes: 30 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,103 +12,107 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ENSURE_GARDENER_MOD := $(shell go get github.com/gardener/gardener@$$(go list -m -f "{{.Version}}" github.com/gardener/gardener))
GARDENER_HACK_DIR := $(shell go list -m -f "{{.Dir}}" github.com/gardener/gardener)/hack
EXTENSION_PREFIX := gardener-extension
NAME := shoot-cert-service
REGISTRY := europe-docker.pkg.dev/gardener-project/public/gardener
IMAGE_PREFIX := $(REGISTRY)/extensions
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
HACK_DIR := $(REPO_ROOT)/hack
VERSION := $(shell cat "$(REPO_ROOT)/VERSION")
LD_FLAGS := "-w -X github.com/gardener/$(EXTENSION_PREFIX)-$(NAME)/pkg/version.Version=$(IMAGE_TAG)"
EFFECTIVE_VERSION := $(VERSION)-$(shell git rev-parse HEAD)
LD_FLAGS := "-w $(shell bash $(GARDENER_HACK_DIR)/get-build-ld-flags.sh k8s.io/component-base $(REPO_ROOT)/VERSION $(EXTENSION_PREFIX))"
LEADER_ELECTION := false
IGNORE_OPERATION_ANNOTATION := true

ifneq ($(strip $(shell git status --porcelain 2>/dev/null)),)
EFFECTIVE_VERSION := $(EFFECTIVE_VERSION)-dirty
endif

#########################################
# Tools #
#########################################

TOOLS_DIR := hack/tools
include $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/tools.mk
include $(GARDENER_HACK_DIR)/tools.mk

#########################################
# Rules for local development scenarios #
#########################################

.PHONY: start
start:
@LEADER_ELECTION_NAMESPACE=garden GO111MODULE=on go run \
-mod=vendor \
@LEADER_ELECTION_NAMESPACE=garden go run \
-ldflags $(LD_FLAGS) \
./cmd/$(EXTENSION_PREFIX)-$(NAME) \
--ignore-operation-annotation=$(IGNORE_OPERATION_ANNOTATION) \
--leader-election=$(LEADER_ELECTION) \
--config=./example/00-config.yaml \
--gardener-version="v1.39.0"
--gardener-version="v1.85.0"

#################################################################
# Rules related to binary build, Docker image build and release #
#################################################################

.PHONY: install
install:
@LD_FLAGS="-w -X github.com/gardener/$(EXTENSION_PREFIX)-$(NAME)/pkg/version.Version=$(VERSION)" \
$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install.sh ./...
@LD_FLAGS=$(LD_FLAGS) EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) \
bash $(GARDENER_HACK_DIR)/install.sh ./...

.PHONY: docker-login
docker-login:
@gcloud auth activate-service-account --key-file .kube-secrets/gcr/gcr-readwrite.json

.PHONY: docker-images
docker-images:
@docker build -t $(IMAGE_PREFIX)/$(NAME):$(VERSION) -t $(IMAGE_PREFIX)/$(NAME):latest -f Dockerfile -m 6g --target $(EXTENSION_PREFIX)-$(NAME) .
@docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) -t $(IMAGE_PREFIX)/$(NAME):$(VERSION) -t $(IMAGE_PREFIX)/$(NAME):latest -f Dockerfile -m 6g --target $(EXTENSION_PREFIX)-$(NAME) .

#####################################################################
# Rules for verification, formatting, linting, testing and cleaning #
#####################################################################

.PHONY: revendor
revendor:
@GO111MODULE=on go mod tidy
@GO111MODULE=on go mod vendor
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/*
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/.ci/*
@$(REPO_ROOT)/hack/update-github-templates.sh
@ln -sf ../vendor/github.com/gardener/gardener/hack/cherry-pick-pull.sh $(HACK_DIR)/cherry-pick-pull.sh
.PHONY: tidy
tidy:
@go mod tidy
@mkdir -p $(REPO_ROOT)/.ci/hack && cp $(GARDENER_HACK_DIR)/.ci/* $(REPO_ROOT)/.ci/hack/ && chmod +xw $(REPO_ROOT)/.ci/hack/*
@GARDENER_HACK_DIR=$(GARDENER_HACK_DIR) $(REPO_ROOT)/hack/update-github-templates.sh
@cp $(GARDENER_HACK_DIR)/cherry-pick-pull.sh $(HACK_DIR)/cherry-pick-pull.sh && chmod +xw $(HACK_DIR)/cherry-pick-pull.sh

.PHONY: clean
clean:
@$(shell find ./example -type f -name "controller-registration.yaml" -exec rm '{}' \;)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/clean.sh ./cmd/... ./pkg/... ./test/...
@bash $(GARDENER_HACK_DIR)/clean.sh ./cmd/... ./pkg/... ./test/...

.PHONY: check-generate
check-generate:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check-generate.sh $(REPO_ROOT)
@bash $(GARDENER_HACK_DIR)/check-generate.sh $(REPO_ROOT)

.PHONY: check
check: $(GOIMPORTS) $(GOLANGCI_LINT) $(HELM)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/... ./test/...
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check-charts.sh ./charts
@bash $(GARDENER_HACK_DIR)/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/... ./test/...
@bash $(GARDENER_HACK_DIR)/check-charts.sh ./charts

.PHONY: generate
generate: $(CONTROLLER_GEN) $(GEN_CRD_API_REFERENCE_DOCS) $(HELM) $(MOCKGEN) $(YQ)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/generate-sequential.sh ./charts/... ./cmd/... ./pkg/... ./test/...
generate: $(CONTROLLER_GEN) $(GEN_CRD_API_REFERENCE_DOCS) $(HELM) $(MOCKGEN) $(YQ) $(VGOPATH)
@VGOPATH=$(VGOPATH) REPO_ROOT=$(REPO_ROOT) GARDENER_HACK_DIR=$(GARDENER_HACK_DIR) bash $(GARDENER_HACK_DIR)/generate-sequential.sh ./charts/... ./cmd/... ./pkg/... ./test/...
$(MAKE) format

.PHONY: format
format: $(GOIMPORTS) $(GOIMPORTSREVISER)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/format.sh ./cmd ./pkg ./test
@bash $(GARDENER_HACK_DIR)/format.sh ./cmd ./pkg ./test

.PHONY: test
test:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test.sh ./cmd/... ./pkg/...
@bash $(GARDENER_HACK_DIR)/test.sh ./cmd/... ./pkg/...

.PHONY: test-cov
test-cov:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover.sh ./cmd/... ./pkg/...
@bash $(GARDENER_HACK_DIR)/test-cover.sh ./cmd/... ./pkg/...

.PHONY: test-clean
test-clean:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover-clean.sh
@bash $(GARDENER_HACK_DIR)/test-cover-clean.sh

.PHONY: verify
verify: check format test
Expand Down
2 changes: 1 addition & 1 deletion charts/gardener-extension-shoot-cert-service/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate sh -c "../../vendor/github.com/gardener/gardener/hack/generate-controller-registration.sh extension-shoot-cert-service . $(cat ../../VERSION) ../../example/controller-registration.yaml Extension:shoot-cert-service"
//go:generate sh -c "bash $GARDENER_HACK_DIR/generate-controller-registration.sh extension-shoot-cert-service . $(cat ../../VERSION) ../../example/controller-registration.yaml Extension:shoot-cert-service"
//go:generate sh -c "sed -i 's/ type: shoot-cert-service/ type: shoot-cert-service\\n workerlessSupported: true/' ../../example/controller-registration.yaml"

// Package chart enables go:generate support for generating the correct controller registration.
Expand Down
3 changes: 3 additions & 0 deletions cmd/gardener-extension-shoot-cert-service/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
componentbaseconfig "k8s.io/component-base/config"
"k8s.io/component-base/version/verflag"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"

Expand All @@ -43,6 +44,8 @@ func NewServiceControllerCommand() *cobra.Command {
SilenceErrors: true,

RunE: func(cmd *cobra.Command, args []string) error {
verflag.PrintAndExitIfRequested()

if err := options.optionAggregator.Complete(); err != nil {
return fmt.Errorf("error completing options: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion example/controller-registration.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion hack/cherry-pick-pull.sh

This file was deleted.

Loading

0 comments on commit 2a135ad

Please sign in to comment.