forked from hyperledger-labs/fabric-operator
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from Abirdcfly/main
feat: add client,lister,informer for bc-explorer
- Loading branch information
Showing
92 changed files
with
8,035 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Verify | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
verify: | ||
name: verify | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
- name: Set up Go command | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 'stable' | ||
check-latest: true | ||
- name: verify codegen | ||
run: hack/verify-codegen.sh | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true |
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
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,21 @@ | ||
/* | ||
Copyright 2016 The Kubernetes 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. | ||
*/ | ||
|
||
// +k8s:deepcopy-gen=package | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +groupName=ibp.com | ||
|
||
package v1beta1 // import "github.com/IBM-Blockchain/fabric-operator/api/v1beta1" |
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
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
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,30 @@ | ||
/* | ||
* Copyright contributors to the Hyperledger Fabric Operator project | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* 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. | ||
*/ | ||
|
||
package install | ||
|
||
import ( | ||
"github.com/IBM-Blockchain/fabric-operator/api/v1beta1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||
) | ||
|
||
// Install registers the API group and adds types to a scheme | ||
func Install(scheme *runtime.Scheme) { | ||
utilruntime.Must(v1beta1.AddToScheme(scheme)) | ||
} |
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
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,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
function go::create_gopath_tree() { | ||
local go_pkg_dir="${BUILD_GOPATH}/src/${PACKAGE_NAME}" | ||
local go_pkg_basedir | ||
go_pkg_basedir=$(dirname "${go_pkg_dir}") | ||
|
||
mkdir -p "${go_pkg_basedir}" | ||
|
||
if [[ ! -e ${go_pkg_dir} || "$(readlink "${go_pkg_dir}")" != "${ROOT_PATH}" ]]; then | ||
ln -snf "${ROOT_PATH}" "${go_pkg_dir}" | ||
fi | ||
} | ||
|
||
function go::setup_env() { | ||
go::create_gopath_tree | ||
|
||
export GOPATH="${BUILD_GOPATH}" | ||
export GOCACHE="${BUILD_GOPATH}/cache" | ||
|
||
export PATH="${BUILD_GOPATH}/bin:${PATH}" | ||
|
||
GOROOT=$(go env GOROOT) | ||
export GOROOT | ||
|
||
unset GOBIN | ||
|
||
cd "$BUILD_GOPATH/src/$PACKAGE_NAME" | ||
} |
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,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
unset CDPATH | ||
|
||
ROOT_PATH=$(git rev-parse --show-toplevel) | ||
readonly PACKAGE_NAME="github.com/IBM-Blockchain/fabric-operator" | ||
readonly OUTPUT_DIR="${ROOT_PATH}/_output" | ||
readonly BUILD_GOPATH="${OUTPUT_DIR}/go" | ||
source "${ROOT_PATH}/hack/lib/golang.sh" |
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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
source "${SCRIPT_ROOT}/hack/lib/init.sh" | ||
go::setup_env | ||
cd "${ROOT_PATH}" | ||
|
||
echo "codegen start." | ||
echo "tools install..." | ||
|
||
GENERATOR_VERSION=${GENERATOR_VERSION:-$(cat "${ROOT_PATH}"/go.mod | grep "k8s.io/code-generator" | awk '{print $2}')} | ||
GO111MODULE=on go install k8s.io/code-generator/cmd/client-gen@${GENERATOR_VERSION} | ||
GO111MODULE=on go install k8s.io/code-generator/cmd/lister-gen@${GENERATOR_VERSION} | ||
GO111MODULE=on go install k8s.io/code-generator/cmd/informer-gen@${GENERATOR_VERSION} | ||
|
||
echo "Generating with client-gen..." | ||
client-gen \ | ||
--go-header-file hack/boilerplate.go.txt \ | ||
--input-base="github.com/IBM-Blockchain/fabric-operator/api" \ | ||
--input="v1beta1" \ | ||
--output-package=github.com/IBM-Blockchain/fabric-operator/pkg/generated/clientset \ | ||
--clientset-name=versioned | ||
|
||
echo "Generating with lister-gen..." | ||
lister-gen \ | ||
--go-header-file hack/boilerplate.go.txt \ | ||
--input-dirs=github.com/IBM-Blockchain/fabric-operator/api/v1beta1 \ | ||
--output-package=github.com/IBM-Blockchain/fabric-operator/pkg/generated/listers | ||
|
||
echo "Generating with informer-gen..." | ||
informer-gen \ | ||
--go-header-file hack/boilerplate.go.txt \ | ||
--input-dirs=github.com/IBM-Blockchain/fabric-operator/api/v1beta1 \ | ||
--versioned-clientset-package=github.com/IBM-Blockchain/fabric-operator/pkg/generated/clientset/versioned \ | ||
--listers-package=github.com/IBM-Blockchain/fabric-operator/pkg/generated/listers \ | ||
--output-package=github.com/IBM-Blockchain/fabric-operator/pkg/generated/informers | ||
|
||
# FIXME: this may be fixed by set right arg in client-gen or informer-gen ? | ||
find pkg/generated/informers -type f -exec sed -i.bak 's/IbpV1beta1/Ibp/g' {} + | ||
find pkg/generated/informers -type f -name '*.bak' -delete | ||
|
||
echo "codegen done." |
Oops, something went wrong.