Skip to content

Instantly share code, notes, and snippets.

@SehgalDivij
Last active January 21, 2018 06:53
Show Gist options
  • Save SehgalDivij/b5d2545aa9f368b867f01dbee23d4850 to your computer and use it in GitHub Desktop.
Save SehgalDivij/b5d2545aa9f368b867f01dbee23d4850 to your computer and use it in GitHub Desktop.
Jenkins Configuration file for the demo project used at Python Pune Meetup
<!--
To use this configuration, do the following:
1. Create a Jenkins Project.
2. Go to the root directory of the configuration. (Linux - /var/lib/jenkins/jobs/<project name>/)
3. Replace the contents of the config.xml file with the contents of this gist, keeping whatever you need and replacing whatever you want to replace.
This should reflect the new configuration in the Jenkins configure section, if the configuration file is valid after copying.
-->
<?xml version="1.0" encoding="UTF-8"?>
<project>
<actions />
<description>Simple Jenkins project using Django for Python meetup demo.</description>
<keepDependencies>false</keepDependencies>
<properties>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.29.0">
<projectUrl>https://github.com/SehgalDivij/python-pune-demo/</projectUrl>
<displayName>Python Pune Demo Project</displayName>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.7.0">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://github.com/SehgalDivij/python-pune-demo</url>
<!-- Replace with your repository -->
<credentialsId>github_sehgal_divij</credentialsId>
<!-- Replace with your credentials -->
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
<!-- The branch to run the build on. -->
<!-- Jenkins will run builds only on the branch names present here. -->
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list" />
<extensions />
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers>
<hudson.triggers.SCMTrigger>
<spec>H/5 * * * *</spec>
<!-- Somehow, this does not work. I do not know why. -->
<ignorePostCommitHooks>false</ignorePostCommitHooks>
</hudson.triggers.SCMTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>PYENV_HOME=$WORKSPACE/.pythonpunedemo/
pip3 install -r requirements.txt</command>
<unstableReturn>1</unstableReturn>
<!-- Exit code 1 indicates this build unstable. -->
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>PYENV_HOME=$WORKSPACE/.pythonpunedemo/
# run tests here.
echo 'This is a shell command that you can post to Jenkins.'
echo 'Jenkins will execute these shell commands as part of the build process.'
echo 'You can trigger execution of the tests or any other step that you think should a part of your application build process.'
echo 'Adios.'
python3 manage.py test</command>
<unstableReturn>1</unstableReturn>
<!-- Exit code 1 indicates this build is unstable. -->
</hudson.tasks.Shell>
</builders>
<publishers>
<org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter plugin="github@1.29.0">
<commitShaSource class="org.jenkinsci.plugins.github.status.sources.BuildDataRevisionShaSource" />
<reposSource class="org.jenkinsci.plugins.github.status.sources.AnyDefinedRepositorySource" />
<contextSource class="org.jenkinsci.plugins.github.status.sources.ManuallyEnteredCommitContextSource">
<context>Demo Commit.</context>
</contextSource>
<statusResultSource class="org.jenkinsci.plugins.github.status.sources.ConditionalStatusResultSource" />
<statusBackrefSource class="org.jenkinsci.plugins.github.status.sources.BuildRefBackrefSource" />
<errorHandlers />
</org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter>
</publishers>
<buildWrappers />
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment