-
Notifications
You must be signed in to change notification settings - Fork 5
Repo maintenance #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| version: 2 | ||
| updates: | ||
| # Docker images | ||
| - package-ecosystem: "docker" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" | ||
| commit-message: | ||
| prefix: "chore:" | ||
|
|
||
| # GitHub Actions | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| commit-message: | ||
| prefix: "chore:" | ||
|
|
||
| - package-ecosystem: "gomod" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "tuesday" | ||
| groups: | ||
| kubernetes: | ||
| patterns: [ "k8s.io/*" ] | ||
| ignore: | ||
| # Ignore controller-runtime, and Kubernetes major and minor updates. These should be done manually. | ||
| - dependency-name: "sigs.k8s.io/controller-runtime" | ||
| update-types: [ "version-update:semver-major", "version-update:semver-minor" ] | ||
| - dependency-name: "k8s.io/*" | ||
| update-types: [ "version-update:semver-major", "version-update:semver-minor" ] | ||
| commit-message: | ||
| prefix: "chore:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # Build the image | ||
| FROM golang:1.20 as builder | ||
| FROM golang:1.23 as builder | ||
|
|
||
| WORKDIR /workspace | ||
| # Copy the Go Modules manifests | ||
|
|
@@ -8,18 +8,16 @@ COPY go.sum go.sum | |
| # cache deps before building and copying source so that we don't need to re-download as much | ||
| # and so that source changes don't invalidate our downloaded layer | ||
| RUN go mod download | ||
| RUN go install github.com/go-task/task/v3/cmd/[email protected] | ||
|
|
||
|
|
||
| # Copy the go source | ||
| COPY . /workspace | ||
|
|
||
| # Build with make to apply all build logic defined in Makefile | ||
| RUN task build | ||
| RUN make build | ||
|
|
||
| # Use distroless as minimal base image to package the manager binary | ||
| # Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
| FROM gcr.io/distroless/static-debian11:latest | ||
| FROM gcr.io/distroless/static:nonroot | ||
| WORKDIR / | ||
| COPY --from=builder /workspace/build/network-operator-init-container . | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Version information | ||
| include Makefile.version | ||
|
|
||
| SHELL = /usr/bin/env bash -o pipefail | ||
| .SHELLFLAGS = -ec | ||
|
|
||
| PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
| BUILD_DIR := ${PROJECT_DIR}/build | ||
|
|
||
| REGISTRY ?= ghcr.io/mellanox | ||
| IMAGE_TAG_BASE ?= $(REGISTRY)/network-operator-init-container | ||
| IMAGE_TAG ?= latest | ||
|
|
||
| # Image URL to use all building/pushing image targets | ||
| IMG ?= $(IMAGE_TAG_BASE):$(IMAGE_TAG) | ||
| DOCKERFILE ?= Dockerfile | ||
|
|
||
| # which container engine to use for image build/push | ||
| DOCKER_CMD ?= docker | ||
|
|
||
| # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. | ||
| ENVTEST_K8S_VERSION = 1.31.0 | ||
|
|
||
| # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
| ifeq (,$(shell go env GOBIN)) | ||
| GOBIN=$(shell go env GOPATH)/bin | ||
| else | ||
| GOBIN=$(shell go env GOBIN) | ||
| endif | ||
|
|
||
| TARGET_OS ?= $(shell go env GOOS) | ||
| TARGET_ARCH ?= $(shell go env GOARCH) | ||
|
|
||
| # Options for go build command | ||
| GO_BUILD_OPTS ?= CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) | ||
| # Linker flags for go build command | ||
| GO_LDFLAGS = $(VERSION_LDFLAGS) | ||
|
|
||
|
|
||
| PKGS = $(or $(PKG),$(shell cd $(PROJECT_DIR) && go list ./...)) | ||
|
|
||
| .PHONY: all | ||
| all: build | ||
|
|
||
| ##@ General | ||
|
|
||
| # The help target prints out all targets with their descriptions organized | ||
| # beneath their categories. The categories are represented by '##@' and the | ||
| # target descriptions by '##'. The awk commands is responsible for reading the | ||
| # entire set of makefiles included in this invocation, looking for lines of the | ||
| # file as xyz: ## something, and then pretty-format the target and help. Then, | ||
| # if there's a line with ##@ something, that gets pretty-printed as a category. | ||
| # More info on the usage of ANSI control characters for terminal formatting: | ||
| # https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters | ||
| # More info on the awk command: | ||
| # http://linuxcommand.org/lc3_adv_awk.php | ||
|
|
||
| .PHONY: help | ||
| help: ## Display this help. | ||
| @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
|
||
| .PHONY: clean | ||
| clean: ## Remove downloaded tools and compiled binaries | ||
| @rm -rf $(LOCALBIN) | ||
| @rm -rf $(BUILD_DIR) | ||
|
|
||
| ##@ Development | ||
|
|
||
| .PHONY: lint | ||
| lint: golangci-lint ## Lint code. | ||
| $(GOLANGCILINT) run --timeout 10m | ||
|
|
||
| COVERAGE_MODE = atomic | ||
| COVER_PROFILE = $(PROJECT_DIR)/cover.out | ||
|
|
||
| .PHONY: unit-test | ||
| unit-test: envtest ## Run tests. | ||
| KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -covermode=$(COVERAGE_MODE) -coverprofile=$(COVER_PROFILE) $(PKGS) | ||
|
|
||
| .PHONY: test | ||
| test: lint unit-test | ||
|
|
||
| ##@ Build | ||
|
|
||
| .PHONY: build | ||
| build: ## Build binary | ||
| $(GO_BUILD_OPTS) go build -ldflags $(GO_LDFLAGS) -o $(BUILD_DIR)/network-operator-init-container ./cmd/network-operator-init-container/main.go | ||
|
|
||
| .PHONY: docker-build | ||
| docker-build: ## Build docker image with ipam binaries | ||
| $(DOCKER_CMD) build -t $(IMG) -f $(DOCKERFILE) . | ||
|
|
||
| .PHONY: docker-push | ||
| docker-push: ## Push docker image with ipam binaries | ||
| $(DOCKER_CMD) push $(IMG) | ||
|
|
||
| ## Location to install dependencies to | ||
| LOCALBIN ?= $(PROJECT_DIR)/bin | ||
| $(LOCALBIN): | ||
| mkdir -p $(LOCALBIN) | ||
|
|
||
| ##@ Tools | ||
|
|
||
| ## Tool Binaries | ||
| ENVTEST ?= $(LOCALBIN)/setup-envtest | ||
| GOLANGCILINT ?= $(LOCALBIN)/golangci-lint | ||
|
|
||
| ## Tool Versions | ||
| GOLANGCILINT_VERSION ?= v1.63.4 | ||
|
|
||
| .PHONY: envtest | ||
| envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. | ||
| $(ENVTEST): | $(LOCALBIN) | ||
| GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
|
|
||
| .PHONY: golangci-lint | ||
| golangci-lint: $(GOLANGCILINT) ## Download golangci-lint locally if necessary. | ||
| $(GOLANGCILINT): | $(LOCALBIN) | ||
| GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # version information | ||
| DATE = $(shell date -u --iso-8601=seconds) | ||
| VERSION ?= | ||
| GIT_TREE_STATE = "" | ||
| GIT_TAG = "" | ||
| GIT_TAG_LAST = "" | ||
| RELEASE_STATUS = "" | ||
|
|
||
| NO_GIT = $(shell git version > /dev/null 2>&1 || echo true) | ||
| ifeq (,$(NO_GIT)) | ||
| # get last commit ID | ||
| COMMIT = $(shell git rev-parse --verify HEAD) | ||
| # Tree state is "dirty" if there are uncommitted changes, untracked files are ignored | ||
| GIT_TREE_STATE = $(shell test -n "`git status --porcelain --untracked-files=no`" && echo "dirty" || echo "clean") | ||
| # Empty string if we are not building a tag | ||
| GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null || true) | ||
| # Find most recent tag | ||
| GIT_TAG_LAST = $(shell git describe --tags --abbrev=0 2>/dev/null || true) | ||
| endif | ||
|
|
||
| # VERSION override mechanism if needed | ||
| ifneq (,$(VERSION)) | ||
| RELEASE_STATUS = ",released" | ||
| endif | ||
|
|
||
| ifneq (,$(GIT_TAG)) | ||
| RELEASE_STATUS = ",released" | ||
| endif | ||
|
|
||
| ifeq (,$(VERSION)) | ||
| VERSION = $(GIT_TAG_LAST) | ||
| endif | ||
|
|
||
| # Add version/commit/date to linker flags | ||
| VERSION_LDFLAGS = "-X github.com/Mellanox/network-operator-init-container/pkg/utils/version/version.version=${VERSION} \ | ||
| -X github.com/Mellanox/network-operator-init-container/pkg/utils/version/version.commit=${COMMIT} \ | ||
| -X github.com/Mellanox/network-operator-init-container/pkg/utils/version/version.gitTreeState=${GIT_TREE_STATE} \ | ||
| -X github.com/Mellanox/network-operator-init-container/pkg/utils/version/version.releaseStatus=${RELEASE_STATUS} \ | ||
| -X github.com/Mellanox/network-operator-init-container/pkg/utils/version/version.date=${DATE}" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove coverage ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restored