fix: Use vendor folder to speed up image build. (#947)

* Use vendor folder to speed up image build. Fix build index images on the Openshift ci.

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
pull/941/head
Oleksandr Andriienko 2021-07-20 19:19:53 +03:00 committed by GitHub
parent 38d90fbfeb
commit 3141f09a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 15 deletions

View File

@ -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

View File

@ -40,7 +40,7 @@ COPY vendor/ vendor/
# 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/ && \

View File

@ -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,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) .
cd $${BUNDLE_DIR}
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
cd ../../..
.PHONY: bundle-push
bundle-push: ## Push the bundle image.

View File

@ -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/

View File

@ -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/

View File

@ -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/

View File

@ -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/