Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

enable scratch builds in Travis

commit a7610ab4239acc45c238cfd8c1574842a09a98c0 1 parent 6712b8c
@jdobes jdobes authored
View
24 .travis.yml
@@ -0,0 +1,24 @@
+branches:
+ only:
+ - master
+notifications:
+ email: false
+sudo: required
+before_install:
+- echo "deb http://us.archive.ubuntu.com/ubuntu trusty main universe" | sudo tee -a /etc/apt/sources.list
+- sudo apt-get update
+- wget https://fedorahosted.org/released/koji/koji-1.9.0.tar.bz2 -O /tmp/koji-1.9.0.tar.bz2
+- tar -xjf /tmp/koji-1.9.0.tar.bz2 -C /tmp
+- wget https://github.com/dgoodwin/tito/archive/tito-0.4.18-1.tar.gz -O /tmp/tito.tar.gz
+install:
+- sudo apt-get install yum yum-utils mock pigz python-rpm python-openssl python-urlgrabber python-decoratortools python-lzma python-setuptools python-krbv
+- sudo make -C /tmp/koji-1.9.0/cli DESTDIR=/ install && export PYTHONPATH=$PYTHONPATH:/tmp/koji-1.9.0/
+- sudo pip install /tmp/tito.tar.gz
+- sudo groupadd mock
+- sudo usermod -a -G mock travis
+before_script:
+- sudo cp rel-eng/travis/mock/spacewalk.cfg /etc/mock/
+- git config user.email "travis@localhost" && git config user.name "Travis"
+- ln -s `pwd`/rel-eng/travis/koji ~/.koji
+- echo "KOJI_OPTIONS=-c ~/.koji/spacewalk-config build --nowait" > ~/.spacewalk-build-rc
+script: rel-eng/travis/build
View
89 rel-eng/travis/build
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+
+LOOKASIDE="http://koji.spacewalkproject.org/lookaside-static"
+
+STATUS_ALL=0
+
+GITROOT=$(pwd)/$(git rev-parse --show-cdup)
+CHANGED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
+
+echo "Building commits: $TRAVIS_COMMIT_RANGE"
+
+# loop all packages
+for package in $GITROOT/rel-eng/packages/* ; do
+ prefix=$(cat $package | awk '{print $2}')
+ package_basename=$(basename $package)
+ latest_tag=$package_basename-$(cat $package | awk '{print $1}')
+ if echo "$CHANGED_FILES" | grep -q "^$prefix" ; then
+ # process package
+ echo -en "travis_fold:start:$package_basename-build\\r"
+ echo "Building $package_basename"
+ cd $GITROOT$prefix
+ # can we describe latest tag? tito fails if not
+ echo -en "travis_fold:start:$package_basename-latest-tag\\r"
+ echo "Describing latest tag"
+ # doesn't make sense to fetch history if the tag isn't there anyway
+ if git ls-remote origin $latest_tag | grep -q $latest_tag ; then
+ until git describe $latest_tag ; do
+ git_depth=$((git_depth + 500))
+ echo "Tag not found, fetching git history with depth $git_depth"
+ git fetch --depth=$git_depth
+ done
+ else
+ echo "Tag not in remote, not pushed?"
+ fi
+ echo -en "travis_fold:end:$package_basename-latest-tag\\r"
+ # we may need third party dependencies for creating SRPM
+ if grep -q "NoTgzBuilder" tito.props ; then
+ echo "Tito NoTgzBuilder found, getting sources"
+ version=$(rpmspec -q --srpm --qf "%{version}" $package_basename.spec)
+ wget -r -nd -np -nv -R "index.html*" -e robots=off $LOOKASIDE/$package_basename-$version/
+ # need to commit downloaded sources for Tito
+ git add . && git commit -am "Adding sources"
+ fi
+ # create SRPM
+ srpm=$(tito build --test --srpm | tail -n1 | sed 's/^Wrote: //g')
+ echo "SRPM created: $srpm"
+ echo -en "travis_fold:start:$package_basename-mock\\r"
+ echo "Running mock"
+ # build SRPM
+ sudo mock -r spacewalk --resultdir=/tmp/mock/$package_basename --rebuild $srpm
+ status=$?
+ echo -en "travis_fold:end:$package_basename-mock\\r"
+ if [ $status -eq 0 ] ; then
+ echo "Building $package_basename succeeded"
+ # build in koji if tag was pushed
+ tag_commit=$(git rev-parse $latest_tag^{commit})
+ if [ -f ~/.koji/.spacewalk.cert ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && git rev-list $TRAVIS_COMMIT_RANGE | grep -q "$tag_commit" ; then
+ echo "Tag present, releasing to Koji"
+ # workarround - git ls-remote ./. on Travis doesn't work with shallow clones (bug?)
+ mv $GITROOT/.git/shallow $GITROOT/.git/shallow.org
+ tito release koji
+ mv $GITROOT/.git/shallow.org $GITROOT/.git/shallow
+ fi
+ else
+ echo "Mock failed with code: $status"
+ fi
+ # output logs
+ echo -en "travis_fold:start:$package_basename-build-log\\r"
+ echo "# build.log"
+ cat /tmp/mock/$package_basename/build.log
+ echo -en "travis_fold:end:$package_basename-build-log\\r"
+
+ echo -en "travis_fold:start:$package_basename-root-log\\r"
+ echo "# root.log"
+ cat /tmp/mock/$package_basename/root.log
+ echo -en "travis_fold:end:$package_basename-root-log\\r"
+
+ echo -en "travis_fold:start:$package_basename-state-log\\r"
+ echo "# state.log"
+ cat /tmp/mock/$package_basename/state.log
+ echo -en "travis_fold:end:$package_basename-state-log\\r"
+
+ STATUS_ALL=$((STATUS_ALL+status))
+ echo -en "travis_fold:end:$package_basename-build\\r"
+ fi
+done
+
+exit $STATUS_ALL
+
View
25 rel-eng/travis/koji/.spacewalk-ca.cert
@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIEOTCCAyGgAwIBAgIJAIrAih4nZaSUMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlVTMRcwFQYDVQQIEw5Ob3J0aCBDYXJvbGluYTEQMA4GA1UEBxMHUmFsZWln
+aDESMBAGA1UEChMJU3BhY2V3YWxrMQswCQYDVQQLEwJDQTEVMBMGA1UEAxMMU3Bh
+Y2V3YWxrIENBMB4XDTE0MDQyNTE0NTA0MFoXDTI0MDQyMjE0NTA0MFowcDELMAkG
+A1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRAwDgYDVQQHEwdSYWxl
+aWdoMRIwEAYDVQQKEwlTcGFjZXdhbGsxCzAJBgNVBAsTAkNBMRUwEwYDVQQDEwxT
+cGFjZXdhbGsgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDFXdQR
+oElUDM/U9LYzzJr+OrX289S8bnFgIaTPP3eae0x0uf5Gnp24XwlzoDwt3yveubRM
+jfrvLcGzI1C02n6tm/VtXTMzHZNAzsa7aTnNNmE7rMAxqhiCjXIZk09DHoGMW0BV
+Nljz7Hm0xKbzXsig0hr9h6IaWtJ5Lu9Etd1DoWDDpx5DpaUz+U3xc6jysaLPH/GF
+EgQE6WevDxJmOgu+M/qjUJfyuvy3K2wLisTQONOuOrSBcUaEBNSliN1S4FlrsmPu
+wTrJS1o91ztBfWa9nSoMnVwwWgKHiL7eoeRpYIuIjD1j7fCs7LLnifo1KgHczns/
+HwMw7l3Il0oY1lx1AgMBAAGjgdUwgdIwHQYDVR0OBBYEFCcnSA2mZm/zW6XZmDLn
+WAEJeoZtMIGiBgNVHSMEgZowgZeAFCcnSA2mZm/zW6XZmDLnWAEJeoZtoXSkcjBw
+MQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcT
+B1JhbGVpZ2gxEjAQBgNVBAoTCVNwYWNld2FsazELMAkGA1UECxMCQ0ExFTATBgNV
+BAMTDFNwYWNld2FsayBDQYIJAIrAih4nZaSUMAwGA1UdEwQFMAMBAf8wDQYJKoZI
+hvcNAQEFBQADggEBAMJGW7xCzNTZyQVaKNAqgVgtllUmWhx9+zHW1B16A9DoDTFK
+3fvmWSMtIPc50PaLqSpToPYFDgkS+XUChVb2kVxiMKi1YBoN8QkLdWFLg2Ngqf9D
+LOmY22j38O1uWMKfTNHMKjZ6QLCigQ4KLeuZB+rwGM8uuRmJEIedoTRSJg5gsOHg
+2uIS3B+cXHK+WxqibnvTq+Th3m4whw9xEXbp9/HiDz5Dg2QtME67KD0nkO+agzcT
+FZvnoS+q488fNBhk5DC5i+WQ/Ansp0xSPCmQXpSP34g10IuNmyAhYSLU0GtyMtXc
+KDNmtpdbrgHjj1SW4f1ocrS/i2je2sCgg6jluOE=
+-----END CERTIFICATE-----
View
9 rel-eng/travis/koji/spacewalk-config
@@ -0,0 +1,9 @@
+[koji]
+;configuration for koji cli tool
+
+server = http://koji.spacewalkproject.org/kojihub
+weburl = http://koji.spacewalkproject.org/koji
+topurl = http://koji.spacewalkproject.org/
+cert = ~/.koji/.spacewalk.cert
+ca = ~/.koji/.spacewalk-ca.cert
+serverca = ~/.koji/.spacewalk-ca.cert
View
59 rel-eng/travis/mock/spacewalk.cfg
@@ -0,0 +1,59 @@
+config_opts['root'] = 'spacewalk-fedora21'
+config_opts['target_arch'] = 'noarch'
+config_opts['legal_host_arches'] = ('x86_64',)
+config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
+config_opts['dist'] = 'fc21' # only useful for --resultdir variable subst
+config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
+config_opts['releasever'] = '21'
+
+config_opts['yum.conf'] = """
+[main]
+cachedir=/var/cache/yum
+keepcache=1
+debuglevel=2
+reposdir=/dev/null
+logfile=/var/log/yum.log
+retries=20
+obsoletes=1
+gpgcheck=0
+assumeyes=1
+syslog_ident=mock
+syslog_device=
+
+# repos
+
+[fedora]
+name=fedora
+metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-21&arch=x86_64
+failovermethod=priority
+gpgkey=https://getfedora.org/static/95A43F54.txt
+gpgcheck=1
+exclude=quartz
+
+[updates]
+name=updates
+metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f21&arch=x86_64
+failovermethod=priority
+gpgkey=https://getfedora.org/static/95A43F54.txt
+gpgcheck=1
+
+[jpackage-generic]
+name=JPackage generic
+mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0
+enabled=1
+gpgkey=http://www.jpackage.org/jpackage.asc
+gpgcheck=1
+
+[spacewalk-nightly]
+name=Spacewalk nightly
+baseurl=http://yum.spacewalkproject.org/nightly/Fedora/21/x86_64/
+enabled=1
+gpgcheck=0
+
+[spacewalk-nightly-client]
+name=Spacewalk nightly client
+baseurl=http://yum.spacewalkproject.org/nightly-client/Fedora/21/x86_64/
+enabled=1
+gpgcheck=0
+
+"""
Please sign in to comment.
Something went wrong with that request. Please try again.