Skip to content

Commit

Permalink
add options to build, push, and only test
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Hayutin <weshayutin@gmail.com>
  • Loading branch information
weshayutin committed Oct 16, 2024
1 parent b1b75f2 commit f36b26c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion Makefile.prow
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ GOSRC := $(GOPATH)/src
OADP_E2E_DIR := /tmp/oadp-operator
OADP_E2E_BRANCH := master
VELERO_IMAGE ?= quay.io/konveyor/velero:latest
LOCAL_BUILT_IMAGE=ttl.sh/velero-$(shell git rev-parse --short HEAD):1h
CLUSTER_ARCH ?= $(shell oc get nodes -o jsonpath='{.items[0].status.nodeInfo.architecture}')
CLUSTER_OS ?= $(shell oc get node -o jsonpath='{.items[0].status.nodeInfo.operatingSystem}')
DOCKER_BUILD_ARGS = --platform=$(CLUSTER_OS)/$(CLUSTER_ARCH)
GINKGO_ARGS ?= "" # by default (empty) run all tests, otherwise specify a test to run


# upstream ci target: verify-modules verify all test
# we need to modify verify, test, all to avoid usage of docker CLI
Expand Down Expand Up @@ -104,9 +110,33 @@ clean-oadp-operator:
@echo "Cleaning oadp-operator"
rm -rf $(OADP_E2E_DIR)

# to run just one test, use `make test-e2e GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'"`
# build the Dockerfile.ubi
.PHONY: build
build:
@echo "Building Dockerfile.ubi with tag: $(LOCAL_BUILT_IMAGE)"
docker build -t $(LOCAL_BUILT_IMAGE) -f Dockerfile.ubi . $(DOCKER_BUILD_ARGS)

# push the image to ttl.sh
.PHONY: push
push:
@echo "Pushing image: $(LOCAL_BUILT_IMAGE)"
docker push $(LOCAL_BUILT_IMAGE)

# test-e2e is to be used by prow.
.PHONY: test-e2e
test-e2e: clone-oadp-operator
@echo "Running oadp-operator e2e tests"
pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(VELERO_IMAGE) && make test-e2e && popd

# build and test locally
.PHONY: local-build-test-e2e
local-build-test-e2e: build push clone-oadp-operator
@echo "Building Velero and Running oadp-operator e2e tests locally"
pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) && export OPENSHIFT_CI=false && make test-e2e && popd

# to run just one test, export GINKGO_ARGS="--ginkgo.focus='MySQL application CSI'"
# do NOT build, test locally
.PHONY: local-test-e2e
local-test-e2e: clone-oadp-operator
@echo "Running oadp-operator e2e tests locally"
pushd $(OADP_E2E_DIR) && export VELERO_IMAGE=$(LOCAL_BUILT_IMAGE) && export OPENSHIFT_CI=false && export GINKGO_ARGS=$(GINKGO_ARGS) && make test-e2e && popd

0 comments on commit f36b26c

Please sign in to comment.