<p>
Dynamically created job to generate apt and yum repos from packages built by jenkins. It uses the git archive from the package:tar cell in the upstream package matrix to determine which repos to create.
</p>
<p>
This job will trigger the downstream job supplied with DOWNSTREAM_JOB if passed to rake in the upstream invocation.
</p>
3
-1
-1
-1
false
false
deb||rpm
false
false
false
false
false
<%= "#{Pkg::Config.project}-packaging-#{Pkg::Config.build_date}-#{Pkg::Config.ref}" %>/command=package_tar
**/PROJECT_BUNDLE, **/BUILD_PROPERTIES
true
true
#!/bin/bash
## We have to check if this has been triggered by a successful package build
curl -s "http://<%= "#{Pkg::Config.jenkins_build_host}" %>/job/<%= "#{Pkg::Config.project}-packaging-#{Pkg::Config.build_date}-#{Pkg::Config.ref}" %>/lastBuild/api/json" | grep result\":\"SUCCESS\" > /dev/null
PACKAGE_BUILD_RESULT=$?
set -e
if [ $PACKAGE_BUILD_RESULT -eq 0 ] ; then
echo "Detected upstream package build success. Building repos."
### We've retrieved the git bundle from the tarball build, so now we clone it
### and use it to trigger our repo creation
#
# PROJECT_BUNDLE is a tarball containing a bundle file and git_repo is the
# directory that will contain the git repository. First we untar the tarball
# and then clone the git bundle
[ -f "PROJECT_BUNDLE" ] || exit 1
[ -f "BUILD_PROPERTIES" ] || exit 1
[ -d project ] && rm -rf project
mkdir project && tar -xzf PROJECT_BUNDLE -C project/
pushd project
git clone --recursive $(ls) git_repo
pushd git_repo
### Clone the packaging repo
bundle install --path .bundle/gems --bin .bundle/bin --retry 3
### Run repo creation
<% if Pkg::Config.final_mocks and not Pkg::Config.final_mocks.empty? %>
bundle exec rake PARAMS_FILE=../../BUILD_PROPERTIES pl:jenkins:rpm_repos --trace
<% else %>
echo "No mock/rpm targets found, skipping rpm repo creation"
<% end %>
<% if Pkg::Config.cows and not Pkg::Config.cows.empty? %>
bundle exec rake PARAMS_FILE=../../BUILD_PROPERTIES pl:jenkins:deb_repos --trace
<% else %>
echo "No cow/deb targets found, skipping deb repo creation"
<% end %>
popd
popd
else
echo "Detected upstream package build failure. Failing repo creation."
exit 1
fi
<% if ENV['DOWNSTREAM_JOB'] %>
<%= "#{Pkg::Config.project}-downstream-#{Pkg::Config.build_date}-#{Pkg::Config.ref}" %>
FAILURE
2
RED
<% else %>
<% end %>
xterm