]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-build: post 'extra' repo information to chacra for rpm repos
authorAndrew Schoen <aschoen@redhat.com>
Tue, 18 Oct 2016 17:48:02 +0000 (12:48 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 18 Oct 2016 17:48:02 +0000 (12:48 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
ceph-build/build/build_rpm

index c26d01c769437911abf1c6fc85cb4ebdf665c25f..17c3d9843733ad06b1a8ccd510eea54c22b29add 100644 (file)
@@ -98,6 +98,14 @@ cephver=$vers
 
 cd $releasedir/$cephver || exit 1
 
+# This is needed because the 'version' this job gets from upstream contains chars
+# that are not legal for an RPM file. These are already converted in the spec file whic
+# is what is consumed to create the RPM binary. Parse these values there so that they can
+# be reported as part of the build metadata
+RPM_RELEASE=`grep Release ceph.spec | sed 's/Release:[ \t]*//g' | cut -d '%' -f 1`
+RPM_VERSION=`grep Version ceph.spec | sed 's/Version:[ \t]*//g'`
+PACKAGE_MANAGER_VERSION="$RPM_VERSION-$RPM_RELEASE"
+
 # Set up build area
 BUILDAREA=./rpm/$dist
 mkdir -p ${BUILDAREA}/{SOURCES,SRPMS,SPECS,RPMS,BUILD}
@@ -121,6 +129,20 @@ if [ "$THROWAWAY" = false ] ; then
     # push binaries to chacra
     find release/${vers}/rpm/*/SRPMS | grep rpm | $VENV/chacractl binary ${chacra_flags} create ${chacra_endpoint}/source
     find release/${vers}/rpm/*/RPMS/* | grep rpm | $VENV/chacractl binary ${chacra_flags} create ${chacra_endpoint}/${ARCH}
+    # 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_endpoint}
 fi