From 64a2f8ad089dc10d5d794cb3af73ba83bdb09dac Mon Sep 17 00:00:00 2001 From: Charlie Drage Date: Wed, 28 Oct 2020 14:53:34 -0400 Subject: [PATCH] Update introduction doc + add sync docs script Updates the introduction doc and adds a synchornization script to be manually run for website changes. Signed-off-by: Charlie Drage --- docs/introduction.md | 10 ++--- script/manual-docs-sync.sh | 79 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 6 deletions(-) create mode 100755 script/manual-docs-sync.sh diff --git a/docs/introduction.md b/docs/introduction.md index 9bb21763..03495247 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -9,13 +9,11 @@ Why do developers love it? - Simplify your development process with Docker Compose and then deploy your containers to a production cluster - Convert your `docker-compose.yaml` with one simple command `kompose convert` - - Immediately bring up your cluster with `kompose up` - - Bring it back down with `kompose down` ### It's as simple as 1-2-3 1. [Use an example docker-compose.yaml file](https://raw.githubusercontent.com/kubernetes/kompose/master/examples/docker-compose-v3.yaml) or your own -2. Run `kompose up` +2. Run `kompose convert` 3. Run `kubectl apply` and check your Kubernetes cluster for your newly deployed containers! ```sh @@ -40,13 +38,13 @@ Grab the Kompose binary! ```sh # Linux -curl -L https://github.com/kubernetes/kompose/releases/download/v1.21.0/kompose-linux-amd64 -o kompose +curl -L https://github.com/kubernetes/kompose/releases/download/v1.22.0/kompose-linux-amd64 -o kompose # macOS -curl -L https://github.com/kubernetes/kompose/releases/download/v1.21.0/kompose-darwin-amd64 -o kompose +curl -L https://github.com/kubernetes/kompose/releases/download/v1.22.0/kompose-darwin-amd64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/kompose ``` -_Windows:_ Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.21.0/kompose-windows-amd64.exe) and add the binary to your PATH. +_Windows:_ Download from [GitHub](https://github.com/kubernetes/kompose/releases/download/v1.22.0/kompose-windows-amd64.exe) and add the binary to your PATH. diff --git a/script/manual-docs-sync.sh b/script/manual-docs-sync.sh new file mode 100755 index 00000000..ca9e9eb2 --- /dev/null +++ b/script/manual-docs-sync.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + + +## README: +## This script is ran by running: +## cd script +## ./manual-docs-sync.sh +## +## This will take all documentation from the /docs folder of the master dir, add jekyll-related-metadata +## and push to the gh-pages branch. + +DOCS_REPO_NAME="kompose" +DOCS_REPO_URL="git@github.com:kubernetes/kompose.git" +DOCS_BRANCH="gh-pages" +DOCS_FOLDER="docs" + +# clone the repo +git clone "$DOCS_REPO_URL" "$DOCS_REPO_NAME" + +# change to that directory (to prevent accidental pushing to master, etc.) +cd "$DOCS_REPO_NAME" + +# switch to gh-pages and grab the docs folder from master +git checkout gh-pages +git checkout master docs + +# Remove README.md from docs folder as it isn't relevant +rm docs/README.md + +# Use introduction.md instead as the main index page +mv docs/introduction.md index.md + +# Check that index.md has the appropriate Jekyll format +index="index.md" +if cat $index | head -n 1 | grep "\-\-\-"; +then +echo "index.md already contains Jekyll format" +else +# Remove ".md" from the name +name=${index::-3} +echo "Adding Jekyll file format to $index" +jekyll="--- +layout: default +--- +" +echo -e "$jekyll\n$(cat $index)" > $index +fi + +# clean-up the docs and convert to jekyll-friendly docs +cd docs +for filename in *.md; do + if cat $filename | head -n 1 | grep "\-\-\-"; + then + echo "$filename already contains Jekyll format" + else + # Remove ".md" from the name + name=${filename::-3} + echo "Adding Jekyll file format to $filename" + jekyll="--- +layout: default +permalink: /$name/ +redirect_from: + - /docs/$name.md/ +--- +" + echo -e "$jekyll\n$(cat $filename)" > $filename + fi +done +cd .. + +git add --all + +# Check if anything changed, and if it's the case, push to origin/master. +if git commit -m 'Update docs' -m "Synchronize documentation against website" ; then + git push +fi + +# cd back to the original root folder +cd ..