Skip to content

Commit

Permalink
allow jenkins to build sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
hantaowang committed Mar 24, 2020
1 parent 7dce6d9 commit fa2710c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
10 changes: 8 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,18 @@ kubectl apply -f $BACKEND_DEPLOY_PROD_FILEPATH'''
branch "master"
anyOf {
changeset "berkeleytime/**"
changeset "frontend/**"
changeset "Jenkinsfile"
}
}
steps {
git(url: 'https://github.com/asuc-octo/berkeleytime', branch: env.BRANCH_NAME, credentialsId: 'GitHubAcc')
sh "sphinx-build -M help . /var/jenkins_home/userContent/sphinx"
sh '''version=$(git rev-parse --short HEAD)
containerID=$(docker run -d -e ENVIRONMENT_NAME=LOCALHOST --entrypoint sleep ${BACKEND_STAGE_GCR_PATH}:$version 1000)
docker cp /var/jenkins_home/workspace/berkeleytime_master $containerID:/bt
docker exec $containerID sphinx-build -b html /bt /sphinxout
rm -rf /var/jenkins_home/userContent/sphinx
docker cp $containerID:/sphinxout /var/jenkins_home/userContent/sphinx
docker kill $containerID'''
}
}
stage('Update-Data-Fetch-Image-Version') {
Expand Down
3 changes: 2 additions & 1 deletion berkeleytime/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y python2.7 python-pip build-essential libssl-dev \
libffi-dev libxml2-dev libxslt1-dev zlib1g-dev \
libjpeg-dev libncurses5-dev
libjpeg-dev libncurses5-dev python-sphinx
RUN pip install --upgrade pip

RUN mkdir berkeleytime
Expand Down
6 changes: 2 additions & 4 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@

import os
import sys
sys.path.insert(0, os.path.abspath('../berkeleytime/berkeleytime'))

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'berkeleytime.settings')
import django
django.setup()
sys.path.insert(0, os.path.abspath('berkeleytime'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "berkeleytime.settings")

# -- Project information -----------------------------------------------------

Expand Down
5 changes: 4 additions & 1 deletion kubernetes/manifests/infrastructure/jenkins-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ spec:
emptyDir: {}
containers:
- name: jenkins-dep
image: tsaianson/dockerjenkinskubectlgcsdkbase:latest
image: hantaowang/btjenkins:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: DOCKER_HOST
value: tcp://localhost:2375
- name: JAVA_OPTS
value: -Dhudson.model.DirectoryBrowserSupport.CSP=
volumeMounts:
- mountPath: /var/jenkins_home
name: jenkins-pv-storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/s
apt-get update && \
apt-get install -y kubectl
RUN apt-get -y install kubectl
RUN apt-get install python3-sphinx
RUN apt-get -y install python-sphinx
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
RUN mkdir -p /usr/local/gcloud \
&& tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \
&& /usr/local/gcloud/google-cloud-sdk/install.sh --quiet
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin

0 comments on commit fa2710c

Please sign in to comment.