-
Notifications
You must be signed in to change notification settings - Fork 38.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing versionize docs to version more files and run update-api-reference-docs.sh #16059
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,27 +49,45 @@ HTML_PREVIEW_PREFIX="https://htmlpreview.github.io/\?https://github.com/kubernet | |
md_dirs=(docs examples) | ||
md_files=() | ||
for dir in "${md_dirs[@]}"; do | ||
mdfiles+=($( find "${dir}" -name "*.md" -type f )) | ||
md_files+=($( find "${dir}" -name "*.md" -type f )) | ||
done | ||
for doc in "${mdfiles[@]}"; do | ||
for doc in "${md_files[@]}"; do | ||
$SED -ri \ | ||
-e '/<!-- BEGIN STRIP_FOR_RELEASE -->/,/<!-- END STRIP_FOR_RELEASE -->/d' \ | ||
-e "s|(releases.k8s.io)/[^/]+|\1/${NEW_VERSION}|g" \ | ||
"${doc}" | ||
|
||
# Replace /HEAD in html preview links with /NEW_VERSION. | ||
$SED -ri -e "s|(${HTML_PREVIEW_PREFIX}/HEAD)|${HTML_PREVIEW_PREFIX}/${NEW_VERSION}|" "${doc}" | ||
$SED -ri -e "s|(${HTML_PREVIEW_PREFIX})/HEAD|\1/blob/${NEW_VERSION}|g" "${doc}" | ||
|
||
is_versioned_tag="<!-- BEGIN MUNGE: IS_VERSIONED --> | ||
<!-- TAG IS_VERSIONED --> | ||
<!-- END MUNGE: IS_VERSIONED -->" | ||
<!-- TAG IS_VERSIONED --> | ||
<!-- END MUNGE: IS_VERSIONED -->" | ||
if ! grep -q "${is_versioned_tag}" "${doc}"; then | ||
echo -e "\n\n${is_versioned_tag}\n\n" >> "${doc}" | ||
fi | ||
done | ||
|
||
# Update API descriptions to match this version. | ||
$SED -ri -e "s|(releases.k8s.io)/[^/]+|\1/${NEW_VERSION}|" pkg/api/v[0-9]*/types.go | ||
# Update kubectl cmd files so that kubectl docs generated from them are as | ||
# expected. | ||
go_dirs=(pkg/kubectl/cmd) | ||
go_files=() | ||
for dir in "${go_dirs[@]}"; do | ||
go_files+=($( find "${dir}" -name "*.go" -type f )) | ||
done | ||
# Update API descriptions as well | ||
go_files+=(pkg/api/v[0-9]*/types.go) | ||
go_files+=(pkg/api/unversioned/types.go) | ||
go_files+=(pkg/apis/*/v[0-9]*/types.go) | ||
go_files+=(pkg/apis/*/types.go) | ||
|
||
for file in "${go_files[@]}"; do | ||
$SED -ri \ | ||
-e "s|(releases.k8s.io)/[^/]+|\1/${NEW_VERSION}|g" \ | ||
-e "s|(${HTML_PREVIEW_PREFIX})/HEAD)|\1/blob/${NEW_VERSION}|g" \ | ||
"${file}" | ||
done | ||
|
||
${KUBE_ROOT}/hack/update-generated-docs.sh | ||
${KUBE_ROOT}/hack/update-generated-swagger-docs.sh | ||
./hack/update-api-reference-docs.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ${KUBE_ROOT}/hack/update-api-reference-docs.sh ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That doesnt work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh hell, can we fix the script? This inconsistency is DOOMED to be broken. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per offline discussion, ${KUBE_ROOT}/hack/update-api-reference-docs.sh works on my machine, but not on nikhil's. Let's file an issue and solve it later. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the unversioned types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not generate docs from them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do, https://github.com/kubernetes/kubernetes/blob/master/api/swagger-spec/v1.json#L11339
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out.
Fixed. Am now running this script over the unversioned types.go as well