-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: route knative docs base URL from knative.dev/docs to knative.dev #6319
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
Changes from all commits
c4d3cea
2c79dca
442aae5
1cc1ca0
c1e5eab
1d74163
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ set -x | |
# 1) Make a release-NN branch as normal. | ||
# 2) Update VERSIONS below (on main) to include the new version, and remove the oldest | ||
# Order matters :-), Most recent first. | ||
VERSIONS=("1.18" "1.17") # Docs version, results in the url e.g. knative.dev/docs-1.9/.. | ||
VERSIONS=("1.19" "1.18" "1.17") # Docs version, results in the url e.g. knative.dev/v1.9-docs/.. | ||
# 4) PR the result to main. | ||
# 5) Party. | ||
|
||
|
@@ -41,55 +41,61 @@ readonly SITE=$PWD/site | |
rm -rf site/ | ||
|
||
if [ "$BUILD_VERSIONS" == "no" ]; then | ||
# HEAD to /docs if we're not doing versioning. | ||
mkdocs build -f mkdocs.yml -d site/docs | ||
# Build to root if we're not doing versioning | ||
mkdocs build -f mkdocs.yml -d site | ||
rohan-019 marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
43
to
+45
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. FWIW, this "tiny build for preview" seems to potentially be the part that's messing things up. I wonder if we want to remove it for now, and leave a TODO to optimize this later. (The preview version is also not importing the serving/eventing reference docs, and makes it hard to reason about these sorts of changes from the preview.) |
||
else | ||
# Versioning: pre-release (HEAD): docs => development/ | ||
cp -r . $TEMP/docs-main | ||
# Build latest version to /docs | ||
cp -r . "$TEMP/docs-main" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/main/docs/serving-api.md -s > "$TEMP/docs-main/docs/serving/reference/serving-api.md" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/main/docs/eventing-api.md -s > "$TEMP/docs-main/docs/eventing/reference/eventing-api.md" | ||
pushd "$TEMP/docs-main"; mkdocs build -f mkdocs.yml -d $SITE/development; popd | ||
rohan-019 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Latest release branch to /docs | ||
git clone --depth 1 -b ${DOCS_BRANCHES[0]} https://github.com/${GIT_SLUG} "$TEMP/docs-$latest" | ||
rohan-019 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if [ ${latest#*1.} -gt 6 ]; then | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[0]}/docs/serving-api.md -s > "$TEMP/docs-$latest/docs/serving/reference/serving-api.md" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[0]}/docs/eventing-api.md -s > "$TEMP/docs-$latest/docs/eventing/reference/eventing-api.md" | ||
else | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[0]}/docs/serving-api.md -s > "$TEMP/docs-$latest/docs/reference/api/serving-api.md" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[0]}/docs/eventing-api.md -s > "$TEMP/docs-$latest/docs/reference/api/eventing-api.md" | ||
fi | ||
rohan-019 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
pushd "$TEMP/docs-$latest"; KNATIVE_VERSION="${VERSIONS[0]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[0]}" mkdocs build -d $SITE/docs; popd | ||
|
||
# Previous release branches release-$version to /v$version-docs | ||
|
||
# Create docs directory structure | ||
mkdir -p "$SITE/docs" | ||
|
||
# Build latest docs to /docs | ||
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. We were building the next-release docs to |
||
pushd "$TEMP/docs-main" | ||
KNATIVE_VERSION="${VERSIONS[0]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[0]}" mkdocs build -d "$SITE/docs" | ||
rohan-019 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
popd | ||
|
||
# Build versioned docs to /vX.Y-docs/ | ||
for i in "${!previous[@]}"; do | ||
version="${previous[$i]}" | ||
branch="${DOCS_BRANCHES[$((i+1))]}" | ||
|
||
git clone --depth 1 -b "$branch" "https://github.com/$GIT_SLUG" "$TEMP/docs-$version" | ||
|
||
# Fetch API reference docs for versioned builds | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/$branch/docs/serving-api.md -s > "$TEMP/docs-$version/docs/serving/reference/serving-api.md" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/$branch/docs/eventing-api.md -s > "$TEMP/docs-$version/docs/eventing/reference/eventing-api.md" | ||
|
||
pushd "$TEMP/docs-$version" | ||
KNATIVE_VERSION="$version.0" SAMPLES_BRANCH="$branch" mkdocs build -d "$SITE/v$version-docs" | ||
popd | ||
done | ||
|
||
# Build development site | ||
pushd "$TEMP/docs-main" | ||
KNATIVE_VERSION="${VERSIONS[0]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[0]}" mkdocs build -f mkdocs.yml -d "$SITE/development" | ||
popd | ||
Comment on lines
+76
to
+79
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. Why are we repeating 56-58 here? |
||
|
||
# Move non-versioned content to root level | ||
mkdir -p "$SITE/about" | ||
cp -r "$TEMP/docs-main/docs/about" "$SITE/" | ||
mkdir -p "$SITE/community" | ||
cp -r "$TEMP/docs-main/docs/community" "$SITE/" | ||
Comment on lines
+81
to
+85
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. I think this may break links for images, CSS, and JavaScript for these pages. I'll attempt another build with your changes this afternoon (I avoided this PR yesterday because I had a few other items and I really got pulled in on Friday). 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. The There are still a few items I'm trying to figure out in the navigation -- like why the "blog", "about", and "community" links don't show up in the navigation tabs, despite being in |
||
|
||
# Copy index.html and sitemap.xml to root | ||
cp "$SITE/docs/index.html" "$SITE/" | ||
cp "$SITE/docs/sitemap.xml" "$SITE/" | ||
|
||
# Create version JSON for version picker | ||
versionjson="" | ||
for i in "${!previous[@]}"; do | ||
version=${previous[$i]} | ||
versionjson+="{\"version\": \"v$version-docs\", \"title\": \"v$version\", \"aliases\": [\"\"]}," | ||
rohan-019 marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+91
to
95
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. This was previously in the loop on 60-74. I don't have a strong opinion, but it feels slightly odd to have the same loop twice with some other actions in between. |
||
|
||
echo "Building for previous version $version" | ||
git clone --depth 1 -b ${DOCS_BRANCHES[$i+1]} https://github.com/${GIT_SLUG} "$TEMP/docs-$version" | ||
if [ ${version#*1.} -gt 6 ]; then | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[i+1]}/docs/serving-api.md -s > "$TEMP/docs-$version/docs/serving/reference/serving-api.md" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[i+1]}/docs/eventing-api.md -s > "$TEMP/docs-$version/docs/eventing/reference/eventing-api.md" | ||
else | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/serving/${DOCS_BRANCHES[i+1]}/docs/serving-api.md -s > "$TEMP/docs-$version/docs/reference/api/serving-api.md" | ||
curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/${DOCS_BRANCHES[i+1]}/docs/eventing-api.md -s > "$TEMP/docs-$version/docs/reference/api/eventing-api.md" | ||
fi | ||
pushd "$TEMP/docs-$version"; KNATIVE_VERSION="${VERSIONS[i+1]}.0" SAMPLES_BRANCH="${DOCS_BRANCHES[i+1]}" VERSION_WARNING=true mkdocs build -d "$SITE/v$version-docs"; popd | ||
|
||
done | ||
|
||
# Set up the version file to point to the built docs. | ||
cat << EOF > $SITE/versions.json | ||
[ | ||
{"version": "docs", "title": "v$latest", "aliases": [""]}, | ||
$versionjson | ||
{"version": "development", "title": "(Pre-release)", "aliases": [""]} | ||
] | ||
EOF | ||
versionjson="[{\"version\": \"docs\", \"title\": \"latest\", \"aliases\": [\"\"]},$versionjson]" | ||
echo "$versionjson" > "$SITE/versions.json" | ||
fi | ||
|
||
# Create the blog | ||
|
@@ -107,25 +113,7 @@ cp golang/*.html site/golang/ | |
cat golang/_redirects >> site/_redirects | ||
|
||
|
||
# Home page is served from docs, so add a redirect. | ||
cat << EOF > site/index.html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Redirecting</title> | ||
<noscript> | ||
<meta http-equiv="refresh" content="1; url=docs/" /> | ||
</noscript> | ||
<script> | ||
window.location.replace("docs/"); | ||
</script> | ||
</head> | ||
<body> | ||
Redirecting to <a href="docs/">docs/</a>... | ||
</body> | ||
</html> | ||
EOF | ||
# Home page is now served directly from root, no redirect needed | ||
|
||
# Clean up | ||
rm -rf $TEMP | ||
|
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're not quite ready to release
1.19
-- the OpenTelemetry changes came in late and we've had to push some bug fixes.