summaryrefslogtreecommitdiffstats
path: root/jjb/apex
diff options
context:
space:
mode:
Diffstat (limited to 'jjb/apex')
-rwxr-xr-xjjb/apex/apex-iso-verify.sh104
-rwxr-xr-xjjb/apex/apex-upload-artifact.sh81
-rw-r--r--jjb/apex/apex.yml76
3 files changed, 222 insertions, 39 deletions
diff --git a/jjb/apex/apex-iso-verify.sh b/jjb/apex/apex-iso-verify.sh
new file mode 100755
index 000000000..cdeac04d7
--- /dev/null
+++ b/jjb/apex/apex-iso-verify.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# log info to console
+echo "Starting the Apex iso verify."
+echo "--------------------------------------------------------"
+echo
+
+BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
+
+source $BUILD_DIRECTORY/../opnfv.properties
+
+if ! rpm -q virt-install > /dev/null; then
+ sudo yum -y install virt-install
+fi
+
+# define a clean function
+rm_apex_iso_verify () {
+if sudo virsh list --all | grep apex-iso-verify | grep running; then
+ sudo virsh destroy apex-iso-verify
+fi
+if sudo virsh list --all | grep apex-iso-verify; then
+ sudo virsh undefine apex-iso-verify
+fi
+}
+
+# Make sure a pre-existing iso-verify isn't there
+rm_apex_iso_verify
+
+# run an install from the iso
+# This streams a serial console to tcp port 3737 on localhost
+sudo virt-install -n apex-iso-verify -r 4096 --vcpus 4 --os-variant=rhel7 \
+ --accelerate -v --noautoconsole --nographics \
+ --disk path=/var/lib/libvirt/images/apex-iso-verify.qcow2,size=30,format=qcow2 \
+ -l $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso \
+ --extra-args 'console=ttyS0 console=ttyS0,115200n8 serial inst.ks=file:/iso-verify.ks inst.stage2=hd:LABEL=OPNFV\x20CentOS\x207\x20x86_64:/' \
+ --initrd-inject $BUILD_DIRECTORY/../ci/iso-verify.ks \
+ --serial tcp,host=:3737,protocol=raw
+
+# Attach to tcpport 3737 and echo the output to stdout
+# watch for a 5 min time out, a power off message or a tcp disconnect
+python << EOP
+#!/usr/bin/env python
+
+import sys
+import socket
+from time import sleep
+from time import time
+
+
+TCP_IP = '127.0.0.1'
+TCP_PORT = 3737
+BUFFER_SIZE = 1024
+
+try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((TCP_IP, TCP_PORT))
+except Exception, e:
+ print "Failed to connect to the iso-verofy vm's serial console"
+ print "this probably means that the VM failed to start"
+ raise e
+
+activity = time()
+data = s.recv(BUFFER_SIZE)
+last_data = data
+while time() - activity < 300:
+ try:
+ if data != last_data:
+ activity = time()
+ last_data = data
+ data = s.recv(BUFFER_SIZE)
+ sys.stdout.write(data)
+ if 'Powering off' in data:
+ break
+ sleep(.5)
+ except socket.error, e:
+ # for now assuming that the connection was closed
+ # which is good, means the vm finished installing
+ # printing the error output just in case we need to debug
+ print "VM console connection lost: %s" % msg
+ break
+s.close()
+
+if time() - activity > 300:
+ print "failing due to console inactivity"
+ exit(1)
+else:
+ print "Success!"
+EOP
+
+# save the python return code for after cleanup
+python_rc=$?
+
+# clean up
+rm_apex_iso_verify
+
+# Exit with the RC of the Python job
+exit $python_rc
+
+echo
+echo "--------------------------------------------------------"
+echo "Done!"
diff --git a/jjb/apex/apex-upload-artifact.sh b/jjb/apex/apex-upload-artifact.sh
index c2de7d70d..d046c119d 100755
--- a/jjb/apex/apex-upload-artifact.sh
+++ b/jjb/apex/apex-upload-artifact.sh
@@ -3,8 +3,13 @@ set -o errexit
set -o nounset
set -o pipefail
+if [ -z "$ARTIFACT_TYPE" ]; then
+ echo "ERROR: ARTIFACT_TYPE not provided...exiting"
+ exit 1
+fi
+
# log info to console
-echo "Uploading the Apex artifact. This could take some time..."
+echo "Uploading the Apex ${ARTIFACT_TYPE} artifact. This could take some time..."
echo "--------------------------------------------------------"
echo
@@ -18,7 +23,7 @@ echo "Cloning releng repository..."
[ -d releng ] && rm -rf releng
git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
#this is where we import the siging key
-if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
+if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
source $WORKSPACE/releng/utils/gpg_import_key.sh
fi
@@ -45,32 +50,18 @@ echo "ISO signature Upload Complete!"
}
uploadiso () {
-# upload artifact and additional files to google storage
-gsutil cp $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log
-echo "ISO Upload Complete!"
-RPM_INSTALL_PATH=$BUILD_DIRECTORY/noarch
-RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL)
-VERSION_EXTENSION=$(echo $(basename $OPNFV_RPM_URL) | sed 's/opnfv-apex-//')
-for pkg in common undercloud; do # removed onos for danube
- RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}"
-done
-SRPM_INSTALL_PATH=$BUILD_DIRECTORY
-SRPM_LIST=$SRPM_INSTALL_PATH/$(basename $OPNFV_SRPM_URL)
-VERSION_EXTENSION=$(echo $(basename $OPNFV_SRPM_URL) | sed 's/opnfv-apex-//')
-for pkg in common undercloud; do # removed onos for danube
- SRPM_LIST+=" ${SRPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}"
-done
+ gsutil cp $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log
+ echo "ISO Upload Complete!"
}
uploadrpm () {
-#This is where we upload the rpms
-for artifact in $RPM_LIST $SRPM_LIST; do
- echo "Uploading artifact: ${artifact}"
- gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log
- echo "Upload complete for ${artifact}"
-done
-gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log
-gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log
+ for artifact in $RPM_LIST $SRPM_LIST; do
+ echo "Uploading artifact: ${artifact}"
+ gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log
+ echo "Upload complete for ${artifact}"
+ done
+ gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log
+ gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log
}
uploadsnap () {
@@ -84,21 +75,43 @@ uploadsnap () {
echo "Upload complete for Snapshot"
}
-if echo $WORKSPACE | grep promote > /dev/null; then
- uploadsnap
-elif gpg2 --list-keys | grep "opnfv-helpdesk@rt.linuxfoundation.org"; then
+if gpg2 --list-keys | grep "opnfv-helpdesk@rt.linuxfoundation.org"; then
echo "Signing Key avaliable"
- signiso
+ SIGN_ARTIFACT="true"
+fi
+
+if [ "$ARTIFACT_TYPE" == 'snapshot' ]; then
+ uploadsnap
+elif [ "$ARTIFACT_TYPE" == 'iso' ]; then
+ if [[ -n "$SIGN_ARTIFACT" && "$SIGN_ARTIFACT" == "true" ]]; then
+ signiso
+ fi
uploadiso
- signrpm
+elif [ "$ARTIFACT_TYPE" == 'rpm' ]; then
+ RPM_INSTALL_PATH=$BUILD_DIRECTORY/noarch
+ RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL)
+ VERSION_EXTENSION=$(echo $(basename $OPNFV_RPM_URL) | sed 's/opnfv-apex-//')
+ for pkg in common undercloud; do # removed onos for danube
+ RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}"
+ done
+ SRPM_INSTALL_PATH=$BUILD_DIRECTORY
+ SRPM_LIST=$SRPM_INSTALL_PATH/$(basename $OPNFV_SRPM_URL)
+ VERSION_EXTENSION=$(echo $(basename $OPNFV_SRPM_URL) | sed 's/opnfv-apex-//')
+ for pkg in common undercloud; do # removed onos for danube
+ SRPM_LIST+=" ${SRPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}"
+ done
+
+ if [[ -n "$SIGN_ARTIFACT" && "$SIGN_ARTIFACT" == "true" ]]; then
+ signrpm
+ fi
uploadrpm
else
- uploadiso
- uploadrpm
+ echo "ERROR: Unknown artifact type ${ARTIFACT_TYPE} to upload...exiting"
+ exit 1
fi
echo
echo "--------------------------------------------------------"
echo "Done!"
-echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
-echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
+if [ "$ARTIFACT_TYPE" == 'iso' ]; then echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"; fi
+if [ "$ARTIFACT_TYPE" == 'rpm' ]; then echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"; fi
diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml
index e7982ba55..56eac78e6 100644
--- a/jjb/apex/apex.yml
+++ b/jjb/apex/apex.yml
@@ -12,6 +12,7 @@
- 'apex-daily-{stream}'
- 'apex-csit-promote-daily-{stream}'
- 'apex-fdio-promote-daily-{stream}'
+ - 'apex-verify-iso-{stream}'
# stream: branch with - in place of / (eg. stable-arno)
# branch: branch (eg. stable/arno)
@@ -443,8 +444,64 @@
git-revision: false
same-node: true
block: true
+ - inject:
+ properties-content: ARTIFACT_TYPE=rpm
+ - 'apex-upload-artifact'
+ - trigger-builds:
+ - project: 'apex-verify-iso-{stream}'
+ predefined-parameters: |
+ BUILD_DIRECTORY=apex-build-{stream}/.build
+ git-revision: false
+ block: true
+ same-node: true
+ - inject:
+ properties-content: ARTIFACT_TYPE=iso
- 'apex-upload-artifact'
+# ISO verify job
+- job-template:
+ name: 'apex-verify-iso-{stream}'
+
+ # Job template for builds
+ #
+ # Required Variables:
+ # stream: branch with - in place of / (eg. stable)
+ # branch: branch (eg. stable)
+ node: '{daily-slave}'
+
+ disabled: false
+
+ concurrent: true
+
+ parameters:
+ - project-parameter:
+ project: '{project}'
+ branch: '{branch}'
+ - apex-parameter:
+ gs-pathname: '{gs-pathname}'
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: "Used for overriding the GIT URL coming from parameters macro."
+
+ scm:
+ - git-scm
+
+ properties:
+ - logrotate-default
+ - build-blocker:
+ use-build-blocker: true
+ block-level: 'NODE'
+ blocking-jobs:
+ - 'apex-deploy.*'
+ - throttle:
+ max-per-node: 1
+ max-total: 10
+ option: 'project'
+
+ builders:
+ - 'apex-iso-verify'
+
- job-template:
name: 'apex-deploy-virtual-{scenario}-{stream}'
@@ -616,7 +673,7 @@
# 4.not used for release criteria or compliance,
# only to debug the dovetail tool bugs with apex
#- trigger-builds:
- # - project: 'dovetail-apex-{slave}-debug-{stream}'
+ # - project: 'dovetail-apex-{slave}-proposed_tests-{stream}'
# current-parameters: false
# predefined-parameters:
# DEPLOY_SCENARIO=os-nosdn-nofeature-ha
@@ -1013,8 +1070,9 @@
same-node: true
- shell:
!include-raw-escape: ./apex-snapshot-create.sh
- - shell:
- !include-raw-escape: ./apex-upload-artifact.sh
+ - inject:
+ properties-content: ARTIFACT_TYPE=snapshot
+ - 'apex-upload-artifact'
# FDIO promote
- job-template:
@@ -1062,8 +1120,9 @@
same-node: true
- shell:
!include-raw-escape: ./apex-snapshot-create.sh
- - shell:
- !include-raw-escape: ./apex-upload-artifact.sh
+ - inject:
+ properties-content: ARTIFACT_TYPE=snapshot
+ - 'apex-upload-artifact'
- job-template:
name: 'apex-gs-clean-{stream}'
@@ -1147,6 +1206,13 @@
!include-raw: ./apex-workspace-cleanup.sh
- builder:
+ name: 'apex-iso-verify'
+ builders:
+ - shell:
+ !include-raw: ./apex-iso-verify.sh
+
+
+- builder:
name: 'apex-upload-artifact'
builders:
- shell: