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
a29c048e
Commit
a29c048e
authored
Aug 31, 2017
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up godep scripts to be self-contained
parent
7732c8d8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
42 deletions
+76
-42
godep-restore.sh
hack/godep-restore.sh
+10
-3
godep-save.sh
hack/godep-save.sh
+52
-24
util.sh
hack/lib/util.sh
+1
-1
update-all.sh
hack/update-all.sh
+1
-6
update-bazel.sh
hack/update-bazel.sh
+11
-4
update-staging-godeps-dockerized.sh
hack/update-staging-godeps-dockerized.sh
+1
-4
No files found.
hack/godep-restore.sh
View file @
a29c048e
...
...
@@ -22,8 +22,15 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
source
"
${
KUBE_ROOT
}
/hack/lib/util.sh"
kube::log::status
"Restoring kubernetes godeps"
if
kube::util::godep_restored
>
/dev/null 2>&1
;
then
kube::log::status
"Dependencies appear to be current - skipping download"
exit
0
fi
kube::util::ensure_godep_version
kube::log::status
"
Starting to download all kubernetes godeps. This takes
a while"
GOPATH
=
${
GOPATH
}
:
${
KUBE_ROOT
}
/staging
godep restore
"
$@
"
kube::log::status
"Do
wnload finished
"
kube::log::status
"
Downloading dependencies - this might take
a while"
GOPATH
=
"
${
GOPATH
}
:
${
KUBE_ROOT
}
/staging"
godep restore
"
$@
"
kube::log::status
"Do
ne
"
hack/godep-save.sh
View file @
a29c048e
...
...
@@ -22,13 +22,35 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
source
"
${
KUBE_ROOT
}
/hack/lib/util.sh"
kube::log::status
"Ensuring prereqs"
kube::util::ensure_single_dir_gopath
kube::util::ensure_godep_version
kube::util::ensure_no_staging_repos_in_gopath
if
[
-e
"
${
KUBE_ROOT
}
/vendor"
-o
-e
"
${
KUBE_ROOT
}
/Godeps"
]
;
then
echo
"The directory vendor/ or Godeps/ exists. Remove them before running godep-save.sh"
1>&2
exit
1
kube::util::ensure_godep_version
BACKUP
=
_tmp/godep-save.
$RANDOM
mkdir
-p
"
${
BACKUP
}
"
function
kube::godep_save::cleanup
()
{
if
[[
-d
"
${
BACKUP
}
/vendor"
]]
;
then
kube::log::error
"
${
BACKUP
}
/vendor exists, restoring it"
rm
-rf
vendor
mv
"
${
BACKUP
}
/vendor"
vendor
fi
if
[[
-d
"
${
BACKUP
}
/Godeps"
]]
;
then
kube::log::error
"
${
BACKUP
}
/Godeps exists, restoring it"
rm
-rf
Godeps
mv
"
${
BACKUP
}
/Godeps"
Godeps
fi
}
kube::util::trap_add kube::godep_save::cleanup EXIT
# Clear old state, but save it in case of error
if
[[
-d
vendor
]]
;
then
mv
vendor
"
${
BACKUP
}
/vendor"
fi
if
[[
-d
Godeps
]]
;
then
mv
Godeps
"
${
BACKUP
}
/Godeps"
fi
# Some things we want in godeps aren't code dependencies, so ./...
...
...
@@ -39,23 +61,29 @@ REQUIRED_BINS=(
"./..."
)
pushd
"
${
KUBE_ROOT
}
"
>
/dev/null
echo
"Running godep save. This will take around 15 minutes."
GOPATH
=
${
GOPATH
}
:
${
KUBE_ROOT
}
/staging godep save
"
${
REQUIRED_BINS
[@]
}
"
# create a symlink in vendor directory pointing to the staging client. This
# let other packages use the staging client as if it were vendored.
for
repo
in
$(
ls
${
KUBE_ROOT
}
/staging/src/k8s.io
)
;
do
if
[
!
-e
"vendor/k8s.io/
${
repo
}
"
]
;
then
ln
-s
"../../staging/src/k8s.io/
${
repo
}
"
"vendor/k8s.io/
${
repo
}
"
fi
done
popd
>
/dev/null
# Workaround broken symlink in docker repo because godep copies the link, but not the target
rm
-rf
${
KUBE_ROOT
}
/vendor/github.com/docker/docker/project/
echo
echo
"Don't forget to run:"
echo
"- hack/update-bazel.sh to recreate the BUILD files"
echo
"- hack/update-godep-licenses.sh if you added or removed a dependency!"
kube::log::status
"Running godep save - this might take a while"
# This uses $(pwd) rather than ${KUBE_ROOT} because KUBE_ROOT will be
# realpath'ed, and godep barfs ("... is not using a known version control
# system") on our staging dirs.
GOPATH
=
"
${
GOPATH
}
:
$(
pwd
)
/staging"
godep save
"
${
REQUIRED_BINS
[@]
}
"
# create a symlink in vendor directory pointing to the staging client. This
# let other packages use the staging client as if it were vendored.
for
repo
in
$(
ls
staging/src/k8s.io
)
;
do
if
[
!
-e
"vendor/k8s.io/
${
repo
}
"
]
;
then
ln
-s
"../../staging/src/k8s.io/
${
repo
}
"
"vendor/k8s.io/
${
repo
}
"
fi
done
# Workaround broken symlink in docker repo because godep copies the link, but
# not the target
rm
-rf
vendor/github.com/docker/docker/project/
kube::log::status
"Updating BUILD files"
hack/update-bazel.sh
>
/dev/null
kube::log::status
"Updating LICENSES file"
hack/update-godep-licenses.sh
>
/dev/null
# Clean up
rm
-rf
"
${
BACKUP
}
"
hack/lib/util.sh
View file @
a29c048e
...
...
@@ -85,7 +85,7 @@ kube::util::trap_add() {
if
[[
-z
"
${
existing_cmd
}
"
]]
;
then
new_cmd
=
"
${
trap_add_cmd
}
"
else
new_cmd
=
"
${
existing_cmd
}
;
${
trap_add
_cmd
}
"
new_cmd
=
"
${
trap_add_cmd
}
;
${
existing
_cmd
}
"
fi
# Assign the test
...
...
hack/update-all.sh
View file @
a29c048e
...
...
@@ -53,12 +53,7 @@ if ! $ALL ; then
echo
"Running in short-circuit mode; run with -a to force all scripts to run."
fi
kube::util::ensure_godep_version
if
!
kube::util::godep_restored 2>&1 |
sed
's/^/ /'
;
then
echo
"Running godep restore"
"
${
KUBE_ROOT
}
/hack/godep-restore.sh"
${
V
}
fi
"
${
KUBE_ROOT
}
/hack/godep-restore.sh"
${
V
}
BASH_TARGETS
=
"
update-generated-protobuf
...
...
hack/update-bazel.sh
View file @
a29c048e
...
...
@@ -25,10 +25,17 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
rm
-f
"
${
KUBE_ROOT
}
/pkg/generated/openapi/zz_generated.openapi.go"
# The git commit sha1s here should match the values in $KUBE_ROOT/WORKSPACE.
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel 4eaf9e671bbb549fb4ec292cf251f921d7ef80ac
kube::util::go_install_from_commit github.com/bazelbuild/rules_go/go/tools/gazelle/gazelle 82483596ec203eb9c1849937636f4cbed83733eb
kube::util::go_install_from_commit
\
github.com/kubernetes/repo-infra/kazel
\
4eaf9e671bbb549fb4ec292cf251f921d7ef80ac
kube::util::go_install_from_commit
\
github.com/bazelbuild/rules_go/go/tools/gazelle/gazelle
\
82483596ec203eb9c1849937636f4cbed83733eb
touch
"
${
KUBE_ROOT
}
/vendor/BUILD"
gazelle fix
-build_file_name
=
BUILD,BUILD.bazel
-external
=
vendored
-mode
=
fix
-repo_root
=
"
$(
kube::realpath
${
KUBE_ROOT
})
"
kazel
-root
=
"
$(
kube::realpath
${
KUBE_ROOT
})
"
gazelle fix
\
-build_file_name
=
BUILD,BUILD.bazel
\
-external
=
vendored
\
-mode
=
fix
kazel
hack/update-staging-godeps-dockerized.sh
View file @
a29c048e
...
...
@@ -61,10 +61,7 @@ kube::util::ensure_godep_version
# Create a fake git repo the root of the repo to prevent godeps from complaining
kube::util::create-fake-git-tree
"
${
KUBE_ROOT
}
"
kube::log::status
"Checking whether godeps are restored"
if
!
kube::util::godep_restored 2>&1 |
sed
's/^/ /'
;
then
${
KUBE_ROOT
}
/hack/godep-restore.sh
fi
"
${
KUBE_ROOT
}
/hack/godep-restore.sh"
kube::util::ensure-temp-dir
TMP_GOPATH
=
"
${
KUBE_TEMP
}
/go"
...
...
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