Skip to content

Commit

Permalink
Merge pull request #1 from plenoptic-org/jenkins
Browse files Browse the repository at this point in the history
Tries adding jenkins
  • Loading branch information
billbrod authored Oct 17, 2024
2 parents 791a387 + 14eac7b commit 6df564d
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
"use_download_button": True,
"use_repository_button": True,
"icon_links": [
{
"name": "Workshops home",
"url": "https://workshops.plenoptic.org/",
"type": "fontawesome",
"icon": "fa-solid fa-house",
},
{
"name": "Binder",
"url": "https://binder.flatironinstitute.org/v2/user/wbroderick/cshl2024?filepath=introduction-stripped.ipynb",
Expand Down
12 changes: 12 additions & 0 deletions jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
'python3.11' \
'python3.11-venv' \
ffmpeg \
git \
&& \
apt-get autoremove --purge -y && \
apt-get autoclean -y && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/*
80 changes: 80 additions & 0 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
pipeline {
agent none
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '8', daysToKeepStr: '20'))
timeout(time: 2, unit: 'HOURS')
}
stages {
stage('docs') {
agent {
dockerfile {
dir 'jenkins'
// map volumes so we still have access to output
args '--gpus 1'
}
}
environment {
HOME = pwd(tmp:false)
OMP_NUM_THREADS = 4
PROJECT_NAME = "CSHL-vision-course-2024"
}
steps {
sh 'python3.11 -m venv --system-site-packages $HOME'
sh '''#!/bin/bash -ex
source $HOME/bin/activate
pip install -U pip
# pip install -r requirements.txt
# python3.11 -c "import torch; print(torch.cuda.current_device())"
# make -C docs html
'''
lock('plenoptic_workshop_publish') {
script {
def scm = scmGit(branches: [[name: 'refs/heads/main']], userRemoteConfigs: [[credentialsId: 'github-jenkins', url: 'https://github.com/plenoptic-org/plenoptic-workshops.git']])
dir(path: 'workshops') {
checkout(changelog: false, poll: false, scm: scm)
sh """#!/bin/bash -ex
if [[ "${env.BRANCH_NAME}" =~ PR ]]; then
out_dir="pulls/${env.BRANCH_NAME.replace('PR-', '')}"
elif [[ -n "${env.TAG_NAME}" ]]; then
out_dir="tags/${env.TAG_NAME}"
else
out_dir="branch/${env.BRANCH_NAME}"
fi
DOCS_DIR=workshops/\$PROJECT_NAME/\$out_dir
# rm -rf \$DOCS_DIR
# mkdir -p \$DOCS_DIR
# cp -rp \$HOME/docs/build/html/* \$DOCS_DIR
# git add -A \$DOCS_DIR
# GIT_COMMITTER_EMAIL="[email protected]" GIT_COMMITTER_NAME="Flatiron Jenkins" git commit --author='Flatiron Jenkins <[email protected]>' --allow-empty -m "Generated documentation for \$DOCS_DIR" -m '${env.BUILD_TAG}'
"""
// gitPush(gitScm: scm, targetBranch: 'main', targetRepo: 'origin')
}
}
}
}
}
}
post {
failure {
emailext subject: '$PROJECT_NAME - Build #$BUILD_NUMBER - $BUILD_STATUS',
body: '''$PROJECT_NAME - Build #$BUILD_NUMBER - $BUILD_STATUS
Check console output at $BUILD_URL to view full results.
Building $BRANCH_NAME for $CAUSE
$JOB_DESCRIPTION
Chages:
$CHANGES
End of build log:
${BUILD_LOG,maxLines=200}
''',
recipientProviders: [
[$class: 'DevelopersRecipientProvider'],
],
replyTo: '$DEFAULT_REPLYTO'
}
}
}

0 comments on commit 6df564d

Please sign in to comment.