Browse files

Automate publishing of the dedicated kube-aws documentation site

* Print node.js version to debug when the script failed due to an incompatible node.js version
  * `nvm` for version-locking node.js isn't available in Travis CI's golang image

* Read the repo slug(`user/reponame`) from env vars so that we do not need to hard-code it

* Improve `make publish-docs` to support various cases
  * travis builds and local runs against a forked repo
  • Loading branch information...
mumoshu committed Aug 23, 2017
1 parent c90b40e commit 0e01bfc88070478c77cc7151fdf15403c792ba29
Showing with 58 additions and 1 deletion.
  1. +5 −0 .travis.yml
  2. +10 −1 Makefile
  3. +1 −0 ci/.gitignore
  4. +42 −0 ci/
  5. BIN kube-aws-bot-git-ssh-key.enc
@@ -6,3 +6,8 @@ script:
- make test-with-cover - make test-with-cover
after_success: after_success:
- bash <(curl -s - bash <(curl -s
provider: script
script: ci/
branch: master
@@ -42,6 +42,15 @@ generate-docs: docs-dependencies
serve-docs: docs-dependencies serve-docs: docs-dependencies
gitbook serve gitbook serve
# For publishing to the `git remote` named `mumoshu` linked to the repo url ``, the env vars should be:
# REPO=mumoshu/kube-aws REMOTE=mumoshu make publish-docs
# For publishing to the `git remote` named `origin` linked to the repo url ``, the env vars should be:
# REPO=kubernetes-incubator/kube-aws REMOTE=origin make publish-docs
# Or just:
# make publish-docs
.PHONY: publish-docs .PHONY: publish-docs
publish-docs: REPO ?= kubernetes-incubator/kube-aws
publish-docs: REMOTE ?= origin
publish-docs: generate-docs publish-docs: generate-docs
NODE_DEBUG=gh-pages gh-pages -d _book NODE_DEBUG=gh-pages gh-pages -d _book -r$(REPO).git -o $(REMOTE)
@@ -0,0 +1 @@
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -ve
# This script:
# - assumes you've created a ssh key used by kube-aws-bot to ssh into github:
# - utilizes Travis CI's file encryption feature for encrypting ssh keys
# It requires the following command beforehand:
# $ gem install travis
# $ travis login --auto
# $ travis encrypt-file ci/kube-aws-bot-git-ssh-key --repo <your github user or organization>/kube-aws
# And then change this line to the one output from the `travis encrypt-file` command above
openssl aes-256-cbc -K $encrypted_514cf8442810_key -iv $encrypted_514cf8442810_iv -in kube-aws-bot-git-ssh-key.enc -out ci/kube-aws-bot-git-ssh-key -d
## Prevent the following error:
## Permissions 0644 for '/home/travis/gopath/src/' are too open.
## ...
## bad permissions: ignore key: /home/travis/gopath/src/
chmod 600 ci/kube-aws-bot-git-ssh-key
# Finally run the following command to add the encrypted key to the git repo:
# $ git add kube-aws-bot-git-ssh-key.enc
# $ $ git commit -m '...'
echo -e "Host\n\tStrictHostKeyChecking no\nIdentityFile $(pwd)/ci/kube-aws-bot-git-ssh-key\n" >> ~/.ssh/config
set +e
set -e
if [ $status -ne 1 ]; then
echo ssh connection check to github failed: ssh command exited with status $status 1>&2
exit 1
echo Node.js $(node -v) is installed/being used
REPO=$TRAVIS_REPO_SLUG make publish-docs
Binary file not shown.

0 comments on commit 0e01bfc

Please sign in to comment.