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
ee89f55b
Commit
ee89f55b
authored
Aug 19, 2015
by
Saad Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12188 from eparis/godeps-clean-test
verify-godeps.sh script to make sure all of Godeps is easily reproducible
parents
f396a711
823392e4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
0 deletions
+90
-0
.travis.yml
.travis.yml
+1
-0
verify-godeps.sh
hack/verify-godeps.sh
+74
-0
pre-commit
hooks/pre-commit
+14
-0
shippable.yml
shippable.yml
+1
-0
No files found.
.travis.yml
View file @
ee89f55b
...
@@ -22,6 +22,7 @@ script:
...
@@ -22,6 +22,7 @@ script:
-
./hack/verify-swagger-spec.sh
-
./hack/verify-swagger-spec.sh
-
./hack/verify-linkcheck.sh
-
./hack/verify-linkcheck.sh
-
./hack/verify-flags-underscore.py
-
./hack/verify-flags-underscore.py
-
./hack/verify-godeps.sh $TRAVIS_BRANCH
notifications
:
notifications
:
irc
:
"
chat.freenode.net#kubernetes-dev"
irc
:
"
chat.freenode.net#kubernetes-dev"
hack/verify-godeps.sh
0 → 100755
View file @
ee89f55b
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# 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
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
branch
=
"
${
1
:-
master
}
"
# notice this uses ... to find the first shared ancestor
if
!
git diff origin/
"
${
branch
}
"
...HEAD |
grep
'Godeps/'
>
/dev/null
;
then
exit
0
fi
# create a nice clean place to put our new godeps
_tmpdir
=
"
$(
mktemp
-d
-t
gopath.XXXXXX
)
"
function
cleanup
{
echo
"Removing
${
_tmpdir
}
"
rm
-rf
"
${
_tmpdir
}
"
}
trap
cleanup EXIT
# build the godep tool
export
GOPATH
=
"
${
_tmpdir
}
"
go get
-u
github.com/tools/godep 2>/dev/null
go
install
github.com/tools/godep 2>/dev/null
GODEP
=
"
${
_tmpdir
}
/bin/godep"
# fill out that nice clean place with the kube godeps
echo
"Starting to download all kubernetes godeps. This takes a while"
"
${
GODEP
}
"
restore
echo
"Download finished"
# copy the contents of your kube directory into the nice clean place
_kubetmp
=
"
${
_tmpdir
}
/src/k8s.io/"
mkdir
-p
"
${
_kubetmp
}
"
#should create ${_kubectmp}/kubernetes
git archive
--format
=
tar
--prefix
=
kubernetes/
$(
git write-tree
)
|
(
cd
"
${
_kubetmp
}
"
&&
tar
xf -
)
_kubetmp
=
"
${
_kubetmp
}
/kubernetes"
# destroy godeps in our COPY of the kube tree
pushd
"
${
_kubetmp
}
"
>
/dev/null
rm
-rf
./Godeps
# for some reason the kube tree needs to be a git repo for the godep tool to run. Doesn't make sense
git init
>
/dev/null 2>&1
# recreate the Godeps using the nice clean set we just downloaded
"
${
GODEP
}
"
save ./...
popd
>
/dev/null
# Check for any (meaninful) differences between the godeps in the tree and this nice clean one we just built
if
!
_out
=
"
$(
diff
-NIaupr
--ignore-matching-lines
=
'^\s*\"GoVersion\":'
--ignore-matching-lines
=
'^\s*\"Comment\":'
${
KUBE_ROOT
}
/Godeps/
${
_kubetmp
}
/Godeps/
)
"
;
then
echo
"Your godeps changes are not reproducable"
echo
"
${
_out
}
"
exit
1
fi
# ex: ts=2 sw=2 et filetype=sh
hooks/pre-commit
View file @
ee89f55b
...
@@ -16,6 +16,20 @@ else
...
@@ -16,6 +16,20 @@ else
fi
fi
echo
"
${
reset
}
"
echo
"
${
reset
}
"
# Check if changes to Godeps are reproducable...
files
=(
$(
git diff
--cached
--name-only
--diff-filter
ACM |
grep
"Godeps"
)
)
if
[[
"
${#
files
[@]
}
"
-ne
0
]]
;
then
echo
-ne
"Check if changes to Godeps are reproducable (this is pretty slow)..."
if
!
OUT
=
$(
"hack/verify-godeps.sh"
2>&1
)
;
then
echo
echo
"
${
red
}${
OUT
}
"
exit_code
=
1
else
echo
"
${
green
}
OK"
fi
echo
"
${
reset
}
"
fi
echo
-ne
"Checking for files that need gofmt... "
echo
-ne
"Checking for files that need gofmt... "
files_need_gofmt
=()
files_need_gofmt
=()
files
=(
$(
git diff
--cached
--name-only
--diff-filter
ACM |
grep
"
\.
go"
|
grep
-v
-e
"third_party"
-e
"Godeps"
)
)
files
=(
$(
git diff
--cached
--name-only
--diff-filter
ACM |
grep
"
\.
go"
|
grep
-v
-e
"third_party"
-e
"Godeps"
)
)
...
...
shippable.yml
View file @
ee89f55b
...
@@ -32,6 +32,7 @@ install:
...
@@ -32,6 +32,7 @@ install:
-
./hack/verify-boilerplate.sh
-
./hack/verify-boilerplate.sh
-
./hack/verify-description.sh
-
./hack/verify-description.sh
-
./hack/verify-flags-underscore.py
-
./hack/verify-flags-underscore.py
-
./hack/verify-godeps.sh ${BASE_BRANCH}
-
./hack/travis/install-std-race.sh
-
./hack/travis/install-std-race.sh
-
./hack/verify-generated-conversions.sh
-
./hack/verify-generated-conversions.sh
-
./hack/verify-generated-deep-copies.sh
-
./hack/verify-generated-deep-copies.sh
...
...
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