]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-dev-build: adds a setup_rpm script
authorAndrew Schoen <aschoen@redhat.com>
Sat, 1 Oct 2016 11:26:12 +0000 (06:26 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Sat, 1 Oct 2016 11:45:35 +0000 (06:45 -0500)
We want to split up setup by os type so we can post
correct build info to shaman earlier

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
ceph-dev-build/build/build_rpm
ceph-dev-build/build/setup_rpm [new file with mode: 0644]
ceph-dev-build/config/definitions/ceph-dev-build.yml

index 1babfb5feab7c62eed0cce920add6762078f392f..9efde9bad81a8e7a3fa078088cd333b02a079f97 100644 (file)
@@ -1,105 +1,6 @@
 #!/bin/bash
 set -ex
 
-BRANCH=`branch_slash_filter $BRANCH`
-
-
-if [[ ! -f /etc/redhat-release && ! -f /usr/bin/zypper ]] ; then
-    exit 0
-fi
-
-cd $WORKSPACE
-
-get_rpm_dist() {
-    LSB_RELEASE=/usr/bin/lsb_release
-    [ ! -x $LSB_RELEASE ] && echo unknown && exit
-
-    ID=`$LSB_RELEASE --short --id`
-
-    case $ID in
-    RedHatEnterpriseServer)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=rhel$RELEASE
-        DISTRO=rhel
-        ;;
-    CentOS)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=el$RELEASE
-        DISTRO=centos
-        ;;
-    Fedora)
-        RELEASE=`$LSB_RELEASE --short --release`
-        DIST=fc$RELEASE
-        DISTRO=fedora
-        ;;
-    SUSE\ LINUX)
-        DESC=`$LSB_RELEASE --short --description`
-        RELEASE=`$LSB_RELEASE --short --release`
-        case $DESC in
-        *openSUSE*)
-                DIST=opensuse$RELEASE
-                DISTRO=opensuse
-            ;;
-        *Enterprise*)
-                DIST=sles$RELEASE
-                DISTRO=sles
-                ;;
-            esac
-        ;;
-    *)
-        DIST=unknown
-        DISTRO=unknown
-        ;;
-    esac
-
-    echo $DIST
-}
-
-get_rpm_dist
-
-# Normalize variables across rpm/deb builds
-NORMAL_DISTRO=$DISTRO
-NORMAL_DISTRO_VERSION=$RELEASE
-NORMAL_ARCH=$ARCH
-
-# Write these values to a file so the failure
-# script can consume them if the build fails
-cat > $WORKSPACE/build_info << EOF
-NORMAL_DISTRO=$distro
-NORMAL_DISTRO_VERSION=$DIST
-NORMAL_ARCH=$ARCH
-EOF
-
-# create build status in shaman
-create_build_status "started" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH
-
-dist=$DIST
-[ -z "$dist" ] && echo no dist && exit 1
-echo dist $dist
-
-vers=`cat ./dist/version`
-chacra_ref="$BRANCH"
-
-chacra_endpoint="ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}"
-chacra_check_url="${chacra_endpoint}/${ARCH}/flavors/${FLAVOR}/librados2-${vers}-0.${DIST}.${ARCH}.rpm"
-
-
-if [ "$THROWAWAY" = false ] ; then
-    # this exists in scripts/build_utils.sh
-    check_binary_existence $chacra_check_url
-fi
-
-HOST=$(hostname --short)
-echo "Building on $(hostname)"
-echo "  DIST=${DIST}"
-echo "  ARCH=${ARCH}"
-echo "  WS=$WORKSPACE"
-echo "  PWD=$(pwd)"
-echo "  BUILD SOURCE=$COPYARTIFACT_BUILD_NUMBER_CEPH_SETUP"
-echo "*****"
-env
-echo "*****"
-
 
 # create a release directory for ceph-build tools
 mkdir -p release
diff --git a/ceph-dev-build/build/setup_rpm b/ceph-dev-build/build/setup_rpm
new file mode 100644 (file)
index 0000000..13ee878
--- /dev/null
@@ -0,0 +1,145 @@
+#!/bin/bash
+
+set -ex
+HOST=$(hostname --short)
+echo "Building on $(hostname)"
+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 "*****"
+
+DIR=/tmp/install-deps.$$
+trap "rm -fr $DIR" EXIT
+mkdir -p $DIR
+if test $(id -u) != 0 ; then
+    SUDO=sudo
+fi
+export LC_ALL=C # the following is vulnerable to i18n
+
+$SUDO yum install -y redhat-lsb-core
+
+# unpack the tar.gz that contains the debian dir
+cd dist
+tar xzf *.orig.tar.gz
+cd ceph-*
+pwd
+
+case $(lsb_release -si) in
+CentOS|Fedora|SUSE*|RedHatEnterpriseServer)
+        case $(lsb_release -si) in
+            SUSE*)
+                $SUDO zypper -y yum-utils
+                ;;
+            *)
+                $SUDO yum install -y yum-utils
+                ;;
+        esac
+        sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
+        $SUDO yum-builddep -y $DIR/ceph.spec
+        ;;
+*)
+        echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
+        ;;
+esac
+
+BRANCH=`branch_slash_filter $BRANCH`
+
+if [[ ! -f /etc/redhat-release && ! -f /usr/bin/zypper ]] ; then
+    exit 0
+fi
+
+cd $WORKSPACE
+
+get_rpm_dist() {
+    LSB_RELEASE=/usr/bin/lsb_release
+    [ ! -x $LSB_RELEASE ] && echo unknown && exit
+
+    ID=`$LSB_RELEASE --short --id`
+
+    case $ID in
+    RedHatEnterpriseServer)
+        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
+        DIST=rhel$RELEASE
+        DISTRO=rhel
+        ;;
+    CentOS)
+        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
+        DIST=el$RELEASE
+        DISTRO=centos
+        ;;
+    Fedora)
+        RELEASE=`$LSB_RELEASE --short --release`
+        DIST=fc$RELEASE
+        DISTRO=fedora
+        ;;
+    SUSE\ LINUX)
+        DESC=`$LSB_RELEASE --short --description`
+        RELEASE=`$LSB_RELEASE --short --release`
+        case $DESC in
+        *openSUSE*)
+                DIST=opensuse$RELEASE
+                DISTRO=opensuse
+            ;;
+        *Enterprise*)
+                DIST=sles$RELEASE
+                DISTRO=sles
+                ;;
+            esac
+        ;;
+    *)
+        DIST=unknown
+        DISTRO=unknown
+        ;;
+    esac
+
+    echo $DIST
+}
+
+get_rpm_dist
+
+# Normalize variables across rpm/deb builds
+NORMAL_DISTRO=$DISTRO
+NORMAL_DISTRO_VERSION=$RELEASE
+NORMAL_ARCH=$ARCH
+
+# Write these values to a file so the failure
+# script can consume them if the build fails
+cat > $WORKSPACE/build_info << EOF
+NORMAL_DISTRO=$distro
+NORMAL_DISTRO_VERSION=$DIST
+NORMAL_ARCH=$ARCH
+SHA1=$SHA1
+EOF
+
+# create build status in shaman
+create_build_status "started" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH
+
+pkgs=( "chacractl>=0.0.4" )
+install_python_packages "pkgs[@]"
+
+# ask shaman which chacra instance to use
+chacra_url=`curl -f -u $SHAMAN_API_USER:$SHAMAN_API_KEY https://shaman.ceph.com/api/nodes/next/`
+# create the .chacractl config file using global variables
+make_chacractl_config $chacra_url
+
+dist=$DIST
+[ -z "$dist" ] && echo no dist && exit 1
+echo dist $dist
+
+vers=`cat ./dist/version`
+chacra_ref="$BRANCH"
+
+chacra_endpoint="ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}"
+chacra_check_url="${chacra_endpoint}/${ARCH}/flavors/${FLAVOR}/librados2-${vers}-0.${DIST}.${ARCH}.rpm"
+
+
+if [ "$THROWAWAY" = false ] ; then
+    # this exists in scripts/build_utils.sh
+    # TODO if this exits we need to post to shaman a success
+    check_binary_existence $chacra_check_url
+fi
index b23a4d6e42dcc38b9d8bcaee3be3ecf4a4c51919..b9f303722c18930d2efe1dec4a2fa36b2b1fec32 100644 (file)
@@ -75,7 +75,7 @@
           !include-raw:
             - ../../build/validate_rpm
             - ../../../scripts/build_utils.sh
-            - ../../build/setup
+            - ../../build/setup_rpm
             - ../../build/build_rpm
 
     publishers: