Anatoly Litovsky has uploaded a new change for review.

Change subject: Creating the ovirt node rpm builder
......................................................................

Creating the ovirt node rpm builder

The patch splits the iso and node creation scripts.
It also adds configuration params allowing to reuse the same build code
in multiuple builders

Change-Id: I3d303c3dfd9a285295af0e33a631fa8035e5f997
Signed-off-by: Tolik Litovsky <[email protected]>
---
A jobs/confs/shell-scripts/build-local-ovirt-node-iso.sh
M jobs/confs/shell-scripts/build-local-ovirt-node.sh
M jobs/confs/yaml/builders/ovirt-node-builders.yaml
M jobs/confs/yaml/jobs/ovirt-node/ovirt-node-job.yaml
M jobs/confs/yaml/templates/ovirt-node-job-templates.yaml
5 files changed, 162 insertions(+), 48 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/jenkins refs/changes/17/38317/1

diff --git a/jobs/confs/shell-scripts/build-local-ovirt-node-iso.sh 
b/jobs/confs/shell-scripts/build-local-ovirt-node-iso.sh
new file mode 100755
index 0000000..8c78b92
--- /dev/null
+++ b/jobs/confs/shell-scripts/build-local-ovirt-node-iso.sh
@@ -0,0 +1,102 @@
+#!/bin/bash -xe
+echo "shell-scripts/build-local-ovirt-node.sh"
+#this scripts build ovirt-node and ovirt-node-is projects
+
+DISTRO="{distro}"
+
+do_build=true
+do_clean={clean_pre}
+
+do_publish_rpms={publish_rpms}
+
+# the die on error function
+function die {{
+    echo "$1"
+    exit 1
+}}
+
+
+#sets the env variables required for the rest
+function set_env {{
+    export CACHE="$PWD"/build
+    export OVIRT_NODE_BASE="$PWD"
+    export OVIRT_CACHE_DIR="$CACHE/$DISTRO"
+    export OVIRT_LOCAL_REPO=file://"$OVIRT_CACHE_DIR"/ovirt
+}}
+
+
+# builds the iso
+#parameters
+#      1 : parameter to indicate the extra ks file to run
+function build_iso {{
+    pushd .
+    cd "$OVIRT_NODE_BASE"
+    cat > extra-recipe.ks <<EOF_ks
+%packages --excludedocs --nobase
+ovirt-node-plugin-vdsm
+ovirt-node-plugin-hosted-engine
+%end
+EOF_ks
+    cd "$OVIRT_NODE_BASE"/ovirt-node-iso
+    ./autogen.sh \
+        --with-recipe=../ovirt-node/recipe \
+        --with-extra-recipe=../extra-recipe.ks
+    if  ! make iso publish ; then
+        die "ISO build failed"
+    fi
+    if ! cp ovirt-node-image.ks "$OVIRT_CACHE_DIR"/ ; then
+        die "can't find source kick start , you should never reach here"
+    fi
+    popd
+}}
+
+#the prereqs
+function check_pre {{
+    if [[ ! -d $OVIRT_NODE_BASE/ovirt-node ]] ; then
+        die "No node base found"
+    fi
+    if [[ ! -d $OVIRT_NODE_BASE/ovirt-node-iso ]] ; then
+        die "No node-ISO base found"
+    fi
+}}
+
+function clean_iso {{
+    pushd .
+    local clean_failed=false
+    sudo rm -rf "$CACHE"
+    cd "$OVIRT_NODE_BASE"/ovirt-node-iso
+    # get rid of old makefiles
+    git clean -dfx
+    # generate new makefiles
+    ./autogen.sh
+    make clean \
+        || clean_failed=true
+    popd
+    if $clean_failed; then
+        return 1
+    else
+        return 0
+    fi
+}}
+
+
+set_env
+check_pre
+
+for dir in exported-artifacts; do
+    rm -Rf "$dir"
+    mkdir -p "$dir"
+done
+
+
+if $do_clean; then
+    clean_iso
+fi
+
+if $do_build; then
+    build_iso
+fi
+
+if $do_publish_rpms; then
+    cp "$OVIRT_CACHE_DIR"/ovirt/binary/*.iso exported-artifacts/
+fi
diff --git a/jobs/confs/shell-scripts/build-local-ovirt-node.sh 
b/jobs/confs/shell-scripts/build-local-ovirt-node.sh
index df6fc1d..2f6a461 100755
--- a/jobs/confs/shell-scripts/build-local-ovirt-node.sh
+++ b/jobs/confs/shell-scripts/build-local-ovirt-node.sh
@@ -4,6 +4,10 @@
 
 DISTRO="{distro}"
 
+do_build=true
+do_clean={clean_pre}
+
+do_publish_rpms={publish_rpms}
 
 # the die on error function
 function die {{
@@ -18,32 +22,6 @@
     export OVIRT_NODE_BASE="$PWD"
     export OVIRT_CACHE_DIR="$CACHE/$DISTRO"
     export OVIRT_LOCAL_REPO=file://"$OVIRT_CACHE_DIR"/ovirt
-}}
-
-
-# builds the iso
-#parameters
-#      1 : parameter to indicate the extra ks file to run
-function build_iso {{
-    pushd .
-    cd "$OVIRT_NODE_BASE"
-    cat > extra-recipe.ks <<EOF_ks
-%packages --excludedocs --nobase
-ovirt-node-plugin-vdsm
-ovirt-node-plugin-hosted-engine
-%end
-EOF_ks
-    cd "$OVIRT_NODE_BASE"/ovirt-node-iso
-    ./autogen.sh \
-        --with-recipe=../ovirt-node/recipe \
-        --with-extra-recipe=../extra-recipe.ks
-    if  ! make iso publish ; then
-        die "ISO build failed"
-    fi
-    if ! cp ovirt-node-image.ks "$OVIRT_CACHE_DIR"/ ; then
-        die "can't find source kick start , you should never reach here"
-    fi
-    popd
 }}
 
 
@@ -64,13 +42,11 @@
     if [[ ! -d $OVIRT_NODE_BASE/ovirt-node ]] ; then
         die "No node base found"
     fi
-    if [[ ! -d $OVIRT_NODE_BASE/ovirt-node-iso ]] ; then
-        die "No node-ISO base found"
-    fi
 }}
 
 
-function clean {{
+function clean_node {{
+    pushd .
     local clean_failed=false
     sudo rm -rf "$CACHE"
     cd "$OVIRT_NODE_BASE"/ovirt-node
@@ -80,15 +56,7 @@
     ./autogen.sh
     make distclean \
         || clean_failed=true
-    cd ..
-    cd "$OVIRT_NODE_BASE"/ovirt-node-iso
-    # get rid of old makefiles
-    git clean -dfx
-    # generate new makefiles
-    ./autogen.sh
-    make clean \
-        || clean_failed=true
-    cd ..
+    popd
     if $clean_failed; then
         return 1
     else
@@ -97,9 +65,6 @@
 }}
 
 
-do_build_iso=true
-do_build_node=true
-do_clean=true
 set_env
 check_pre
 
@@ -109,15 +74,14 @@
 done
 
 if $do_clean; then
-    clean
+    clean_node
 fi
 
-if $do_build_node; then
+if $do_build; then
     build_node
 fi
 
-if $do_build_iso; then
-    build_iso
+if $do_publish_rpms; then
+    cp "$OVIRT_CACHE_DIR"/ovirt/RPMS/noarch/ovirt-node*.rpm exported-artifacts/
 fi
 
-mv "$OVIRT_CACHE_DIR"/ovirt/binary/*.iso exported-artifacts/
diff --git a/jobs/confs/yaml/builders/ovirt-node-builders.yaml 
b/jobs/confs/yaml/builders/ovirt-node-builders.yaml
index bbbce5c..7f21a68 100644
--- a/jobs/confs/yaml/builders/ovirt-node-builders.yaml
+++ b/jobs/confs/yaml/builders/ovirt-node-builders.yaml
@@ -5,4 +5,9 @@
     name: ovirt-node_create-iso
     builders :
         - shell:
+            !include-raw shell-scripts/build-local-ovirt-node-iso.sh
+- builder:
+    name: ovirt-node_create
+    builders :
+        - shell:
             !include-raw shell-scripts/build-local-ovirt-node.sh
diff --git a/jobs/confs/yaml/jobs/ovirt-node/ovirt-node-job.yaml 
b/jobs/confs/yaml/jobs/ovirt-node/ovirt-node-job.yaml
index 36bc2e2..906663f 100644
--- a/jobs/confs/yaml/jobs/ovirt-node/ovirt-node-job.yaml
+++ b/jobs/confs/yaml/jobs/ovirt-node/ovirt-node-job.yaml
@@ -2,7 +2,7 @@
 ###   Projects
 ##############################################################################
 - project:
-    name: 'ovirt-node'
+    name: 'ovirt-node-iso-builder'
     project: 'ovirt-node'
     trigger:
       - merged
@@ -15,3 +15,18 @@
           branch: master
     jobs:
       - 'ovirt-node_{version}_create-iso-{distro}_{trigger}'
+
+- project:
+    name: 'ovirt-node-rpm-builder'
+    project: 'ovirt-node'
+    trigger:
+      - merged
+    distro :
+      - fc20
+      - el7
+      - el6
+    version :
+      - master:
+          branch: master
+    jobs:
+      - 'ovirt-node_{version}_create-rpms-{distro}_{trigger}'
diff --git a/jobs/confs/yaml/templates/ovirt-node-job-templates.yaml 
b/jobs/confs/yaml/templates/ovirt-node-job-templates.yaml
index 1f48eb0..ec6ed5d 100644
--- a/jobs/confs/yaml/templates/ovirt-node-job-templates.yaml
+++ b/jobs/confs/yaml/templates/ovirt-node-job-templates.yaml
@@ -3,8 +3,14 @@
     node : '{distro}'
     builders :
       - cleanup-slave
+      - ovirt-node_create:
+          distro: '{distro}'
+          clean_pre: 'true'
+          publish_rpms: 'false'
       - ovirt-node_create-iso:
           distro: '{distro}'
+          clean_pre: 'false'
+          publish_rpms: 'true'
     scm :
           - ovirt-node
           - ovirt-node-iso
@@ -18,3 +24,25 @@
       - email:
           recipients: [email protected]
           send-to-individuals: true
+
+- job-template:
+    name: 'ovirt-node_{version}_create-rpms-{distro}_{trigger}'
+    node : '{distro}'
+    builders :
+      - cleanup-slave
+      - ovirt-node_create:
+          distro: '{distro}'
+          clean_pre: 'true'
+          publish_rpms: 'true'
+    scm :
+          - ovirt-node
+    triggers:
+      - ovirt-node-{trigger}:
+          branch: '{branch}'
+    publishers:
+      - ovirt-node-cleanup:
+          distro: '{distro}'
+      - exported-artifacts
+      - email:
+          recipients: [email protected]
+          send-to-individuals: true


-- 
To view, visit https://gerrit.ovirt.org/38317
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d303c3dfd9a285295af0e33a631fa8035e5f997
Gerrit-PatchSet: 1
Gerrit-Project: jenkins
Gerrit-Branch: master
Gerrit-Owner: Anatoly Litovsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to