Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c28f66c7
Commit
c28f66c7
authored
Feb 08, 2018
by
Wu Qiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add verify script for kms generated file
parent
9825018e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
7 deletions
+52
-7
update-generated-kms-dockerized.sh
hack/update-generated-kms-dockerized.sh
+7
-7
verify-generated-kms.sh
hack/verify-generated-kms.sh
+45
-0
No files found.
hack/update-generated-kms-dockerized.sh
View file @
c28f66c7
...
...
@@ -19,7 +19,7 @@ set -o nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
KUBE_
REMOTE_RUNTIME
_ROOT
=
"
${
KUBE_ROOT
}
/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/"
KUBE_
KMS_GRPC
_ROOT
=
"
${
KUBE_ROOT
}
/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/"
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
kube::golang::setup_env
...
...
@@ -40,7 +40,7 @@ if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]]; then
fi
function
cleanup
{
rm
-f
${
KUBE_
REMOTE_RUNTIME
_ROOT
}
/service.pb.go.bak
rm
-f
${
KUBE_
KMS_GRPC
_ROOT
}
/service.pb.go.bak
}
trap
cleanup EXIT
...
...
@@ -49,14 +49,14 @@ gogopath=$(dirname $(kube::util::find-binary "protoc-gen-gogo"))
PATH
=
"
${
gogopath
}
:
${
PATH
}
"
\
protoc
\
--proto_path
=
"
${
KUBE_
REMOTE_RUNTIME
_ROOT
}
"
\
--proto_path
=
"
${
KUBE_
KMS_GRPC
_ROOT
}
"
\
--proto_path
=
"
${
KUBE_ROOT
}
/vendor"
\
--gogo_out
=
plugins
=
grpc:
${
KUBE_
REMOTE_RUNTIME_ROOT
}
${
KUBE_REMOTE_RUNTIME
_ROOT
}
/service.proto
--gogo_out
=
plugins
=
grpc:
${
KUBE_
KMS_GRPC_ROOT
}
${
KUBE_KMS_GRPC
_ROOT
}
/service.proto
# Update boilerplate for the generated file.
echo
"
$(
cat
hack/boilerplate/boilerplate.go.txt
${
KUBE_
REMOTE_RUNTIME_ROOT
}
/service.pb.go
)
"
>
${
KUBE_REMOTE_RUNTIME
_ROOT
}
/service.pb.go
sed
-i
".bak"
"s/Copyright YEAR/Copyright
$(
date
'+%Y'
)
/g"
${
KUBE_
REMOTE_RUNTIME
_ROOT
}
/service.pb.go
echo
"
$(
cat
hack/boilerplate/boilerplate.go.txt
${
KUBE_
KMS_GRPC_ROOT
}
/service.pb.go
)
"
>
${
KUBE_KMS_GRPC
_ROOT
}
/service.pb.go
sed
-i
".bak"
"s/Copyright YEAR/Copyright
$(
date
'+%Y'
)
/g"
${
KUBE_
KMS_GRPC
_ROOT
}
/service.pb.go
# Run gofmt to clean up the generated code.
kube::golang::verify_go_version
gofmt
-l
-s
-w
${
KUBE_
REMOTE_RUNTIME
_ROOT
}
/service.pb.go
gofmt
-l
-s
-w
${
KUBE_
KMS_GRPC
_ROOT
}
/service.pb.go
hack/verify-generated-kms.sh
0 → 100755
View file @
c28f66c7
#!/bin/bash
# Copyright 2018 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.
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
KUBE_KMS_GRPC_ROOT
=
"
${
KUBE_ROOT
}
/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/"
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
kube::golang::setup_env
function
cleanup
{
rm
-rf
${
KUBE_KMS_GRPC_ROOT
}
/_tmp/
}
trap
cleanup EXIT
mkdir
-p
${
KUBE_KMS_GRPC_ROOT
}
/_tmp
cp
${
KUBE_KMS_GRPC_ROOT
}
/service.pb.go
${
KUBE_KMS_GRPC_ROOT
}
/_tmp/
ret
=
0
KUBE_VERBOSE
=
3
"
${
KUBE_ROOT
}
/hack/update-generated-kms.sh"
diff
-I
"gzipped FileDescriptorProto"
-I
"0x"
-Naupr
${
KUBE_KMS_GRPC_ROOT
}
/_tmp/service.pb.go
${
KUBE_KMS_GRPC_ROOT
}
/service.pb.go
||
ret
=
$?
if
[[
$ret
-eq
0
]]
;
then
echo
"Generated KMS gRPC is up to date."
cp
${
KUBE_KMS_GRPC_ROOT
}
/_tmp/service.pb.go
${
KUBE_KMS_GRPC_ROOT
}
/
else
echo
"Generated KMS gRPC is out of date. Please run hack/update-generated-kms.sh"
exit
1
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment