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
4e4c67c6
Commit
4e4c67c6
authored
Nov 06, 2015
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address host dir vs docker dir issue
parent
358221f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
36 deletions
+35
-36
update-api-reference-docs.sh
hack/update-api-reference-docs.sh
+32
-26
verify-api-reference-docs.sh
hack/verify-api-reference-docs.sh
+3
-10
No files found.
hack/update-api-reference-docs.sh
View file @
4e4c67c6
...
...
@@ -24,49 +24,52 @@ set -o pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
kube::golang::setup_env
kube::util::ensure-temp-dir
#KUBE_ROOT should be an absolute path now that we have run kube::golang::setup_env.
DEFAULT_OUTPUT
=
"
${
KUBE_ROOT
}
/docs/api-reference"
OUTPUT
=
${
1
:-${
DEFAULT_OUTPUT
}}
# Use REPO_DIR if provided so we can set it to the host-resolvable path
# to the repo root if we are running this script from a container with
# docker mounted in as a volume.
# We pass the host output dir as the source dir to `docker run -v`, but use
# the regular one to compute diff (they will be the same if running this
# test on the host, potentially different if running in a container).
REPO_DIR
=
${
REPO_DIR
:-
"
${
KUBE_ROOT
}
"
}
DEFAULT_OUTPUT_PATH
=
"
${
REPO_DIR
}
/docs/api-reference
"
OUTPUT
=
${
1
:-${
DEFAULT_OUTPUT_PATH
}}
OUTPUT_T
EMP
=
"
${
KUBE_TEMP
}
/generated_html
"
echo
"Generating api reference docs at
${
OUTPUT
}
"
V1_
PATH
=
"
${
OUTPU
T
}
/v1/"
V1_T
EMP_PATH
=
"
${
OUTPUT_TE
MP
}
/v1/"
mkdir
-p
${
V1_T
EMP_PATH
}
V1BETA1_
PATH
=
"
${
OUTPU
T
}
/extensions/v1beta1/"
V1BETA1_T
EMP_PATH
=
"
${
OUTPUT_TE
MP
}
/extensions/v1beta1/"
mkdir
-p
${
V1BETA1_T
EMP_PATH
}
TMP_SUBPATH
=
"_output/generated_html
"
OUTPUT
_TMP_IN_HOST
=
"
${
REPO_DIR
}
/
${
TMP_SUBPATH
}
"
OUTPUT_T
MP
=
"
${
KUBE_ROOT
}
/
${
TMP_SUBPATH
}
"
echo
"Generating api reference docs at
${
OUTPUT
_TMP
}
"
V1_
TMP_IN_HOST
=
"
${
OUTPUT_TMP_IN_HOS
T
}
/v1/"
V1_T
MP
=
"
${
OUTPUT_T
MP
}
/v1/"
mkdir
-p
${
V1_T
MP
}
V1BETA1_
TMP_IN_HOST
=
"
${
OUTPUT_TMP_IN_HOS
T
}
/extensions/v1beta1/"
V1BETA1_T
MP
=
"
${
OUTPUT_T
MP
}
/extensions/v1beta1/"
mkdir
-p
${
V1BETA1_T
MP
}
SWAGGER_PATH
=
"
${
REPO_DIR
}
/api/swagger-spec/"
echo
"Reading swagger spec from:
${
SWAGGER_PATH
}
"
mkdir
-p
$V1_PATH
mkdir
-p
$V1BETA1_PATH
docker run
-u
$(
id
-u
)
--rm
-v
$V1_TEMP_PATH
:/output:z
-v
${
SWAGGER_PATH
}
:/swagger-source:z gcr.io/google_containers/gen-swagger-docs:v4
\
docker run
-u
$(
id
-u
)
--rm
-v
$V1_TMP_IN_HOST
:/output:z
-v
${
SWAGGER_PATH
}
:/swagger-source:z gcr.io/google_containers/gen-swagger-docs:v4
\
v1
\
https://raw.githubusercontent.com/kubernetes/kubernetes/master/pkg/api/v1/register.go
docker run
-u
$(
id
-u
)
--rm
-v
$V1BETA1_T
EMP_PATH
:/output:z
-v
${
SWAGGER_PATH
}
:/swagger-source:z gcr.io/google_containers/gen-swagger-docs:v4
\
docker run
-u
$(
id
-u
)
--rm
-v
$V1BETA1_T
MP_IN_HOST
:/output:z
-v
${
SWAGGER_PATH
}
:/swagger-source:z gcr.io/google_containers/gen-swagger-docs:v4
\
v1beta1
\
https://raw.githubusercontent.com/kubernetes/kubernetes/master/pkg/apis/extensions/v1beta1/register.go
# Check if we actually changed anything
pushd
"
${
OUTPUT_T
E
MP
}
"
>
/dev/null
pushd
"
${
OUTPUT_TMP
}
"
>
/dev/null
touch
.generated_html
find
.
-type
f |
cut
-sd
/
-f
2- |
LC_ALL
=
C
sort
>
.generated_html
popd
>
/dev/null
while
read
file
;
do
if
[[
-e
"
${
OUTPUT
}
/
${
file
}
"
&&
-e
"
${
OUTPUT_T
E
MP
}
/
${
file
}
"
]]
;
then
echo
"comparing
${
OUTPUT
}
/
${
file
}
with
${
OUTPUT_T
E
MP
}
/
${
file
}
"
if
[[
-e
"
${
OUTPUT
}
/
${
file
}
"
&&
-e
"
${
OUTPUT_TMP
}
/
${
file
}
"
]]
;
then
echo
"comparing
${
OUTPUT
}
/
${
file
}
with
${
OUTPUT_TMP
}
/
${
file
}
"
# Filter all munges from original content.
original
=
$(
cat
"
${
OUTPUT
}
/
${
file
}
"
)
generated
=
$(
cat
"
${
OUTPUT_T
E
MP
}
/
${
file
}
"
)
generated
=
$(
cat
"
${
OUTPUT_TMP
}
/
${
file
}
"
)
# Filter out meaningless lines with timestamps
original
=
$(
echo
"
${
original
}
"
|
grep
-v
"Last updated"
||
:
)
...
...
@@ -76,11 +79,14 @@ while read file; do
# auto-managed content.
if
diff
-Bw
>
/dev/null <
(
echo
"
${
original
}
"
)
<
(
echo
"
${
generated
}
"
)
;
then
# actual contents same, overwrite generated with original.
cp
"
${
OUTPUT
}
/
${
file
}
"
"
${
OUTPUT_T
E
MP
}
/
${
file
}
"
cp
"
${
OUTPUT
}
/
${
file
}
"
"
${
OUTPUT_TMP
}
/
${
file
}
"
fi
fi
done
<
"
${
OUTPUT_TEMP
}
/.generated_html"
done
<
"
${
OUTPUT_TMP
}
/.generated_html"
echo
"Moving api reference docs from
${
OUT_TMP
}
to
${
OUTPUT
}
"
cp
-af
"
${
OUTPUT_TEMP
}
"
/
*
"
${
OUTPUT
}
"
cp
-af
"
${
OUTPUT_TMP
}
"
/
*
"
${
OUTPUT
}
"
rm
-r
${
OUTPUT_TMP
}
# ex: ts=2 sw=2 et filetype=sh
hack/verify-api-reference-docs.sh
View file @
4e4c67c6
...
...
@@ -26,15 +26,8 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
API_REFERENCE_DOCS_ROOT
=
"
${
KUBE_ROOT
}
/docs/api-reference"
# Use REPO_DIR if provided so we can set it to the host-resolvable path
# to the repo root if we are running this script from a container with
# docker mounted in as a volume.
# We pass the host output dir to update-api-reference-docs.sh, but use
# the regular one to compute diff (they will be the same if running this
# test on the host, potentially different if running in a container).
REPO_DIR
=
${
REPO_DIR
:-
"
${
KUBE_ROOT
}
"
}
HOST_OUTPUT_DIR
=
"
${
REPO_DIR
}
/_tmp/api-reference"
TMP_OUTPUT_DIR
=
"
${
KUBE_ROOT
}
/_tmp/api-reference"
HOST_OUTPUT_DIR
=
"
${
KUBE_ROOT
}
/_tmp/api-reference"
mkdir
-p
${
HOST_OUTPUT_DIR
}
TMP_ROOT
=
"
${
KUBE_ROOT
}
/_tmp"
# Generate API reference docs in tmp.
...
...
@@ -42,7 +35,7 @@ TMP_ROOT="${KUBE_ROOT}/_tmp"
echo
"diffing
${
API_REFERENCE_DOCS_ROOT
}
against freshly generated docs"
ret
=
0
diff
-Naupr
-I
'Last update'
--exclude
=
*
.md
"
${
API_REFERENCE_DOCS_ROOT
}
"
"
${
TMP
_OUTPUT_DIR
}
"
||
ret
=
$?
diff
-Naupr
-I
'Last update'
--exclude
=
*
.md
"
${
API_REFERENCE_DOCS_ROOT
}
"
"
${
HOST
_OUTPUT_DIR
}
"
||
ret
=
$?
rm
-rf
"
${
TMP_ROOT
}
"
if
[[
$ret
-eq
0
]]
then
...
...
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