Skip to content
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
19 changes: 17 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
directories:
- "/"
- "/hack/tools"
schedule:
interval: "weekly"
day: monday
time: 08:00
timezone: US/Pacific
groups:
kubernetes:
patterns:
Expand All @@ -17,14 +22,24 @@ updates:
- "sigs.k8s.io/*"

- package-ecosystem: "gomod"
directory: "/hack/tools"
directory: "/hack/tools/golangci-lint"
allow:
# golangci-lint claims to be sensitive to dependency updates, so only
# update the tool itself.
- dependency-name: github.com/golangci/golangci-lint/v2
schedule:
interval: "weekly"
day: monday
time: 08:00
timezone: US/Pacific

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: monday
time: 08:00
timezone: US/Pacific
groups:
github-actions:
patterns:
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build
run: make PREFIX=artifacts cmds
- name: install helm and kubectl
run: |
sudo snap install helm --classic
sudo snap install kubectl --classic
- name: install kind
run: |
go install sigs.k8s.io/kind@v0.32.0
- name: Setup e2e
run: make setup-e2e
- name: run e2e test
Expand Down
66 changes: 8 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CONTAINER_TOOL ?= docker
MKDIR ?= mkdir
TR ?= tr
DIST_DIR ?= $(CURDIR)/dist
HELM ?= "go run helm.sh/helm/v3/cmd/helm@latest"
HELM ?= "go tool -modfile $(CURDIR)/hack/tools/go.mod helm"

export IMAGE_GIT_TAG ?= $(shell git describe --tags --always --dirty --match 'v*')
export CHART_GIT_TAG ?= $(shell git describe --tags --always --dirty --match 'chart/*')

include $(CURDIR)/common.mk

BUILDIMAGE_TAG ?= golang$(GO_VERSION)
BUILDIMAGE ?= $(IMAGE_NAME)-build:$(BUILDIMAGE_TAG)

CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))

Expand All @@ -34,8 +30,7 @@ MAKE_TARGETS := binaries build check fmt test examples cmds coverage generate $(

TARGETS := $(MAKE_TARGETS) $(CMD_TARGETS)

DOCKER_TARGETS := $(patsubst %,docker-%, $(TARGETS))
.PHONY: $(TARGETS) $(DOCKER_TARGETS)
.PHONY: $(TARGETS)

GOOS ?= linux

Expand Down Expand Up @@ -76,14 +71,14 @@ assert-fmt:
fi

ineffassign:
ineffassign $(MODULE)/...
go tool -modfile hack/tools/go.mod ineffassign $(MODULE)/...

.PHONY: lint
lint:
golangci-lint run --build-tags=e2e ./...
go tool -modfile hack/tools/golangci-lint/go.mod golangci-lint run --build-tags=e2e ./...

misspell:
misspell $(MODULE)/...
go tool -modfile hack/tools/go.mod misspell $(MODULE)/...

vet:
go vet $(MODULE)/...
Expand All @@ -92,8 +87,7 @@ vet:
test: logcheck
.PHONY: logcheck
logcheck:
(cd hack/tools && GOBIN=$(PWD) go install sigs.k8s.io/logtools/logcheck)
./logcheck -check-contextual -check-deprecations ./...
go tool -modfile hack/tools/go.mod logcheck -check-contextual -check-deprecations ./...

COVERAGE_FILE := coverage.out
test: build cmds
Expand All @@ -108,7 +102,7 @@ generate: generate-deepcopy generate-conversion
generate-deepcopy:
for api in $(APIS); do \
rm -f $${api}/zz_generated.deepcopy.go; \
controller-gen \
go tool -modfile hack/tools/go.mod controller-gen \
object:headerFile=$(CURDIR)/hack/boilerplate.generatego.txt \
paths=$${api}/ \
output:object:dir=$${api}; \
Expand All @@ -117,7 +111,7 @@ generate-deepcopy:
generate-conversion:
for api in $(APIS); do \
rm -f $${api}/zz_generated.conversion.go; \
conversion-gen \
go tool -modfile hack/tools/go.mod conversion-gen \
--go-header-file=$(CURDIR)/hack/boilerplate.generatego.txt \
--output-file=zz_generated.conversion.go \
$${api}/; \
Expand All @@ -132,50 +126,6 @@ test-e2e:
teardown-e2e:
test/e2e/teardown-e2e.sh

# Generate an image for containerized builds
# Note: This image is local only
.PHONY: .build-image
.build-image: docker/Dockerfile.devel
if [ x"$(SKIP_IMAGE_BUILD)" = x"" ]; then \
$(CONTAINER_TOOL) build \
--progress=plain \
--build-arg GO_VERSION="$(GO_VERSION)" \
--tag $(BUILDIMAGE) \
-f $(^) \
docker; \
fi

ifeq ($(CONTAINER_TOOL),podman)
CONTAINER_TOOL_OPTS=-v $(PWD):$(PWD):Z
else
CONTAINER_TOOL_OPTS=-v $(PWD):$(PWD):z --user $$(id -u):$$(id -g)
endif

$(DOCKER_TARGETS): docker-%: .build-image
@echo "Running 'make $(*)' in container $(BUILDIMAGE)"
$(CONTAINER_TOOL) run \
--rm \
-e HOME=$(PWD) \
-e GOCACHE=$(PWD)/.cache/go \
-e GOPATH=$(PWD)/.cache/gopath \
$(CONTAINER_TOOL_OPTS) \
-w $(PWD) \
$(BUILDIMAGE) \
make $(*)

# Start an interactive shell using the development image.
.PHONY: .shell
.shell:
$(CONTAINER_TOOL) run \
--rm \
-ti \
-e HOME=$(PWD) \
-e GOCACHE=$(PWD)/.cache/go \
-e GOPATH=$(PWD)/.cache/gopath \
$(CONTAINER_TOOL_OPTS) \
-w $(PWD) \
$(BUILDIMAGE)

.PHONY: push-release-artifacts
push-release-artifacts:
CHART_VERSION="$${CHART_GIT_TAG##chart/}" \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The procedure below has been tested and verified on both Linux and Mac.

### Prerequisites

* [Go 1.26+](https://go.dev)
* [GNU Make 3.81+](https://www.gnu.org/software/make/)
* [GNU Tar 1.34+](https://www.gnu.org/software/tar/)
* [docker v20.10+ (including buildx)](https://docs.docker.com/engine/install/) or [Podman v4.9+](https://podman.io/docs/installation)
Expand Down
2 changes: 1 addition & 1 deletion demo/scripts/build-driver-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ export VERSION="${DRIVER_IMAGE_TAG}"
export CONTAINER_TOOL="${CONTAINER_TOOL}"

# Regenerate the CRDs and build the container image locally (demo / kind workflow).
make docker-generate
make generate

make -f deployments/container/Makefile "${DRIVER_IMAGE_OS}"
5 changes: 3 additions & 2 deletions demo/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@

# A reference to the current directory where this script is located
SCRIPTS_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
ROOT_DIR="$(git rev-parse --show-toplevel)"

# The name of the example driver
: ${DRIVER_NAME:=dra-example-driver}

# The registry, image and tag for the example driver
: ${DRIVER_IMAGE_REGISTRY:="registry.k8s.io/dra-example-driver"}
: ${DRIVER_IMAGE_NAME:="${DRIVER_NAME}"}
: ${DRIVER_IMAGE_TAG:="$(cat $(git rev-parse --show-toplevel)/deployments/helm/${DRIVER_NAME}/Chart.yaml | grep appVersion | sed 's/"//g' | sed -n 's/^appVersion: //p')"}
: ${DRIVER_IMAGE_TAG:="$(cat ${ROOT_DIR}/deployments/helm/${DRIVER_NAME}/Chart.yaml | grep appVersion | sed 's/"//g' | sed -n 's/^appVersion: //p')"}
# Use DRIVER_IMAGE_OS as the canonical variable name.
# DRIVER_IMAGE_PLATFORM is a deprecated compatibility fallback.
if [[ -n "${DRIVER_IMAGE_PLATFORM:-}" && -z "${DRIVER_IMAGE_OS:-}" ]]; then
Expand Down Expand Up @@ -75,7 +76,7 @@ if [[ -z "${CONTAINER_TOOL}" ]]; then
fi
fi

: ${KIND:="env KIND_EXPERIMENTAL_PROVIDER=${CONTAINER_TOOL} kind"}
: ${KIND:="env KIND_EXPERIMENTAL_PROVIDER=${CONTAINER_TOOL} go tool -modfile ${ROOT_DIR}/hack/tools/go.mod kind"}

# check_demo_config validates image-build env (DRIVER_IMAGE_OS/PLATFORM and
# explicit PLATFORMS settings). Call from image build/push scripts only, after
Expand Down
23 changes: 0 additions & 23 deletions docker/Dockerfile.devel

This file was deleted.

Loading