4
Makefile
4
Makefile
@@ -44,6 +44,10 @@ ks-apiserver: fmt vet
|
||||
ks-controller-manager: fmt vet
|
||||
hack/gobuild.sh cmd/controller-manager
|
||||
|
||||
# Build e2e binary
|
||||
e2e: fmt vet
|
||||
hack/build_e2e.sh test/e2e
|
||||
|
||||
# Run go fmt against code
|
||||
fmt:
|
||||
gofmt -w ./pkg ./cmd ./tools ./api
|
||||
|
||||
48
hack/build_e2e.sh
Executable file
48
hack/build_e2e.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2020 KubeSphere Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# This script builds and link stamps the output
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
VERBOSE=${VERBOSE:-"0"}
|
||||
V=""
|
||||
if [[ "${VERBOSE}" == "1" ]];then
|
||||
V="-x"
|
||||
set -x
|
||||
fi
|
||||
|
||||
ROOTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
OUTPUT_DIR=bin
|
||||
BUILDPATH=./${1:?"path to build"}
|
||||
OUT=${OUTPUT_DIR}/${1:?"output path"}
|
||||
|
||||
BUILD_GOOS=${GOOS:-$(go env GOOS)}
|
||||
BUILD_GOARCH=${GOARCH:-$(go env GOARCH)}
|
||||
GOBINARY=${GOBINARY:-go}
|
||||
LDFLAGS=$(kube::version::ldflags)
|
||||
|
||||
time GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} ${GOBINARY} test \
|
||||
-c \
|
||||
-ldflags "${LDFLAGS}" \
|
||||
-o ${OUT} \
|
||||
${BUILDPATH}
|
||||
@@ -540,7 +540,7 @@ EOF
|
||||
# $KUBE_ROOT must be set.
|
||||
function kube::util::list_staging_repos() {
|
||||
(
|
||||
cd "${KUBE_ROOT}/staging/src/k8s.io" && \
|
||||
cd "${KUBE_ROOT}/staging/src/kubesphere.io" && \
|
||||
find . -mindepth 1 -maxdepth 1 -type d | cut -c 3- | sort
|
||||
)
|
||||
}
|
||||
|
||||
@@ -122,6 +122,17 @@ function add_generated_comments() {
|
||||
|
||||
|
||||
# Phase 1: ensure go.mod files for staging modules and main module
|
||||
for repo in $(kube::util::list_staging_repos); do
|
||||
pushd "staging/src/kubesphere.io/${repo}" >/dev/null 2>&1
|
||||
if [[ ! -f go.mod ]]; then
|
||||
kube::log::status "go.mod: initialize ${repo}"
|
||||
rm -f Godeps/Godeps.json # remove before initializing, staging Godeps are not authoritative
|
||||
go mod init "kubesphere.io/${repo}"
|
||||
go mod edit -fmt
|
||||
fi
|
||||
popd >/dev/null 2>&1
|
||||
done
|
||||
|
||||
if [[ ! -f go.mod ]]; then
|
||||
kube::log::status "go.mod: initialize kubesphere.io/kubesphere"
|
||||
go mod init "kubesphere.io/kubesphere"
|
||||
@@ -134,6 +145,9 @@ kube::log::status "go.mod: update references"
|
||||
# Prune
|
||||
go mod edit -json | jq -r '.Require[]? | select(.Version == "v0.0.0") | "-droprequire \(.Path)"' | xargs -L 100 go mod edit -fmt
|
||||
go mod edit -json | jq -r '.Replace[]? | select(.New.Path | startswith("./staging/")) | "-dropreplace \(.Old.Path)"' | xargs -L 100 go mod edit -fmt
|
||||
# Readd
|
||||
kube::util::list_staging_repos | xargs -n 1 -I {} echo "-require kubesphere.io/{}@v0.0.0" | xargs -L 100 go mod edit -fmt
|
||||
kube::util::list_staging_repos | xargs -n 1 -I {} echo "-replace kubesphere.io/{}=./staging/src/kubesphere.io/{}" | xargs -L 100 go mod edit -fmt
|
||||
|
||||
# Phase 3: capture required (minimum) versions from all modules, and replaced (pinned) versions from the root module
|
||||
|
||||
|
||||
1
vendor/kubesphere.io/client-go
generated
vendored
Symbolic link
1
vendor/kubesphere.io/client-go
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../staging/src/kubesphere.io/client-go
|
||||
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
@@ -1530,6 +1530,9 @@ k8s.io/utils/net
|
||||
k8s.io/utils/path
|
||||
k8s.io/utils/pointer
|
||||
k8s.io/utils/trace
|
||||
# kubesphere.io/client-go v0.0.0 => ./staging/src/kubesphere.io/client-go
|
||||
kubesphere.io/client-go/client
|
||||
kubesphere.io/client-go/client/generic
|
||||
# openpitrix.io/openpitrix v0.4.9-0.20200611125425-ae07f141e797 => openpitrix.io/openpitrix v0.4.9-0.20200611125425-ae07f141e797
|
||||
openpitrix.io/openpitrix/pkg/config
|
||||
openpitrix.io/openpitrix/pkg/constants
|
||||
|
||||
Reference in New Issue
Block a user