Skip to content
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

Merged
merged 1 commit into from
Oct 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 25 additions & 7 deletions build/versionize-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${KUBE_ROOT}/hack/update-api-reference-docs.sh ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesnt work.
That script uses {PWD} which breaks when run using ${KUBE_ROOT}/hack/update-api-reference-docs.sh

Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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.