-
Notifications
You must be signed in to change notification settings - Fork 785
Add table of contents generator/verify scripts #516
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
| source "$(dirname "${BASH_SOURCE}")/lib/init.sh" | ||
|
|
||
| # forked from github.com/ekalinin/github-markdown-toc/gh-md-toc | ||
| wget -O ${OS_OUTPUT_BINPATH}/gh-md-toc https://raw.githubusercontent.com/damemi/github-markdown-toc/hide-footer/gh-md-toc | ||
| chmod a+x ${OS_OUTPUT_BINPATH}/gh-md-toc | ||
|
|
||
| ${OS_OUTPUT_BINPATH}/gh-md-toc --insert --no-backup --hide-footer README.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o nounset | ||
| set -o pipefail | ||
|
|
||
| source "$(dirname "${BASH_SOURCE}")/lib/init.sh" | ||
|
|
||
| DESCHEDULER_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
|
|
||
| mkdir -p "${DESCHEDULER_ROOT}/_tmp" | ||
| _tmpdir="$(mktemp -d "${DESCHEDULER_ROOT}/_tmp/kube-vendor.XXXXXX")" | ||
|
|
||
| if [[ -z ${KEEP_TMP:-} ]]; then | ||
| KEEP_TMP=false | ||
| fi | ||
|
|
||
| function cleanup { | ||
| # make go module dirs writeable | ||
| chmod -R +w "${_tmpdir}" | ||
| if [ "${KEEP_TMP}" == "true" ]; then | ||
| echo "Leaving ${_tmpdir} for you to examine or copy. Please delete it manually when finished. (rm -rf ${_tmpdir})" | ||
| else | ||
| echo "Removing ${_tmpdir}" | ||
| rm -rf "${_tmpdir}" | ||
| fi | ||
| } | ||
| trap "cleanup" EXIT | ||
|
|
||
| _deschedulertmp="${_tmpdir}" | ||
| mkdir -p "${_deschedulertmp}" | ||
|
|
||
| git archive --format=tar --prefix=descheduler/ "$(git write-tree)" | (cd "${_deschedulertmp}" && tar xf -) | ||
| _deschedulertmp="${_deschedulertmp}/descheduler" | ||
|
|
||
| cp -r _output "${_deschedulertmp}" | ||
|
|
||
| pushd "${_deschedulertmp}" > /dev/null 2>&1 | ||
| hack/update-toc.sh | ||
| popd > /dev/null 2>&1 | ||
|
|
||
| ret=0 | ||
|
|
||
| pushd "${DESCHEDULER_ROOT}" > /dev/null 2>&1 | ||
| if ! _out="$(diff README.md "${_deschedulertmp}/README.md")"; then | ||
| echo "Generated table of contents differs:" >&2 | ||
| echo "${_out}" >&2 | ||
| echo "TOC verify failed." >&2 | ||
| echo "${_out}" > vendordiff.patch | ||
| echo "If you're seeing this locally, run the below command to fix your table of contents:" >&2 | ||
| echo "hack/update-toc.sh" >&2 | ||
| fi | ||
| popd > /dev/null 2>&1 | ||
|
|
||
| if [[ ${ret} -gt 0 ]]; then | ||
| exit ${ret} | ||
| fi | ||
|
|
||
| echo "Table of contents verified." |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should the
gh-md-tocscript just be added to the descheduler repo instead of downloading it from another repo?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 to duplicate https://github.com/kubernetes-sigs/metrics-server/blob/master/Makefile#L177-L189 ? Looks quite shorter.
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.
Oh sweet, I did not even know there was a k8s toc generator already. I'll update to use that instead.
We can vendor it like we do with our other generators so it doesn't have to be downloaded each time.