Skip to content

Instantly share code, notes, and snippets.

@proffalken
Created January 25, 2017 14:56
Show Gist options
  • Save proffalken/6ce3d12cc620ce0d879f205759757491 to your computer and use it in GitHub Desktop.
Save proffalken/6ce3d12cc620ce0d879f205759757491 to your computer and use it in GitHub Desktop.
Jenkins Blue Ocean Python Development
FROM jenkinsci/blueocean:latest
USER root
RUN apk add --no-cache --update \
python \
python-dev \
py-pip \
build-base \
&& pip install virtualenv \
&& rm -rf /var/cache/apk/*
USER jenkins
node {
stage('Prepare'){
step([$class: 'WsCleanup'])
}
stage('Checkout') { // for display purposes
// Get some code from a GitHub repository
git 'https://bitbucket.org/proffalken/test_blog.git'
}
stage('Build Deps') {
// Run the pip install build
sh "virtualenv venv && ${env.WORKSPACE}/venv/bin/pip install -r requirements.txt"
}
stage('Run Tests') {
/* Call nose2. */
sh "${env.WORKSPACE}/venv/bin/nose2 --plugin nose2.plugins.junitxml --junit-xml"
/* Archive the test results */
step([$class: 'JUnitResultArchiver', testResults: '**/nose2-junit.xml'])
}
}
@proffalken
Copy link
Author

Build a docker container from the Dockerfile, then add the pipeline script into the job config for a new job once the docker container is running.

This should clone the repo, install the dependencies and run the tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment