-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·68 lines (51 loc) · 1.29 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Create docker image containing lsst-the-doc tools
# @author Fabrice Jammes
set -euxo pipefail
DIR=$(cd "$(dirname "$0")"; pwd -P)
if [ -r "$DIR/env.sh" ]; then
. $DIR/env.sh
fi
GITHUB_REF_NAME=${GITHUB_REF_NAME:-""}
usage() {
cat << EOD
Usage: $(basename "$0") [options] path
Available options:
-p FTP Password for <project>.lsst.io
-h This message
Generate and upload documentation for a project whose root directory is <path>.
<path>/doc must exists.
EOD
}
# Get the options
while getopts hp:u: c ; do
case $c in
h) usage ; exit 0 ;;
u) LTD_USERNAME="$OPTARG" ;;
p) LTD_PASSWORD="$OPTARG" ;;
\?) usage ; exit 2 ;;
esac
done
shift "$((OPTIND-1))"
if [ $# -ne 1 ] ; then
usage
exit 2
fi
PROJECT_DIR=$1
shift
if [ -n "$GITHUB_REF_NAME" ]; then
GIT_REF="$GITHUB_REF_NAME"
else
GIT_REF=$(cd "$PROJECT_DIR" && git rev-parse --abbrev-ref HEAD)
fi
# strip trailing slash
PROJECT_DIR=$(echo $PROJECT_DIR | sed 's%\(.*[^/]\)/*%\1%')
IMAGE="qserv/doc:latest"
docker run -i -v $PROJECT_DIR:/project \
-e LTD_USERNAME=qserv \
-e LTD_PASSWORD="$LTD_PASSWORD" \
-e LTD_USERNAME="$LTD_USERNAME" \
-e GIT_REF="$GIT_REF" \
--user=$(id -u):$(id -g $USER) -- "$IMAGE" \
bash -lc run.sh
# bash