diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index f91e5c1fe5..0000000000 --- a/.codecov.yml +++ /dev/null @@ -1,8 +0,0 @@ -coverage: - status: - project: - default: - target: 40% - threshold: null - patch: false - changes: false diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c200ef1be5..dd9fd03282 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,6 +44,7 @@ jobs: - 'charts/ingress-nginx/Chart.yaml' - 'charts/ingress-nginx/**/*' + security: runs-on: ubuntu-latest steps: @@ -195,6 +196,7 @@ jobs: kind get kubeconfig > $HOME/.kube/kind-config-kind make kind-e2e-chart-tests + kubernetes: name: Kubernetes runs-on: ubuntu-latest @@ -251,6 +253,7 @@ jobs: kind get kubeconfig > $HOME/.kube/kind-config-kind make kind-e2e-test + kubernetes-chroot: name: Kubernetes chroot runs-on: ubuntu-latest @@ -308,6 +311,7 @@ jobs: kind get kubeconfig > $HOME/.kube/kind-config-kind make kind-e2e-test + test-image-build: permissions: contents: read # for dorny/paths-filter to fetch a list of changed files @@ -374,6 +378,7 @@ jobs: run: | cd images/ext-auth-example-authsvc && make build + test-image: permissions: contents: read # for dorny/paths-filter to fetch a list of changed files diff --git a/Makefile b/Makefile index 3d3e2d25b4..dc7473cf4c 100644 --- a/Makefile +++ b/Makefile @@ -53,9 +53,16 @@ ifneq ($(PLATFORM),) PLATFORM_FLAG="--platform" endif +MAC_OS = $(shell uname -s) +ifeq ($(MAC_OS), Darwin) + MAC_DOCKER_FLAGS="--load" +else + MAC_DOCKER_FLAGS= +endif + REGISTRY ?= jfrog.joom.it/docker-registry/test-rationalex/ingress-nginx -BASE_IMAGE ?= registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a +BASE_IMAGE ?= $(shell cat NGINX_BASE) GOARCH=$(ARCH) @@ -65,12 +72,14 @@ help: ## Display this help .PHONY: image image: clean-image ## Build image for a particular arch. echo "Building docker image ($(ARCH))..." - @docker build \ + docker build \ ${PLATFORM_FLAG} ${PLATFORM} \ --no-cache \ + $(MAC_DOCKER_FLAGS) \ + --pull \ --build-arg BASE_IMAGE="$(BASE_IMAGE)" \ --build-arg VERSION="$(TAG)" \ - --build-arg TARGETARCH="$(ARCH)" \ + --build-arg TARGET_ARCH="$(ARCH)" \ --build-arg COMMIT_SHA="$(COMMIT_SHA)" \ --build-arg BUILD_ID="$(BUILD_ID)" \ -t $(REGISTRY)/controller:$(TAG) rootfs @@ -82,14 +91,16 @@ gosec: .PHONY: image-chroot image-chroot: clean-chroot-image ## Build image for a particular arch. echo "Building docker image ($(ARCH))..." - @docker build \ + docker build \ --no-cache \ + $(MAC_DOCKER_FLAGS) \ + --pull \ --build-arg BASE_IMAGE="$(BASE_IMAGE)" \ --build-arg VERSION="$(TAG)" \ - --build-arg TARGETARCH="$(ARCH)" \ + --build-arg TARGET_ARCH="$(ARCH)" \ --build-arg COMMIT_SHA="$(COMMIT_SHA)" \ --build-arg BUILD_ID="$(BUILD_ID)" \ - -t $(REGISTRY)/controller-chroot:$(TAG) rootfs -f rootfs/Dockerfile.chroot + -t $(REGISTRY)/controller-chroot:$(TAG) rootfs -f rootfs/Dockerfile-chroot .PHONY: clean-image clean-image: ## Removes local image @@ -105,64 +116,82 @@ clean-chroot-image: ## Removes local image .PHONY: build build: ## Build ingress controller, debug tool and pre-stop hook. - @build/run-in-docker.sh \ + build/run-in-docker.sh \ + MAC_OS=$(MAC_OS) \ PKG=$(PKG) \ ARCH=$(ARCH) \ COMMIT_SHA=$(COMMIT_SHA) \ REPO_INFO=$(REPO_INFO) \ TAG=$(TAG) \ - GOBUILD_FLAGS=$(GOBUILD_FLAGS) \ build/build.sh + .PHONY: build-plugin build-plugin: ## Build ingress-nginx krew plugin. @build/run-in-docker.sh \ PKG=$(PKG) \ + MAC_OS=$(MAC_OS) \ ARCH=$(ARCH) \ COMMIT_SHA=$(COMMIT_SHA) \ REPO_INFO=$(REPO_INFO) \ TAG=$(TAG) \ - GOBUILD_FLAGS=$(GOBUILD_FLAGS) \ build/build-plugin.sh + .PHONY: clean clean: ## Remove .gocache directory. rm -rf bin/ .gocache/ .cache/ + .PHONY: static-check static-check: ## Run verification script for boilerplate, codegen, gofmt, golint, lualint and chart-lint. @build/run-in-docker.sh \ hack/verify-all.sh +############################### +# Tests for ingress-nginx +############################### + .PHONY: test test: ## Run go unit tests. @build/run-in-docker.sh \ PKG=$(PKG) \ + MAC_OS=$(MAC_OS) \ ARCH=$(ARCH) \ COMMIT_SHA=$(COMMIT_SHA) \ REPO_INFO=$(REPO_INFO) \ TAG=$(TAG) \ - GOBUILD_FLAGS=$(GOBUILD_FLAGS) \ - build/test.sh + test/test.sh .PHONY: lua-test lua-test: ## Run lua unit tests. @build/run-in-docker.sh \ BUSTED_ARGS=$(BUSTED_ARGS) \ - build/test-lua.sh + MAC_OS=$(MAC_OS) \ + test/test-lua.sh .PHONY: e2e-test e2e-test: ## Run e2e tests (expects access to a working Kubernetes cluster). @build/run-e2e-suite.sh +.PHONY: kind-e2e-test +kind-e2e-test: ## Run e2e tests using kind. + @test/e2e/run.sh + +.PHONY: kind-e2e-chart-tests +kind-e2e-chart-tests: ## Run helm chart e2e tests + @test/e2e/run-chart-test.sh + .PHONY: e2e-test-binary e2e-test-binary: ## Build binary for e2e tests. @build/run-in-docker.sh \ + MAC_OS=$(MAC_OS) \ ginkgo build ./test/e2e .PHONY: print-e2e-suite print-e2e-suite: e2e-test-binary ## Prints information about the suite of e2e tests. @build/run-in-docker.sh \ + MAC_OS=$(MAC_OS) \ hack/print-e2e-suite.sh .PHONY: vet @@ -185,6 +214,8 @@ dev-env: ## Starts a local Kubernetes cluster using kind, building and deployin dev-env-stop: ## Deletes local Kubernetes cluster created by kind. @kind delete cluster --name ingress-nginx-dev + + .PHONY: live-docs live-docs: ## Build and launch a local copy of the documentation website in http://localhost:8000 @docker build ${PLATFORM_FLAG} ${PLATFORM} -t ingress-nginx-docs .github/actions/mkdocs @@ -202,14 +233,6 @@ misspell: ## Check for spelling errors. -error \ cmd/* internal/* deploy/* docs/* design/* test/* README.md -.PHONY: kind-e2e-test -kind-e2e-test: ## Run e2e tests using kind. - @test/e2e/run.sh - -.PHONY: kind-e2e-chart-tests -kind-e2e-chart-tests: ## Run helm chart e2e tests - @test/e2e/run-chart-test.sh - .PHONY: run-ingress-controller run-ingress-controller: ## Run the ingress controller locally using a kubectl proxy connection. @build/run-ingress-controller.sh @@ -223,35 +246,35 @@ show-version: echo -n $(TAG) PLATFORMS ?= amd64 # arm arm64 s390x - -EMPTY := -SPACE := $(EMPTY) $(EMPTY) -COMMA := , +BUILDX_PLATFORMS ?= linux/amd64,linux/arm,linux/arm64,linux/s390x .PHONY: release # Build a multi-arch docker image release: ensure-buildx clean echo "Building binaries..." $(foreach PLATFORM,$(PLATFORMS), echo -n "$(PLATFORM)..."; ARCH=$(PLATFORM) make build;) - echo "Building and pushing ingress-nginx image..." - @docker buildx build \ + echo "Building and pushing ingress-nginx image...$(BUILDX_PLATFORMS)" + + docker buildx build \ --no-cache \ --push \ + --pull \ --progress plain \ - --platform $(subst $(SPACE),$(COMMA),$(PLATFORMS)) \ + --platform $(BUILDX_PLATFORMS) \ --build-arg BASE_IMAGE="$(BASE_IMAGE)" \ --build-arg VERSION="$(TAG)" \ --build-arg COMMIT_SHA="$(COMMIT_SHA)" \ --build-arg BUILD_ID="$(BUILD_ID)" \ -t $(REGISTRY)/controller:$(TAG) rootfs - - @docker buildx build \ + + docker buildx build \ --no-cache \ --push \ + --pull \ --progress plain \ - --platform $(subst $(SPACE),$(COMMA),$(PLATFORMS)) \ + --platform $(BUILDX_PLATFORMS) \ --build-arg BASE_IMAGE="$(BASE_IMAGE)" \ --build-arg VERSION="$(TAG)" \ --build-arg COMMIT_SHA="$(COMMIT_SHA)" \ --build-arg BUILD_ID="$(BUILD_ID)" \ - -t $(REGISTRY)/controller-chroot:$(TAG) rootfs -f rootfs/Dockerfile.chroot + -t $(REGISTRY)/controller-chroot:$(TAG) rootfs -f rootfs/Dockerfile-chroot diff --git a/NGINX_BASE b/NGINX_BASE new file mode 100644 index 0000000000..a882c352d6 --- /dev/null +++ b/NGINX_BASE @@ -0,0 +1 @@ +registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index a865fe927d..210a8e10f0 100755 --- a/build/build.sh +++ b/build/build.sh @@ -14,8 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +GO_BUILD_CMD="go build" + if [ -n "$DEBUG" ]; then set -x + GO_BUILD_CMD="go build -v" fi set -o errexit @@ -31,39 +34,40 @@ mandatory=( TAG ) -missing=false for var in "${mandatory[@]}"; do if [[ -z "${!var:-}" ]]; then echo "Environment variable $var must be set" - missing=true + exit 1 fi done -if [ "$missing" = true ]; then - exit 1 -fi - export CGO_ENABLED=0 export GOARCH=${ARCH} TARGETS_DIR="rootfs/bin/${ARCH}" echo "Building targets for ${ARCH}, generated targets in ${TARGETS_DIR} directory." -go build \ +echo "Building ${PKG}/cmd/nginx" + +${GO_BUILD_CMD} \ -trimpath -ldflags="-buildid= -w -s \ -X ${PKG}/version.RELEASE=${TAG} \ -X ${PKG}/version.COMMIT=${COMMIT_SHA} \ -X ${PKG}/version.REPO=${REPO_INFO}" \ -o "${TARGETS_DIR}/nginx-ingress-controller" "${PKG}/cmd/nginx" -go build \ +echo "Building ${PKG}/cmd/dbg" + +${GO_BUILD_CMD} \ -trimpath -ldflags="-buildid= -w -s \ -X ${PKG}/version.RELEASE=${TAG} \ -X ${PKG}/version.COMMIT=${COMMIT_SHA} \ -X ${PKG}/version.REPO=${REPO_INFO}" \ -o "${TARGETS_DIR}/dbg" "${PKG}/cmd/dbg" -go build \ +echo "Building ${PKG}/cmd/waitshutdown" + +${GO_BUILD_CMD} \ -trimpath -ldflags="-buildid= -w -s \ -X ${PKG}/version.RELEASE=${TAG} \ -X ${PKG}/version.COMMIT=${COMMIT_SHA} \ diff --git a/build/run-e2e-suite.sh b/build/run-e2e-suite.sh index 27f17bed55..d23a504e6b 100755 --- a/build/run-e2e-suite.sh +++ b/build/run-e2e-suite.sh @@ -51,6 +51,9 @@ trap cleanup EXIT E2E_CHECK_LEAKS=${E2E_CHECK_LEAKS:-} FOCUS=${FOCUS:-.*} +BASEDIR=$(dirname "$0") +NGINX_BASE_IMAGE=$(cat $BASEDIR/../NGINX_BASE) + export E2E_CHECK_LEAKS export FOCUS @@ -76,6 +79,7 @@ kubectl run --rm \ --env="E2E_NODES=${E2E_NODES}" \ --env="FOCUS=${FOCUS}" \ --env="E2E_CHECK_LEAKS=${E2E_CHECK_LEAKS}" \ + --env="NGINX_BASE_IMAGE=${NGINX_BASE_IMAGE}" \ --overrides='{ "apiVersion": "v1", "spec":{"serviceAccountName": "ingress-nginx-e2e"}}' \ e2e --image=nginx-ingress-controller:e2e diff --git a/build/run-in-docker.sh b/build/run-in-docker.sh index db8a329935..8f04a99205 100755 --- a/build/run-in-docker.sh +++ b/build/run-in-docker.sh @@ -14,7 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -if [ -n "$DEBUG" ]; then +DEBUG=${DEBUG:-"false"} +if [ "$DEBUG" == "true" ]; then set -x fi @@ -62,6 +63,14 @@ else PLATFORM_FLAG= fi +USER=${USER:-nobody} + +if [[ ${MAC_OS} == "Darwin" ]]; then + MAC_DOCKER_FLAGS="" +else + MAC_DOCKER_FLAGS="-u $(id -u ${USER}):$(id -g ${USER})" #idk why mac/git fails on the gobuild if these are presented to dockerrun.sh script +fi + echo "..printing env & other vars to stdout" echo "HOSTNAME=`hostname`" uname -a @@ -74,20 +83,21 @@ if [[ "$DOCKER_IN_DOCKER_ENABLED" == "true" ]]; then echo "FLAGS=$FLAGS" go env set -x - go install -mod=mod github.com/onsi/ginkgo/ginkgo@v1.16.4 + go install -mod=mod github.com/onsi/ginkgo/ginkgo@v1.16.4 find / -type f -name ginkgo 2>/dev/null which ginkgo /bin/bash -c "${FLAGS}" set +x else - echo "..reached DIND check ELSE block, inside run-in-docker.sh" + echo "Reached DIND check ELSE block, inside run-in-docker.sh" docker run \ ${PLATFORM_FLAG} ${PLATFORM} \ --tty \ --rm \ ${DOCKER_OPTS} \ + -e DEBUG=${DEBUG} \ -e GOCACHE="/go/src/${PKG}/.cache" \ - -e GOMODCACHE="/go/src/${PKG}/.modcache" \ + -e GOMODCACHE="/go/src/${PKG}/.modcache" \ -e DOCKER_IN_DOCKER_ENABLED="true" \ -v "${HOME}/.kube:${HOME}/.kube" \ -v "${KUBE_ROOT}:/go/src/${PKG}" \ @@ -95,6 +105,6 @@ else -v "/var/run/docker.sock:/var/run/docker.sock" \ -v "${INGRESS_VOLUME}:/etc/ingress-controller/" \ -w "/go/src/${PKG}" \ - -u $(id -u ${USER}):$(id -g ${USER}) \ + ${MAC_DOCKER_FLAGS} \ ${E2E_IMAGE} /bin/bash -c "${FLAGS}" fi diff --git a/images/echo/Makefile b/images/echo/Makefile index 66b3af7ebd..500704e81c 100644 --- a/images/echo/Makefile +++ b/images/echo/Makefile @@ -26,6 +26,7 @@ IMAGE = $(REGISTRY)/e2e-test-echo # required to enable buildx export DOCKER_CLI_EXPERIMENTAL=enabled +BASE_IMAGE = $(shell cat $(DIR)/../../NGINX_BASE) # build with buildx PLATFORMS?=linux/amd64 OUTPUT= @@ -36,7 +37,7 @@ build: ensure-buildx --platform=${PLATFORMS} $(OUTPUT) \ --progress=$(PROGRESS) \ --pull \ - --build-arg BASE_IMAGE=registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a \ + --build-arg BASE_IMAGE=${BASE_IMAGE} \ --build-arg LUAROCKS_VERSION=3.8.0 \ --build-arg LUAROCKS_SHA=ab6612ca9ab87c6984871d2712d05525775e8b50172701a0a1cabddf76de2be7 \ -t $(IMAGE):$(TAG) rootfs diff --git a/images/nginx/README.md b/images/nginx/README.md index a7e3277007..da6994fb53 100644 --- a/images/nginx/README.md +++ b/images/nginx/README.md @@ -19,7 +19,9 @@ This image provides a default configuration file with no backend servers. _Using docker_ +NGINX base image we use is defined in NGINX_BASE file at the root of the project + ```console -docker run -v /some/nginx.conf:/etc/nginx/nginx.conf:ro registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a +docker run -v /some/nginx.conf:/etc/nginx/nginx.conf:ro $(cat ../../NGINX_BASE) ``` diff --git a/images/test-runner/Makefile b/images/test-runner/Makefile index e6547f2fec..ecd4e5f584 100644 --- a/images/test-runner/Makefile +++ b/images/test-runner/Makefile @@ -23,7 +23,7 @@ REGISTRY ?= local IMAGE = $(REGISTRY)/e2e-test-runner -NGINX_BASE_IMAGE ?= registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a +NGINX_BASE_IMAGE ?= $(shell cat $DIR/../../NGINX_BASE) # required to enable buildx export DOCKER_CLI_EXPERIMENTAL=enabled diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index 62c9bd0b6a..4df7511eef 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -16,7 +16,7 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} -ARG TARGETARCH +ARG TARGET_ARCH ARG VERSION ARG COMMIT_SHA ARG BUILD_ID=UNSET @@ -41,9 +41,9 @@ RUN apk update \ COPY --chown=www-data:www-data etc /etc -COPY --chown=www-data:www-data bin/${TARGETARCH}/dbg / -COPY --chown=www-data:www-data bin/${TARGETARCH}/nginx-ingress-controller / -COPY --chown=www-data:www-data bin/${TARGETARCH}/wait-shutdown / +COPY --chown=www-data:www-data bin/${TARGET_ARCH}/dbg / +COPY --chown=www-data:www-data bin/${TARGET_ARCH}/nginx-ingress-controller / +COPY --chown=www-data:www-data bin/${TARGET_ARCH}/wait-shutdown / # Fix permission during the build to avoid issues at runtime # with volumes (custom templates) diff --git a/rootfs/Dockerfile.chroot b/rootfs/Dockerfile-chroot similarity index 95% rename from rootfs/Dockerfile.chroot rename to rootfs/Dockerfile-chroot index 69d2a0f712..2de47a71e8 100644 --- a/rootfs/Dockerfile.chroot +++ b/rootfs/Dockerfile-chroot @@ -25,7 +25,7 @@ RUN apk update \ FROM alpine:3.16.0 -ARG TARGETARCH +ARG TARGET_ARCH ARG VERSION ARG COMMIT_SHA ARG BUILD_ID=UNSET @@ -64,9 +64,9 @@ COPY --from=chroot /chroot /chroot COPY --chown=www-data:www-data etc /chroot/etc -COPY --chown=www-data:www-data bin/${TARGETARCH}/dbg / -COPY --chown=www-data:www-data bin/${TARGETARCH}/nginx-ingress-controller / -COPY --chown=www-data:www-data bin/${TARGETARCH}/wait-shutdown / +COPY --chown=www-data:www-data bin/${TARGET_ARCH}/dbg / +COPY --chown=www-data:www-data bin/${TARGET_ARCH}/nginx-ingress-controller / +COPY --chown=www-data:www-data bin/${TARGET_ARCH}/wait-shutdown / COPY --chown=www-data:www-data nginx-chroot-wrapper.sh /usr/bin/nginx WORKDIR /chroot/etc/nginx diff --git a/test/e2e-image/Dockerfile b/test/e2e-image/Dockerfile index ab6b674afb..e29c7524b6 100644 --- a/test/e2e-image/Dockerfile +++ b/test/e2e-image/Dockerfile @@ -1,4 +1,5 @@ -FROM registry.k8s.io/ingress-nginx/e2e-test-runner:v20220624-g3348cd71e@sha256:2a34e322b7ff89abdfa0b6202f903bf5618578b699ff609a3ddabac0aae239c8 AS BASE +ARG E2E_BASE_IMAGE +FROM ${E2E_BASE_IMAGE} AS BASE FROM alpine:3.16.0 diff --git a/test/e2e-image/Makefile b/test/e2e-image/Makefile index 3a012a2dfd..2973c5dad2 100644 --- a/test/e2e-image/Makefile +++ b/test/e2e-image/Makefile @@ -1,5 +1,6 @@ DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +E2E_BASE_IMAGE="k8s.gcr.io/ingress-nginx/e2e-test-runner:v20220110-gfd820db46@sha256:273f7d9b1b2297cd96b4d51600e45d932186a1cc79d00d179dfb43654112fe8f" image: echo "..entered Makefile in /test/e2e-image" @@ -15,6 +16,7 @@ image: cp -R $(DIR)/../../test/e2e/settings/ocsp/* . docker build \ + --build-arg E2E_BASE_IMAGE=$(E2E_BASE_IMAGE) \ --tag nginx-ingress-controller:e2e . clean: diff --git a/test/e2e/framework/deployment.go b/test/e2e/framework/deployment.go index 3007d7d3a4..f5da9ebe80 100644 --- a/test/e2e/framework/deployment.go +++ b/test/e2e/framework/deployment.go @@ -18,6 +18,8 @@ package framework import ( "context" + "errors" + "os" "time" "github.com/onsi/ginkgo" @@ -37,13 +39,11 @@ const SlowEchoService = "slow-echo" // HTTPBinService name of the deployment for the httpbin app const HTTPBinService = "httpbin" -// NginxBaseImage use for testing -const NginxBaseImage = "registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a" - type deploymentOptions struct { namespace string name string replicas int + image string } // WithDeploymentNamespace allows configuring the deployment's namespace @@ -67,7 +67,7 @@ func WithDeploymentReplicas(r int) func(*deploymentOptions) { } } -// NewEchoDeployment creates a new single replica deployment of the echoserver image in a particular namespace +// NewEchoDeployment creates a new single replica deployment of the echo server image in a particular namespace func (f *Framework) NewEchoDeployment(opts ...func(*deploymentOptions)) { options := &deploymentOptions{ namespace: f.Namespace, @@ -150,6 +150,16 @@ http { f.NGINXWithConfigDeployment(SlowEchoService, cfg) } +func (f *Framework) GetNginxBaseImage() string { + nginxBaseImage := os.Getenv("NGINX_BASE_IMAGE") + + if nginxBaseImage == "" { + assert.NotEmpty(ginkgo.GinkgoT(), errors.New("NGINX_BASE_IMAGE not defined"), "NGINX_BASE_IMAGE not defined") + } + + return nginxBaseImage +} + // NGINXDeployment creates a new simple NGINX Deployment using NGINX base image // and passing the desired configuration func (f *Framework) NGINXDeployment(name string, cfg string, waitendpoint bool) { @@ -166,7 +176,7 @@ func (f *Framework) NGINXDeployment(name string, cfg string, waitendpoint bool) }, metav1.CreateOptions{}) assert.Nil(ginkgo.GinkgoT(), err, "creating configmap") - deployment := newDeployment(name, f.Namespace, NginxBaseImage, 80, 1, + deployment := newDeployment(name, f.Namespace, f.GetNginxBaseImage(), 80, 1, nil, []corev1.VolumeMount{ { diff --git a/test/e2e/run-chart-test.sh b/test/e2e/run-chart-test.sh index 0e618244ca..49ec146a70 100755 --- a/test/e2e/run-chart-test.sh +++ b/test/e2e/run-chart-test.sh @@ -50,6 +50,13 @@ export TAG=1.0.0-dev export ARCH=${ARCH:-amd64} export REGISTRY=ingress-controller +BASEDIR=$(dirname "$0") +NGINX_BASE_IMAGE=$(cat $BASEDIR/../../NGINX_BASE) + +echo "Running e2e with nginx base image ${NGINX_BASE_IMAGE}" + +export NGINX_BASE_IMAGE=$NGINX_BASE_IMAGE + export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/kind-config-$KIND_CLUSTER_NAME}" if [ "${SKIP_CLUSTER_CREATION:-false}" = "false" ]; then diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 00ea732999..6edc188481 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -51,6 +51,12 @@ export TAG=1.0.0-dev export ARCH=${ARCH:-amd64} export REGISTRY=ingress-controller +NGINX_BASE_IMAGE=$(cat $DIR/../../NGINX_BASE) + +echo "Running e2e with nginx base image ${NGINX_BASE_IMAGE}" + +export NGINX_BASE_IMAGE=$NGINX_BASE_IMAGE + export DOCKER_CLI_EXPERIMENTAL=enabled export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/kind-config-$KIND_CLUSTER_NAME}" diff --git a/build/test-lua.sh b/test/test-lua.sh similarity index 100% rename from build/test-lua.sh rename to test/test-lua.sh diff --git a/build/test.sh b/test/test.sh similarity index 100% rename from build/test.sh rename to test/test.sh