Skip to content

Commit

Permalink
Add documentation generation to pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jhg03a authored and dangogh committed Jun 26, 2018
1 parent 0a117a6 commit c6e31b0
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ for p in "${projects[@]}"; do
fi
continue
fi
if [[ $p == docs ]]; then
if isInGitTree; then
echo "----- Building docs ..."
pushd docs
make html
popd
tarball=$(createDocsTarball "${TC_DIR}")
ls -l $tarball
else
echo "---- Skipping docs creation"
fi
continue
fi
# strip trailing /
p=${p%/}
bldscript="$p/build/build_rpm.sh"
Expand Down
18 changes: 18 additions & 0 deletions build/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,21 @@ function createTarball() {
rm -r "$bndir"
echo "$tarball"
}

# ---------------------------------------
function createDocsTarball() {
local projDir=$(cd "$1"; pwd)
local projName=trafficcontrol
local version=$(getVersion "$TC_DIR")
local tarball="dist/apache-$projName-$version-docs.tar.gz"
local tardir="${projDir}/docs/build/"

# Create a BULDNUMBER file and add to tarball
local bndir=$(mktemp -d)
getBuildNumber >"$bndir/BUILD_NUMBER"

# create the tarball only from files in repo and BUILD_NUMBER
tar -czf "$tarball" -C "$bndir" BUILD_NUMBER -C "$tardir" . --exclude-vcs
rm -r "$bndir"
echo "$tarball"
}
1 change: 1 addition & 0 deletions docs/source/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
# limitations under the License.
#
Sphinx>=1.4.3
sphinx_rtd_theme>=0.4.0
44 changes: 44 additions & 0 deletions infrastructure/docker/build/Dockerfile-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
FROM centos:7

MAINTAINER Jonathan Gray

# top level of trafficcontrol directory must be mounted as a volume:
# docker run --volume /trafficcontrol:$(pwd) ...
VOLUME /trafficcontrol

### Common for all sub-component builds
RUN yum -y install \
epel-release \
git \
rpm-build && \
yum -y clean all

### docs specific requirements
ADD docs/source/requirements.txt /docs.requirements.txt
RUN yum -y install \
python-pip \
make && \
yum -y clean all && \
pip install -r /docs.requirements.txt
###

ADD infrastructure/docker/build/clean_build.sh /
CMD /clean_build.sh docs

# vi:syntax=Dockerfile
8 changes: 8 additions & 0 deletions infrastructure/docker/build/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ services:
volumes:
- ../../..:/trafficcontrol:z
command: ['-f', '/trafficcontrol/dist/weasel.txt', '/trafficcontrol']

docs:
image: docs_builder
build:
dockerfile: infrastructure/docker/build/Dockerfile-docs
context: ../../..
volumes:
- ../../..:/trafficcontrol:z

0 comments on commit c6e31b0

Please sign in to comment.