Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/bin/minishift/test-operator-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ && \
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Original file line number Diff line number Diff line change
Expand Up @@ -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/