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
a53611ab
Commit
a53611ab
authored
Feb 17, 2017
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add godep.json to staging repos
parent
22e10bbc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
11 deletions
+158
-11
update-staging-godeps.sh
hack/update-staging-godeps.sh
+104
-0
verify-staging-godeps.sh
hack/verify-staging-godeps.sh
+49
-0
verify-staging-imports.sh
hack/verify-staging-imports.sh
+4
-4
godeps-json-updater.go
staging/godeps-json-updater.go
+1
-7
No files found.
hack/update-staging-godeps.sh
0 → 100755
View file @
a53611ab
#!/bin/bash
# Copyright 2017 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.
# updates the godeps.json file in the staging folders to allow clean vendoring
# based on kubernetes levels.
# TODO this does not address client-go, since it takes a different approach to vendoring
# TODO client-go should probably be made consistent
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
kube::golang::setup_env
# keep the godep restore path reasonably stable to avoid unnecessary restores
godepRestoreDir
=
${
TMPDIR
:-
/tmp/
}
/kube-godep-restore
TARGET_DIR
=
${
TARGET_DIR
:-${
KUBE_ROOT
}
/staging
}
echo
"working in
${
TARGET_DIR
}
"
ORIGINAL_GOPATH
=
"
${
GOPATH
}
"
SKIP_RESTORE
=
${
SKIP_RESTORE
:-}
if
[
"
${
SKIP_RESTORE
}
"
!=
"true"
]
;
then
echo
"starting godep restore"
mkdir
-p
"
${
godepRestoreDir
}
"
# add the vendor folder so that we don't redownload things during restore
GOPATH
=
"
${
godepRestoreDir
}
:
${
KUBE_ROOT
}
/staging:
${
ORIGINAL_GOPATH
}
"
# restore from kubernetes godeps to ensure we get the correct levels
# you get errors about the staging repos not using a known version control system
godep restore
>
${
godepRestoreDir
}
/godep-restore.log
echo
"finished godep restore"
fi
echo
"forcing fake godep folders to match the current state of master in tmp"
for
stagingRepo
in
$(
ls
${
KUBE_ROOT
}
/staging/src/k8s.io
)
;
do
echo
" creating
${
stagingRepo
}
"
rm
-rf
${
godepRestoreDir
}
/src/k8s.io/
${
stagingRepo
}
cp
-a
${
KUBE_ROOT
}
/staging/src/k8s.io/
${
stagingRepo
}
${
godepRestoreDir
}
/src/k8s.io
# we need a git commit in the godep folder, otherwise godep won't save
pushd
${
godepRestoreDir
}
/src/k8s.io/
${
stagingRepo
}
git init
>
/dev/null
# we need this so later commands work, but nothing should ever actually include these commits
# these are local only, not global
git config user.email
"you@example.com"
git config user.name
"Your Name"
git add
.
>
/dev/null
git commit
-qm
"fake commit"
popd
done
function
updateGodepManifest
()
{
local
repo
=
${
1
}
echo
"starting
${
repo
}
save"
mkdir
-p
${
TARGET_DIR
}
/src/k8s.io
# if target_dir isn't the same as source dir, you need copy
test
"
${
KUBE_ROOT
}
/staging"
=
"
${
TARGET_DIR
}
"
||
cp
-a
${
KUBE_ROOT
}
/staging/src/
${
repo
}
${
TARGET_DIR
}
/src/k8s.io
# remove the current Godeps.json so we always rebuild it
rm
-rf
${
TARGET_DIR
}
/src/
${
repo
}
/Godeps
GOPATH
=
"
${
godepRestoreDir
}
:
${
TARGET_DIR
}
"
pushd
${
TARGET_DIR
}
/src/
${
repo
}
godep save ./...
# now remove all the go files. We'll re-run a restore, go get, godep save cycle in the sync scripts
# to get the commits for other staging k8s.io repos anyway, so we don't need the added files
rm
-rf
vendor
echo
"rewriting Godeps.json to remove commits that don't really exist because we haven't pushed the prereqs yet"
GOPATH
=
"
${
ORIGINAL_GOPATH
}
"
go run
"
${
KUBE_ROOT
}
/staging/godeps-json-updater.go"
--godeps-file
=
"
${
TARGET_DIR
}
/src/
${
repo
}
/Godeps/Godeps.json"
--client-go-import-path
=
"
${
repo
}
"
popd
echo
"finished
${
repo
}
save"
}
# move into staging and save the dependencies for everything in order
for
stagingRepo
in
$(
ls
${
KUBE_ROOT
}
/staging/src/k8s.io
)
;
do
# we have to skip client-go because it does unusual manipulation of its godeps
if
[
"
${
stagingRepo
}
"
==
"client-go"
]
;
then
continue
fi
updateGodepManifest
"k8s.io/
${
stagingRepo
}
"
done
hack/verify-staging-godeps.sh
0 → 100755
View file @
a53611ab
#!/bin/bash
# Copyright 2017 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.
# TODO this does not address client-go, since it takes a different approach to vendoring
# TODO client-go should probably be made consistent
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
TARGET_DIR
=
$(
mktemp
-d
"
${
TMPDIR
:-
/tmp/
}$(
basename
0
)
.XXXXXXXXXXXX"
)
# Register function to be called on EXIT to remove folder.
function
cleanup
{
SKIP_CLEANUP
=
${
SKIP_CLEANUP
:-}
if
[
"
${
SKIP_CLEANUP
}
"
!=
"true"
]
;
then
rm
-rf
"
${
TARGET_DIR
}
"
fi
}
trap
cleanup EXIT
TARGET_DIR
=
${
TARGET_DIR
}
${
KUBE_ROOT
}
/hack/update-staging-godeps.sh
# check each staging repo to make sure its Godeps.json is correct
for
stagingRepo
in
$(
ls
${
KUBE_ROOT
}
/staging/src/k8s.io
)
;
do
# we have to skip client-go because it does unusual manipulation of its godeps
if
[
"
${
stagingRepo
}
"
==
"client-go"
]
;
then
continue
fi
diff
--ignore-matching-lines
=
'^\s*\"Comment\"'
${
KUBE_ROOT
}
/staging/src/k8s.io/
${
stagingRepo
}
/Godeps/Godeps.json
${
TARGET_DIR
}
/src/k8s.io/
${
stagingRepo
}
/Godeps/Godeps.json
done
hack/verify-staging-imports.sh
View file @
a53611ab
...
@@ -46,16 +46,16 @@ function print_forbidden_imports () {
...
@@ -46,16 +46,16 @@ function print_forbidden_imports () {
echo
echo
return
1
return
1
fi
fi
local
FORBIDDEN
=
$(
local
TEST_
FORBIDDEN
=
$(
go list
-f
$'{{with $package := .ImportPath}}{{range $.TestImports}}{{$package}} imports {{.}}
\n
{{end}}{{end}}'
./vendor/k8s.io/
${
PACKAGE
}
/... |
go list
-f
$'{{with $package := .ImportPath}}{{range $.TestImports}}{{$package}} imports {{.}}
\n
{{end}}{{end}}'
./vendor/k8s.io/
${
PACKAGE
}
/... |
sed
's|^k8s.io/kubernetes/vendor/||;s| k8s.io/kubernetes/vendor/| |'
|
sed
's|^k8s.io/kubernetes/vendor/||;s| k8s.io/kubernetes/vendor/| |'
|
grep
-v
" k8s.io/
${
PACKAGE
}
"
|
grep
-v
" k8s.io/
${
PACKAGE
}
"
|
grep
-e
"imports
\(
${
RE
}
\)
"
grep
-e
"imports
\(
${
RE
}
\)
"
)
)
if
[
-n
"
${
FORBIDDEN
}
"
]
;
then
if
[
-n
"
${
TEST_
FORBIDDEN
}
"
]
;
then
echo
"
${
PACKAGE
}
has a forbidden dependency:"
echo
"
${
PACKAGE
}
has a forbidden dependency
in test code
:"
echo
echo
echo
"
${
FORBIDDEN
}
"
|
sed
's/^/ /'
echo
"
${
TEST_
FORBIDDEN
}
"
|
sed
's/^/ /'
echo
echo
return
1
return
1
fi
fi
...
...
staging/godeps-json-updater.go
View file @
a53611ab
...
@@ -68,13 +68,7 @@ func main() {
...
@@ -68,13 +68,7 @@ func main() {
// removes the Deps whose ImportPath contains "k8s.io/kubernetes"
// removes the Deps whose ImportPath contains "k8s.io/kubernetes"
i
:=
0
i
:=
0
for
_
,
dep
:=
range
g
.
Deps
{
for
_
,
dep
:=
range
g
.
Deps
{
if
strings
.
Contains
(
dep
.
ImportPath
,
"k8s.io/apimachinery"
)
{
if
strings
.
Contains
(
dep
.
ImportPath
,
"k8s.io/"
)
{
continue
}
if
strings
.
Contains
(
dep
.
ImportPath
,
"k8s.io/kubernetes"
)
{
continue
}
if
strings
.
Contains
(
dep
.
ImportPath
,
"k8s.io/client-go"
)
{
continue
continue
}
}
g
.
Deps
[
i
]
=
dep
g
.
Deps
[
i
]
=
dep
...
...
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