-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ensure-pods-unchanged-when-upgrade
- Loading branch information
Showing
12 changed files
with
13,586 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2019. PingCAP, Inc. | ||
// | ||
// 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, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"github.com/pingcap/tidb-operator/pkg/to-crdgen/cmd" | ||
"github.com/spf13/pflag" | ||
"os" | ||
) | ||
|
||
func main() { | ||
flags := pflag.NewFlagSet("to-crdgen", pflag.ExitOnError) | ||
flag.CommandLine.Parse([]string{}) | ||
pflag.CommandLine = flags | ||
|
||
command := cmd.NewToCrdGenRootCmd() | ||
if err := command.Execute(); err != nil { | ||
fmt.Fprintf(os.Stderr, "%v\n", err) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
# crd-groups generates crd or verify crd in CI | ||
|
||
if [ "$#" -lt 1 ] || [ "${1}" == "--help" ]; then | ||
cat <<EOF | ||
Usage: $(basename $0) <action> | ||
<action> the action tu run ( generate, verify ) | ||
Examples: | ||
$(basename $0) generate | ||
EOF | ||
exit 0 | ||
fi | ||
|
||
ACTION="$1" | ||
shift 1 | ||
|
||
GO_PKG="github.com/pingcap/tidb-operator" | ||
CI_GO_PATH="/go" | ||
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
to_crdgen="$scriptdir/../cmd/to-crdgen" | ||
crd_target="$scriptdir/../manifests/crd.yaml" | ||
crd_verify_target="$scriptdir/../manifests/crd-verify.yaml" | ||
|
||
GO111MODULE=on go get k8s.io/code-generator/cmd/openapi-gen@kubernetes-1.12.5 | ||
|
||
function generate_crd { | ||
$1/bin/openapi-gen --go-header-file=$scriptdir/boilerplate.go.txt \ | ||
-i $GO_PKG/pkg/apis/pingcap.com/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/api/core/v1 \ | ||
-p apis/pingcap.com/v1alpha1 -O openapi_generated -o $scriptdir/../pkg | ||
|
||
go install $to_crdgen | ||
|
||
$1/bin/to-crdgen generate tidbcluster > $2 | ||
$1/bin/to-crdgen generate backup >> $2 | ||
$1/bin/to-crdgen generate restore >> $2 | ||
$1/bin/to-crdgen generate backupschedule >> $2 | ||
} | ||
|
||
if test $ACTION == 'generate' ;then | ||
generate_crd $GOPATH $crd_target | ||
elif [ $ACTION == 'verify' ];then | ||
|
||
if [[ $GOPATH == /go* ]] ; | ||
then | ||
generate_crd $CI_GO_PATH $crd_verify_target | ||
else | ||
generate_crd $GOPATH $crd_verify_target | ||
fi | ||
|
||
r="$(diff "$crd_target" "$crd_verify_target")" | ||
if [[ -n $r ]]; then | ||
echo $crd_target is not latest | ||
exit 1 | ||
fi | ||
echo crds are latest | ||
fi | ||
|
||
cd $scriptdir/.. | ||
go mod tidy |
Oops, something went wrong.