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

Add scripts and tasks to publish docs to github pages #2430

Merged
merged 1 commit into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ coverage.txt
test/e2e/e2e\.test

# mkdocs
/site
site

# temporal github pages
gh-pages
21 changes: 13 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ go:

go_import_path: k8s.io/ingress-nginx

# New secure variables can be added using travis encrypt -r kubernetes/ingress-nginx --add K=V
# New secure variables can be added using travis encrypt -r kubernetes/ingress-nginx --add K=V
env:
global:
- CHANGE_MINIKUBE_NONE_USER=true
- KUBERNETES_VERSION=v1.9.4
- DOCKER=docker
- TRAVIS_TIMEOUT=240
- BUSTED_VERSION=2.0.rc12
- GH_REF=github.com/kubernetes/ingress-nginx
- secure: LIS2XpZufWTcJ53jiRsSZy2Gi1EUJ1XmLg7z3f2ZHeMnyG2Jhk3GW4vod1FNru+PY4PWgddLdCdIl+jqOYXndFlbdAWF3/Oy5fEkYLXdYV7tdlHcPWDkqNFrfiyZ4guChN+b2Nk6FqU7o5fsZAIR7VAbgqNRF5XMo9Mhn/vhDCQRcnbXy7uq7JTrYUkqDbQoyYvT6b480GCY5gags1zp/xZfPDNZEe936o8i5IPTyiykRyNOXN/AH6kd3pR5e1xYgcvJ9KpSVPghcwFE7kJ4fOVMRhRG5ML+IyML+xD0jX43EMNoqRKZ/HS42kIMCInFbJEcxVde7DPNBZ7Y3GAqh7HO6qrE70Dn3ha6DID6zCoH2ArW39BxG4zempj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Z89zwjsGpa2GkFAJrwX/dphXXtn6oS20mLbu1kqocWTbGUJl/fYztTxCdOt/NoH/hiQMxy+TOGFF3Dx85MJiMUOlgk/NbPqUwBn5RbuD71L69vFZZLpU09V4PuablWW8ACQxgp8BMeqLhaLRn/I3r0ntRc8AdQ1xubPlrVWO9DDbhGfj44YPNoLUAC/7QHkRyCbP98Yv2FTXrJFcx9isA2viFx2UxzTsvXcAKHbCSAw=

jobs:
include:
Expand All @@ -53,7 +54,7 @@ jobs:
- make lua-test
- stage: Coverage
before_script:
# start minikube
# start minikube
- test/e2e/up.sh
script:
- go get github.com/jteeuwen/go-bindata/...
Expand All @@ -70,20 +71,24 @@ jobs:
- stage: publish amd64
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx
script:
- travis_wait ${TRAVIS_TIMEOUT} .travis/publish.sh amd64
- .travis/publish.sh amd64
Copy link
Member

Choose a reason for hiding this comment

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

Who do we not need TRAVIS_TIMEOUT anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was required only for the s390x and ppc64le nginx images. Right now I am building that with an AWS VM

- stage: publish arm
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx
script:
- travis_wait ${TRAVIS_TIMEOUT} .travis/publish.sh arm
- .travis/publish.sh arm
- stage: publish arm64
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx
script:
- travis_wait ${TRAVIS_TIMEOUT} .travis/publish.sh arm64
- .travis/publish.sh arm64
- stage: publish ppc64le
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx
script:
- travis_wait ${TRAVIS_TIMEOUT} .travis/publish.sh ppc64le
- .travis/publish.sh ppc64le
- stage: publish s390x
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx
script:
- travis_wait ${TRAVIS_TIMEOUT} .travis/publish.sh s390x
- .travis/publish.sh s390x
- stage: Publish docs
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx
script:
- .travis/publish-docs.sh
42 changes: 42 additions & 0 deletions .travis/publish-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if ! [ -z $DEBUG ]; then
set -x
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ "$COMPONENT" != "docs" ]; then
echo "This task runs only to publish docs"
exit 0
fi

make -C ${DIR}/.. build-docs

git config --global user.email "[email protected]"
git config --global user.name "Travis Bot"

git clone --branch=gh-pages --depth=1 https://${GH_REF} ${DIR}/gh-pages
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious to know why mkdocs gh-deploy would not be a good fit here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can change that but I found so many different ways that I choose this one. I can change this

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to, I haven't looked into the tool myself.

cd ${DIR}/gh-pages

git rm -r .

cp -r ${DIR}/../site/* .

git add .
git commit -m "Deploy GitHub Pages"
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" gh-pages > /dev/null 2>&1
10 changes: 5 additions & 5 deletions .travis/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ "$COMPONENT" == "docs" ]; then
echo "Skipping because we are publishing docs"
exit 0
fi

if [ $# -eq "1" ]
then
export ARCH=$1
Expand All @@ -26,11 +31,6 @@ source $DIR/common.sh
echo "Login to quay.io..."
docker login --username=$QUAY_USERNAME --password=$QUAY_PASSWORD quay.io >/dev/null 2>&1

if [ $# -eq "1" ]
then
export ARCH=$1
fi

case "$COMPONENT" in
"ingress-controller")
$DIR/ingress-controller.sh
Expand Down
2 changes: 1 addition & 1 deletion .travis/release-from-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ EOF
}

case "$1" in
ingress-controller|nginx)
ingress-controller|nginx|docs)
publish $TRAVIS_CI_TOKEN $1
;;
*)
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,11 @@ dep-ensure:
.PHONY: dev-env
dev-env:
@./hack/build-dev-env.sh

.PHONY: live-docs
live-docs:
@docker run --rm -it -p 3000:3000 -v ${PWD}:/docs aledbf/mkdocs:0.1
Copy link
Member

Choose a reason for hiding this comment

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

aledbf/mkdocs

What is this? Something custom?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I will create a repo for this image (I don't want to install mkdocs in my machine to test the docs or run a local copy)

Copy link
Member Author

Choose a reason for hiding this comment

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


.PHONY: build-docs
build-docs:
@docker run --rm -it -v ${PWD}:/docs aledbf/mkdocs:0.1 build