Skip to content

Instantly share code, notes, and snippets.

@smford22
Created May 1, 2015 05:24
Show Gist options
  • Save smford22/b63040889f413a3049d2 to your computer and use it in GitHub Desktop.
Save smford22/b63040889f413a3049d2 to your computer and use it in GitHub Desktop.
Jenkins Accept Job
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.11">
<projectUrl>https://github.com/smford22/sample-cookbook/</projectUrl>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.ChoiceParameterDefinition>
<name>BUMP_LEVEL</name>
<description>Select how to increment the cookbook version according to semantic versioning.</description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>patch</string>
<string>minor</string>
<string>major</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM" plugin="git@2.3.5">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name>origin</name>
<refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
<url>https://github.com/smford22/sample-cookbook.git</url>
<credentialsId>fe2cb8ac-1c16-4ab2-bad8-317dbe4709f2</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<browser class="hudson.plugins.git.browser.GithubWeb">
<url>https://github.com/smford22/sample-cookbook/</url>
</browser>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
<relativeTargetDir>cookbooks/${JOB_NAME}</relativeTargetDir>
</hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
</extensions>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>knife cookbook test -o cookbooks/${JOB_NAME} -a</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>foodcritic -f any cookbooks/${JOB_NAME}</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>rubocop cookbooks/${JOB_NAME}</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>rspec -fd --color --default-path cookbooks/${JOB_NAME}/spec</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>cd cookbooks/${JOB_NAME}
kitchen test</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>knife spork bump sample-cookbook $BUMP_LEVEL
COOKBOOK_VERSION=v`sed -n &quot;s/^ *version *[\&apos;\&quot;]\(.*\)[\&apos;\&quot;]/\1/p&quot; cookbooks/$JOB_NAME/metadata.rb`
echo COOKBOOK_VERSION=$COOKBOOK_VERSION &gt;&gt; build.properties
cd cookbooks/$JOB_NAME
if [ -b &quot;Berksfile.lock&quot; ]
then
berks update sample-cookbook
else
berks install
fi
berks upload sample-cookbook
git add metadata.rb
git commit -m &quot;Bump version to $COOKBOOK_VERSION&quot;</command>
</hudson.tasks.Shell>
<EnvInjectBuilder plugin="envinject@1.91.1">
<info>
<propertiesFilePath>build.properties</propertiesFilePath>
</info>
</EnvInjectBuilder>
</builders>
<publishers>
<hudson.plugins.git.GitPublisher plugin="git@2.3.5">
<configVersion>2</configVersion>
<pushMerge>false</pushMerge>
<pushOnlyIfSuccess>true</pushOnlyIfSuccess>
<forcePush>false</forcePush>
<tagsToPush>
<hudson.plugins.git.GitPublisher_-TagToPush>
<targetRepoName>origin</targetRepoName>
<tagName>$COOKBOOK_VERSION</tagName>
<tagMessage></tagMessage>
<createTag>true</createTag>
<updateTag>false</updateTag>
</hudson.plugins.git.GitPublisher_-TagToPush>
</tagsToPush>
<branchesToPush>
<hudson.plugins.git.GitPublisher_-BranchToPush>
<targetRepoName>origin</targetRepoName>
<branchName>master</branchName>
</hudson.plugins.git.GitPublisher_-BranchToPush>
</branchesToPush>
</hudson.plugins.git.GitPublisher>
</publishers>
<buildWrappers>
<io.chef.jenkins.ChefIdentityBuildWrapper plugin="chef-identity@0.1.2">
<jobIdentity>fords-chefio</jobIdentity>
</io.chef.jenkins.ChefIdentityBuildWrapper>
<hudson.plugins.ansicolor.AnsiColorBuildWrapper plugin="ansicolor@0.4.1">
<colorMapName>xterm</colorMapName>
</hudson.plugins.ansicolor.AnsiColorBuildWrapper>
<EnvInjectBuildWrapper plugin="envinject@1.91.1">
<info>
<propertiesContent>PATH=/opt/chefdk/embedded/bin:$PATH
KITCHEN_YAML=.kitchen-docker.yml</propertiesContent>
<loadFilesFromMaster>false</loadFilesFromMaster>
</info>
</EnvInjectBuildWrapper>
</buildWrappers>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment