]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
osc: add osc related scripts:
authorKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Mon, 12 Aug 2019 17:06:55 +0000 (19:06 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Fri, 16 Aug 2019 01:05:10 +0000 (03:05 +0200)
- validate_osc
- setup_osc
- build_osc
Supposed for adding them later to ceph-dev-new-build or ceph-dev-build

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
ceph-dev-build/build/build_osc [new file with mode: 0644]
ceph-dev-build/build/setup_osc [new file with mode: 0644]
ceph-dev-build/build/validate_osc [new file with mode: 0644]
ceph-dev-new-build/build/build_osc [new symlink]
ceph-dev-new-build/build/setup_osc [new symlink]
ceph-dev-new-build/build/validate_osc [new symlink]

diff --git a/ceph-dev-build/build/build_osc b/ceph-dev-build/build/build_osc
new file mode 100644 (file)
index 0000000..21d1838
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/bash
+set -ex
+
+# create a release directory for ceph-build tools
+raw_version=`echo $vers | cut -d '-' -f 1`
+
+RELEASE_BRANCH=$(release_from_version $raw_version)
+case $RELEASE_BRANCH in
+nautilus|octopus)
+    OBSREPO="openSUSE_Leap_15.1"
+    ;;
+mimic)
+    OBSREPO="openSUSE_Leap_15.0"
+    ;;
+luminous)
+    OBSREPO="openSUSE_Leap_42.3"
+    ;;
+*)
+    echo Not supported release '$RELEASE_BRANCH' by openSUSE
+    exit 1
+    ;;
+esac
+
+OBSPROJ="filesystems:ceph:$RELEASE_BRANCH:upstream"
+OBSARCH="x86_64"
+BUILDHOME=/var/tmp/build-root/$OBSREPO-$OBSARCH/home/abuild
+
+rm -rf $OBSPROJ
+osc co $OBSPROJ
+
+rm $OBSPROJ/ceph/ceph-*.tar.bz2
+rm $OBSPROJ/ceph/ceph.spec
+
+cp -a dist/ceph-*.tar.bz2 $OBSPROJ/ceph/.
+cp -a dist/ceph.spec $OBSPROJ/ceph/.
+cp -a dist/rpm/*.patch $OBSPROJ/ceph/. || true
+
+echo "Building RPMs"
+
+(
+  cd $OBSPROJ/ceph
+  osc build --trust-all-projects --clean $OBSREPO $OBSARCH
+)
+
+
+RPM_RELEASE=$(grep Release $OBSPROJ/ceph/ceph.spec | sed 's/Release:[ \t]*//g' | cut -d '%' -f 1)
+RPM_VERSION=$(grep Version $OBSPROJ/ceph/ceph.spec | sed 's/Version:[ \t]*//g')
+PACKAGE_MANAGER_VERSION="$RPM_VERSION-$RPM_RELEASE"
+
+
+chacra_binary="$VENV/chacractl binary"
+[ "$FORCE" = true ] && chacra_binary="$chacra_binary --force"
+
+chacra_create="$chacra_binary create"
+if [ "$THROWAWAY" = false ] ; then
+    # push binaries to chacra
+    find $BUILDHOME/rpmbuild/SRPMS | grep "\.rpm$" |
+      $chacra_create ${chacra_endpoint}/source/flavors/${FLAVOR}
+    find $BUILDHOME/rpmbuild/RPMS | grep "\.rpm$" | 
+      $chacra_create ${chacra_endpoint}/${ARCH}/flavors/${FLAVOR}
+    # write json file with build info
+    cat > $WORKSPACE/repo-extra.json << EOF
+{
+    "version":"$vers",
+    "package_manager_version":"$PACKAGE_MANAGER_VERSION",
+    "build_url":"$BUILD_URL",
+    "root_build_cause":"$ROOT_BUILD_CAUSE",
+    "node_name":"$NODE_NAME",
+    "job_name":"$JOB_NAME"
+}
+EOF
+    chacra_repo_endpoint="${chacra_endpoint}/flavors/${FLAVOR}"
+    # post the json to repo-extra json to chacra
+    curl -X POST -H "Content-Type:application/json" --data "@$WORKSPACE/repo-extra.json" -u $CHACRACTL_USER:$CHACRACTL_KEY ${chacra_url}repos/${chacra_repo_endpoint}/extra/
+    # start repo creation
+    $VENV/chacractl repo update ${chacra_repo_endpoint}
+
+    echo Check the status of the repo at: https://shaman.ceph.com/api/repos/${chacra_endpoint}/flavors/${FLAVOR}/
+fi
+
+# update shaman with the completed build status
+update_build_status "completed" "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH
diff --git a/ceph-dev-build/build/setup_osc b/ceph-dev-build/build/setup_osc
new file mode 100644 (file)
index 0000000..de692e3
--- /dev/null
@@ -0,0 +1,117 @@
+#!/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
+
+cd dist
+ORIGTAR=(*.orig.tar.gz)
+ORIGDIR=${ORIGTAR%.orig.tar.gz}
+ORIGDIR=${ORIGDIR//_/-}
+tar xzf $ORIGTAR
+cd $ORIGDIR
+pwd
+
+# do not need this on opensuse
+#maybe_downgrade_gcc
+
+BRANCH=`branch_slash_filter $BRANCH`
+
+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|openSUSE)
+        DESC=`$LSB_RELEASE --short --description`
+        RELEASE=`$LSB_RELEASE --short --release`
+        case $DESC in
+        *openSUSE*)
+                DIST=leap${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
+
+# 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 -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
diff --git a/ceph-dev-build/build/validate_osc b/ceph-dev-build/build/validate_osc
new file mode 100644 (file)
index 0000000..9dc483f
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+set -ex
+
+# only do work if we are a SUSE distro
+( source /etc/os-release
+  case $ID in
+    opensuse*|suse|sles)
+      exit 0
+      ;;
+    *)
+      exit 1
+      ;;
+  esac) || exit 0
diff --git a/ceph-dev-new-build/build/build_osc b/ceph-dev-new-build/build/build_osc
new file mode 120000 (symlink)
index 0000000..a4c8adf
--- /dev/null
@@ -0,0 +1 @@
+../../ceph-dev-build/build/build_osc
\ No newline at end of file
diff --git a/ceph-dev-new-build/build/setup_osc b/ceph-dev-new-build/build/setup_osc
new file mode 120000 (symlink)
index 0000000..2c70656
--- /dev/null
@@ -0,0 +1 @@
+../../ceph-dev-build/build/setup_osc
\ No newline at end of file
diff --git a/ceph-dev-new-build/build/validate_osc b/ceph-dev-new-build/build/validate_osc
new file mode 120000 (symlink)
index 0000000..112e942
--- /dev/null
@@ -0,0 +1 @@
+../../ceph-dev-build/build/validate_osc
\ No newline at end of file