From 19bc17baadf55ed5c37b08b24a6915bf565c0400 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Mon, 19 Jul 2021 18:53:16 +0300 Subject: [PATCH 1/6] Use vendor folder to speed up image build. Signed-off-by: Oleksandr Andriienko --- Dockerfile | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5381a381f..4f7cf95e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ RUN curl -sSLo /tmp/asset-devworkspace-operator.zip https://api.github.com/repos # build operator RUN export ARCH="$(uname -m)" && if [[ ${ARCH} == "x86_64" ]]; then export ARCH="amd64"; elif [[ ${ARCH} == "aarch64" ]]; then export ARCH="arm64"; fi && \ - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o che-operator main.go + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor -a -o che-operator main.go RUN unzip /tmp/asset-devworkspace-operator.zip */deploy/deployment/* -d /tmp && \ mkdir -p /tmp/devworkspace-operator/templates/ && \ diff --git a/Makefile b/Makefile index da1908606..e69f1427e 100644 --- a/Makefile +++ b/Makefile @@ -262,7 +262,7 @@ ENVTEST_ASSETS_DIR=$(shell pwd)/testbin test: manifests generate fmt vet ## Run tests. mkdir -p ${ENVTEST_ASSETS_DIR} test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh - source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out + source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test -mod=vendor ./... -coverprofile cover.out ##@ Build @@ -821,7 +821,7 @@ bundle-build: ## Build the bundle image. fi BUNDLE_PACKAGE="eclipse-che-preview-$(platform)" BUNDLE_DIR="bundle/$(DEFAULT_CHANNEL)/$${BUNDLE_PACKAGE}" - docker build -f $${BUNDLE_DIR}/bundle.Dockerfile -t $(BUNDLE_IMG) . + docker build --no-cache -f $${BUNDLE_DIR}/bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. From 440494460c94c71398efa9d78031e84f99b575c0 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Mon, 19 Jul 2021 18:55:27 +0300 Subject: [PATCH 2/6] Remove test change. Signed-off-by: Oleksandr Andriienko --- .github/bin/common.sh | 2 ++ .github/bin/minishift/test-operator-update.sh | 4 ++++ Makefile | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/bin/common.sh b/.github/bin/common.sh index 94f9954c6..0a1e88b70 100755 --- a/.github/bin/common.sh +++ b/.github/bin/common.sh @@ -426,6 +426,8 @@ function provisionOpenShiftOAuthUser() { } login() { + kubectl get service -n eclipse-che + kubectl get ingress -n eclipse-che local oauth=$(kubectl get checluster eclipse-che -n $NAMESPACE -o json | jq -r '.spec.auth.openShiftoAuth') if [[ ${oauth} == "true" ]]; then # log in using OpenShift token diff --git a/.github/bin/minishift/test-operator-update.sh b/.github/bin/minishift/test-operator-update.sh index abb67418a..e80e4bd31 100755 --- a/.github/bin/minishift/test-operator-update.sh +++ b/.github/bin/minishift/test-operator-update.sh @@ -15,6 +15,10 @@ set -x # Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions export OPERATOR_REPO="${GITHUB_WORKSPACE}" +if [ -z "${OPERATOR_REPO}" ]; then + SCRIPT=$(readlink -f "${BASH_SOURCE[0]}") + OPERATOR_REPO=$(dirname "$(dirname "$(dirname "$(dirname "$SCRIPT")")")") +fi source "${OPERATOR_REPO}"/.github/bin/common.sh # Stop execution on any error diff --git a/Makefile b/Makefile index e69f1427e..936afe61f 100644 --- a/Makefile +++ b/Makefile @@ -821,7 +821,7 @@ bundle-build: ## Build the bundle image. fi BUNDLE_PACKAGE="eclipse-che-preview-$(platform)" BUNDLE_DIR="bundle/$(DEFAULT_CHANNEL)/$${BUNDLE_PACKAGE}" - docker build --no-cache -f $${BUNDLE_DIR}/bundle.Dockerfile -t $(BUNDLE_IMG) . + docker build -f $${BUNDLE_DIR}/bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. From 32fb790a82ac7b4fef4f91250b9b865057f0f5ce Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Mon, 19 Jul 2021 18:56:22 +0300 Subject: [PATCH 3/6] Remove test change. Signed-off-by: Oleksandr Andriienko --- .github/bin/common.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/bin/common.sh b/.github/bin/common.sh index 0a1e88b70..94f9954c6 100755 --- a/.github/bin/common.sh +++ b/.github/bin/common.sh @@ -426,8 +426,6 @@ function provisionOpenShiftOAuthUser() { } login() { - kubectl get service -n eclipse-che - kubectl get ingress -n eclipse-che local oauth=$(kubectl get checluster eclipse-che -n $NAMESPACE -o json | jq -r '.spec.auth.openShiftoAuth') if [[ ${oauth} == "true" ]]; then # log in using OpenShift token From 79819d1ca8e2a8da15752e9dbd1176634d41062c Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Tue, 20 Jul 2021 10:07:37 +0300 Subject: [PATCH 4/6] Fix build index images on the Openshift ci. Signed-off-by: Oleksandr Andriienko --- Makefile | 4 +++- .../eclipse-che-preview-kubernetes/bundle.Dockerfile | 6 +++--- .../nightly/eclipse-che-preview-openshift/bundle.Dockerfile | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 936afe61f..89fa1f294 100644 --- a/Makefile +++ b/Makefile @@ -821,7 +821,9 @@ bundle-build: ## Build the bundle image. fi BUNDLE_PACKAGE="eclipse-che-preview-$(platform)" BUNDLE_DIR="bundle/$(DEFAULT_CHANNEL)/$${BUNDLE_PACKAGE}" - docker build -f $${BUNDLE_DIR}/bundle.Dockerfile -t $(BUNDLE_IMG) . + pushd $${BUNDLE_DIR} || true + docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . + popd || true .PHONY: bundle-push bundle-push: ## Push the bundle image. diff --git a/bundle/nightly/eclipse-che-preview-kubernetes/bundle.Dockerfile b/bundle/nightly/eclipse-che-preview-kubernetes/bundle.Dockerfile index d8df8c0ab..09c4af346 100644 --- a/bundle/nightly/eclipse-che-preview-kubernetes/bundle.Dockerfile +++ b/bundle/nightly/eclipse-che-preview-kubernetes/bundle.Dockerfile @@ -16,6 +16,6 @@ LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ # Copy files to locations specified by labels. -COPY bundle/nightly/eclipse-che-preview-kubernetes/manifests /manifests/ -COPY bundle/nightly/eclipse-che-preview-kubernetes/metadata /metadata/ -COPY bundle/nightly/eclipse-che-preview-kubernetes/tests/scorecard /tests/scorecard/ +COPY manifests /manifests/ +COPY metadata /metadata/ +COPY tests/scorecard /tests/scorecard/ diff --git a/bundle/nightly/eclipse-che-preview-openshift/bundle.Dockerfile b/bundle/nightly/eclipse-che-preview-openshift/bundle.Dockerfile index 43037e8b2..f28895cba 100644 --- a/bundle/nightly/eclipse-che-preview-openshift/bundle.Dockerfile +++ b/bundle/nightly/eclipse-che-preview-openshift/bundle.Dockerfile @@ -16,6 +16,6 @@ LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ # Copy files to locations specified by labels. -COPY bundle/nightly/eclipse-che-preview-openshift/manifests /manifests/ -COPY bundle/nightly/eclipse-che-preview-openshift/metadata /metadata/ -COPY bundle/nightly/eclipse-che-preview-openshift/tests/scorecard /tests/scorecard/ +COPY manifests /manifests/ +COPY metadata /metadata/ +COPY tests/scorecard /tests/scorecard/ From 1122d3d286e86dba7dc93c4c60bb264843aef8da Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Tue, 20 Jul 2021 11:22:17 +0300 Subject: [PATCH 5/6] Use sh compatable cd. Signed-off-by: Oleksandr Andriienko --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 89fa1f294..5a9e06353 100644 --- a/Makefile +++ b/Makefile @@ -821,9 +821,9 @@ bundle-build: ## Build the bundle image. fi BUNDLE_PACKAGE="eclipse-che-preview-$(platform)" BUNDLE_DIR="bundle/$(DEFAULT_CHANNEL)/$${BUNDLE_PACKAGE}" - pushd $${BUNDLE_DIR} || true + cd $${BUNDLE_DIR} docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . - popd || true + cd ../../.. .PHONY: bundle-push bundle-push: ## Push the bundle image. From 5062334ae825624c98c59b8a80007f91d07380b8 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Tue, 20 Jul 2021 11:25:41 +0300 Subject: [PATCH 6/6] Fix index images for stable bundle too. Signed-off-by: Oleksandr Andriienko --- .../stable/eclipse-che-preview-kubernetes/bundle.Dockerfile | 6 +++--- .../stable/eclipse-che-preview-openshift/bundle.Dockerfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bundle/stable/eclipse-che-preview-kubernetes/bundle.Dockerfile b/bundle/stable/eclipse-che-preview-kubernetes/bundle.Dockerfile index 71a1c7ef6..da86419ea 100644 --- a/bundle/stable/eclipse-che-preview-kubernetes/bundle.Dockerfile +++ b/bundle/stable/eclipse-che-preview-kubernetes/bundle.Dockerfile @@ -16,6 +16,6 @@ LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ # Copy files to locations specified by labels. -COPY bundle/nightly/eclipse-che-preview-kubernetes/manifests /manifests/ -COPY bundle/nightly/eclipse-che-preview-kubernetes/metadata /metadata/ -COPY bundle/nightly/eclipse-che-preview-kubernetes/tests/scorecard /tests/scorecard/ +COPY manifests /manifests/ +COPY metadata /metadata/ +COPY tests/scorecard /tests/scorecard/ diff --git a/bundle/stable/eclipse-che-preview-openshift/bundle.Dockerfile b/bundle/stable/eclipse-che-preview-openshift/bundle.Dockerfile index 29b81e06d..adb8d7322 100644 --- a/bundle/stable/eclipse-che-preview-openshift/bundle.Dockerfile +++ b/bundle/stable/eclipse-che-preview-openshift/bundle.Dockerfile @@ -16,6 +16,6 @@ LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ # Copy files to locations specified by labels. -COPY bundle/nightly/eclipse-che-preview-openshift/manifests /manifests/ -COPY bundle/nightly/eclipse-che-preview-openshift/metadata /metadata/ -COPY bundle/nightly/eclipse-che-preview-openshift/tests/scorecard /tests/scorecard/ +COPY manifests /manifests/ +COPY metadata /metadata/ +COPY tests/scorecard /tests/scorecard/