@@ -43,11 +43,15 @@ GO_LDFLAGS := -ldflags "-X github.com/NVIDIA/skyhook/internal/version.GIT_SHA=$
4343 -X github.com/NVIDIA/skyhook/internal/version.VERSION=$(VERSION ) "
4444GOFLAGS := -mod=vendor
4545
46- # CONTAINER_TOOL defines the container tool to be used for building images.
46+ # DOCKER_CMD defines the container tool to be used for building images.
4747# Be aware that the target commands are only tested with Docker which is
4848# scaffolded by default. However, you might want to replace it to use other
4949# tools. (i.e. podman)
50- CONTAINER_TOOL ?= podman
50+ DOCKER_CMD ?= podman
51+
52+ ifdef CI
53+ DOCKER_CMD = docker
54+ endif
5155
5256# Setting SHELL to bash allows bash commands to be executed by recipes.
5357# Options are set to exit when a recipe line exits non-zero or a piped command fails.
@@ -137,7 +141,7 @@ $(REPORTING):
137141.PHONY : test
138142test :: reporting manifests generate fmt vet lint helm-tests e2e-tests unit-tests # # Run all tests.
139143
140- ifndef GITLAB_CI
144+ ifndef CI
141145# # we double define test so we can do thing different if in ci vs local
142146test :: merge-coverage
143147 echo " Total Code Coverage: $( shell go tool cover -func $( REPORTING) /cover.out | grep total | awk ' {print $$NF}' ) "
@@ -153,19 +157,21 @@ watch-tests: ## watch unit tests and auto run on changes.
153157 $(GINKGO ) watch $(GOFLAGS ) -p -vv ./...
154158
155159.PHONY : unit-test
156- unit-tests : reporting envtest ginkgo kill # # Run unit tests.
157- KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " $(GINKGO ) $(GOFLAGS ) --coverprofile=$(REPORTING ) /unit.coverprofile -vv --trace --junit-report=$(REPORTING ) /unit.xml --keep-going --timeout=90s ./...
160+ unit-tests : reporting manifests generate envtest ginkgo kill # # Run unit tests.
161+ KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " $(GINKGO ) $(GOFLAGS ) --coverprofile=$(REPORTING ) /unit.coverprofile -vv --trace --junit-report=$(REPORTING ) /unit.xml --keep-going --timeout=180s ./...
158162
159163# # exec time is for things like scripts and commands, if we new more of these, might want to switch to a config file
160164# # https://kyverno.github.io/chainsaw/latest/reference/commands/chainsaw_test/
161165# # https://kyverno.github.io/chainsaw/latest/configuration/file/
162166CHAINSAW_ARGS: =--exec-timeout 30s
163167
164168e2e-tests : chainsaw run # # Run end to end tests.
169+ echo $(VERSION )
170+ echo $(GO_LDFLAGS )
165171 # # requires a cluster to be running with access
166172 # # locally use kind to create clusters
167173 # # in ci, the plan current is to have a real cluster, and create a node pool for testing
168- $(CHAINSAW ) test --test-dir e2e/ chainsaw/skyhook $(CHAINSAW_ARGS )
174+ $(CHAINSAW ) test --test-dir ../k8s-tests/ chainsaw/skyhook/interrupt-grouping $(CHAINSAW_ARGS )
169175 $(MAKE ) kill
170176 go tool covdata textfmt -i=$(REPORTING ) /int -o reporting/int.coverprofile
171177
@@ -176,17 +182,24 @@ helm-tests: helm chainsaw
176182 $(MAKE ) run
177183 $(MAKE ) uninstall ignore-not-found=true
178184 $(MAKE ) kill
185+ $(CHAINSAW ) test --test-dir ../k8s-tests/chainsaw/helm $(CHAINSAW_ARGS )
179186
180- $(CHAINSAW) test --test-dir e2e/chainsaw/helm $(CHAINSAW_ARGS)
187+
188+ ifeq ($(DOCKER_CMD ) ,docker)
189+ DOCKER_AUTH_FILE =${HOME}/.docker/config.json
190+ else
191+ DOCKER_AUTH_FILE =${HOME}/.config/containers/auth.json
192+ endif
181193
182194create-kind-cluster : # # deletes and creates a new kind cluster. versions is set via KIND_VERSION
195+ ifdef CI
196+ @echo $(GITHUB_TOKEN) | docker login ghcr.io -u $(GITHUB_ACTOR) --password-stdin
197+ endif
183198 kind delete cluster && kind create cluster --image=kindest/node:v$(KIND_VERSION) --config config/local-dev/kind-config.yaml
184199 $(KUBECTL) label node/kind-worker skyhook.nvidia.com/test-node=skyhooke2e
185-
186- # # sets you local podman creds into a secret in kind in the skyhook namespace
187- $(KUBECTL ) create namespace $(SKYHOOK_NAMESPACE ) --dry-run=client -o yaml | kubectl apply -f -
200+ $(KUBECTL) create namespace skyhook
188201 $(KUBECTL) create secret generic node-init-secret --type=kubernetes.io/dockerconfigjson -n $(SKYHOOK_NAMESPACE) \
189- --from-file=.dockerconfigjson=${HOME} /.config/containers/auth.json
202+ --from-file=.dockerconfigjson=$(DOCKER_AUTH_FILE)
190203
191204podman-create-machine : # # creates a podman machine
192205 podman machine stop podman-machine-default || true
@@ -240,7 +253,7 @@ build: manifests generate fmt vet lint ## Build manager binary.
240253.PHONY : run
241254ENABLE_WEBHOOKS? =false
242255BACKGROUND? =true
243- AGENT_IMAGE? =nvcr .io/nvidian/swgpu-baseos /agentless-test :6.2.0
256+ AGENT_IMAGE? =ghcr .io/nvidia/skyhook /agentless:6.2.0
244257LOG_LEVEL? =info
245258run : manifests generate fmt vet lint reporting install kill # # Run a controller from your host.
246259 mkdir -p $(REPORTING ) /int
@@ -263,7 +276,7 @@ kill:
263276# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
264277.PHONY : docker-build
265278docker-build : # # Build docker image with the manager.
266- $(CONTAINER_TOOL ) build -f containers/operator.Dockerfile -t ${IMG} .
279+ $(DOCKER_CMD ) build -f containers/operator.Dockerfile -t ${IMG} .
267280
268281# #@ Deployment
269282
0 commit comments