]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
add jenkins scripts
authorKen Dreyer <ken.dreyer@inktank.com>
Tue, 14 Jan 2014 03:24:39 +0000 (20:24 -0700)
committerKen Dreyer <ken.dreyer@inktank.com>
Tue, 14 Jan 2014 03:50:08 +0000 (20:50 -0700)
Move our Jenkins scripts out of Jenkins' database and into Git so that
we can have greater visibility on future changes.

Going forward, we will modify the ceph Jenkins tasks to only run these
scripts.

Signed-off-by: Ken Dreyer <ken.dreyer@inktank.com>
jenkins/build [new file with mode: 0644]
jenkins/package [new file with mode: 0644]
jenkins/setup [new file with mode: 0644]

diff --git a/jenkins/build b/jenkins/build
new file mode 100644 (file)
index 0000000..a0c8d16
--- /dev/null
@@ -0,0 +1,81 @@
+#export GNUPGHOME=/home/jenkins-build/build/gnupg.autobuild/
+export GNUPGHOME=/home/jenkins-build/build/gnupg.ceph-release/
+export KEYID=17ED316D
+HOST=$(hostname --short)
+echo "Building on $(hostname) Date: $(date)"
+echo "  DIST=${DIST}"
+echo "  BPTAG=${BPTAG}"
+echo "  KEYID=${KEYID}"
+echo "  WS=$WORKSPACE"
+echo "  PWD=$(pwd)"
+echo "  BUILD SOURCE=$COPYARTIFACT_BUILD_NUMBER_CEPH_SETUP"
+echo "*****"
+env
+echo "*****"
+
+if [ ! -d /srv/ceph-build ] ; then
+    echo "Build tools are not installed"
+    exit 1
+fi
+bindir=/srv/ceph-build
+
+case $HOST in
+gitbuilder-cdep-deb* | tala* | mira*)
+    if [ ! -d /srv/debian-base ] ; then
+        echo "debian base is not installed"
+        exit 1
+    fi
+    ;;
+esac
+
+
+vers=`cat ./dist/version`
+# create a release directory for ceph-build tools
+mkdir -p release
+cp -a dist release/${vers}
+echo $DIST > release/${vers}/debian_dists
+echo "${vers}-1" > release/${vers}/debian_version
+
+case $HOST in
+
+gitbuilder-cdep-deb* | tala* | mira*)
+
+        cd release/$vers
+
+        # unpack sources
+        dpkg-source -x ceph_${vers}-1.dsc
+        (  cd ceph-${vers}
+           #DEB_VERSION=$(dpkg-parsechangelog | sed -rne 's,^Version: (.*),\1, p' | cut -d'-' -f1)
+           DEB_VERSION=$(dpkg-parsechangelog | sed -rne 's,^Version: (.*),\1, p')
+           #BP_VERSION=${DEB_VERSION}-1${BPTAG}
+           BP_VERSION=${DEB_VERSION}${BPTAG}
+           DEBEMAIL="gary.lowell@inktank.com" dch -D $DIST --force-distribution -b -v "$BP_VERSION" "$comment"
+        )
+        dpkg-source -b ceph-${vers}
+        
+        echo "Building Debian"
+        cd "$WORKSPACE"
+        sudo $bindir/build_debs.sh ./release /srv/debian-base $vers
+
+        #Collect Artifacts
+        mkdir -p dist/debian
+        cp -a release/$vers/*.changes dist/debian/.
+        cp -a release/$vers/*.deb     dist/debian/.
+        cp -a release/$vers/*.dsc     dist/debian/.
+        cp -a release/$vers/*.diff.gz dist/debian/.
+        cp -a release/$vers/*.tar.gz  dist/debian/.
+
+        ;;
+
+*)
+        echo "Building RPMs"
+        $bindir/build_rpms.sh ./release $vers
+        
+        #Collect Artifacts
+        mkdir -p dist/rpm/${DIST}
+        mv release/${vers}/rpm/*/SRPMS ./dist/rpm/${DIST}/.
+        mv release/${vers}/rpm/*/RPMS/* ./dist/rpm/${DIST}/.
+        ;;
+
+esac
+echo "End Date: $(date)"
diff --git a/jenkins/package b/jenkins/package
new file mode 100644 (file)
index 0000000..9f8fa70
--- /dev/null
@@ -0,0 +1,13 @@
+#
+for dir in * ; do
+   echo $dir
+   arch=$(echo $dir | cut -d',' -f1 | cut -d'=' -f2)
+   dist=$(echo $dir | cut -d',' -f2 | cut -d'=' -f2 | cut -d'-' -f1)
+   echo "arch = $arch, dist = $dist"
+   if [ -d $dir/dist/rpm ] ; then
+        echo "rpms"
+   fi
+   if [ -d $dir/dist/debian ] ; then
+        echo "debian"
+   fi
+done
diff --git a/jenkins/setup b/jenkins/setup
new file mode 100644 (file)
index 0000000..996e190
--- /dev/null
@@ -0,0 +1,67 @@
+#export GNUPGHOME=/home/jenkins-build/build/gnupg.autobuild/
+export GNUPGHOME=/home/jenkins-build/build/gnupg.ceph-release/
+export KEYID=17ED316D
+HOST=$(hostname --short)
+echo "Building on ${HOST}"
+echo "  DIST=${DIST}"
+echo "  BPTAG=${BPTAG}"
+echo "  KEYID=${KEYID}"
+echo "  WS=$WORKSPACE"
+echo "  PWD=$(pwd)"
+echo "  BRANCH=$BRANCH"
+
+if [ -x "$BRANCH" ] ; then 
+    echo "No git branch was supplied"
+    exit 1
+fi
+
+echo "Building version $(git describe) Branch $Branch"
+
+if [ ! -d /srv/ceph-build ] ; then
+    echo "Build tools are not installed"
+    exit 1
+fi
+bindir=/srv/ceph-build
+rm -rf dist
+rm -rf release
+
+# fix version/release.  Hack needed only for the spec
+# file for rc candidates.
+#export force=force
+#sed -i 's/^Version:.*/Version:        0.72/' ceph.spec.in
+#sed -i 's/^Release:.*/Release:        rc1%{?dist}/' ceph.spec.in
+#sed -i 's/^Source0:.*/Source0:        http:\/\/ceph.com\/download\/%{name}-%{version}-rc1.tar.bz2/' ceph.spec.in
+#sed -i 's/^%setup.*/%setup -q -n %{name}-%{version}-rc1/' ceph.spec.in
+
+echo "Running configure ..."
+./do_autogen.sh 
+if [ $? -ne 0 ] ; then
+    echo "autogen failed"
+    exit 1
+fi
+
+mkdir -p release
+$bindir/release_tarball.sh release release/version
+if [ $? -ne 0] ; then
+    echo "make tarballs failed"
+    exit 2
+fi
+vers=`cat release/version`
+
+(
+    cd release/$vers
+    mv debian ceph-$vers/.
+    dpkg-source -b ceph-$vers
+)
+
+mkdir -p dist
+# Debian Source Files
+mv release/$vers/*.dsc dist/.
+mv release/$vers/*.diff.gz dist/.
+mv release/$vers/*.orig.tar.gz dist/.
+# RPM Source Files
+mv release/$vers/ceph.spec dist/.
+mv release/$vers/*.tar.* dist/.
+# Parameters
+mv release/version dist/.
+exit 0