system-config/modules/jenkins_jobs/templates/builder_gerrit_git_prep.xml.erb
Andrew Hutchings e53a05ac39 Add Jenkins job filler to puppet
Adds default Openstack jobs for a given project name into Jenkins

To envoke add a section as follows to your site manifest:

  class { "jenkins_jobs":
    site => "openstack",
    projects => ["project1", "project2"]
  }

Now using xml building blocks!

Change-Id: If4cacba91d3dc22207e53413543e5bcfcfb0b541
2012-03-20 15:40:01 +00:00

32 lines
828 B
Plaintext

<hudson.tasks.Shell>
<command>#!/bin/bash -xe
if [ -z &quot;$GERRIT_NEWREV&quot; ] &amp;&amp; [ -z &quot;$GERRIT_REFSPEC&quot; ]
then
echo &quot;This job may only be triggered by Gerrit.&quot;
exit 1
fi
if [[ ! -e .git ]]
then
git clone https://review.<%= site %>.org/p/$GERRIT_PROJECT .
fi
git remote update || git remote update # attempt to work around bug #925790
git reset --hard
git clean -x -f -d -q
if [ ! -z &quot;$GERRIT_REFSPEC&quot; ]
then
git checkout $GERRIT_BRANCH
git reset --hard remotes/origin/$GERRIT_BRANCH
git clean -x -f -d -q
git fetch https://review.<%= site %>.org/p/$GERRIT_PROJECT $GERRIT_REFSPEC
git merge FETCH_HEAD
else
git checkout $GERRIT_NEWREV
git reset --hard $GERRIT_NEWREV
git clean -x -f -d -q
fi
</command>
</hudson.tasks.Shell>