diff --git a/gluster_coreutils.yml b/gluster_coreutils.yml new file mode 100644 index 0000000..f1ad661 --- /dev/null +++ b/gluster_coreutils.yml @@ -0,0 +1,47 @@ +- job: + name: gluster_coreutils + node: gluster + description: Run the functional test from glusterfs-coreutils against the latest + build of the glusterfs packages. A new run is executed automatically against + the nightly builds of the master branch. + project-type: freestyle + + + scm: + - git: + url: https://github.com/gluster/centosci.git + branches: + - origin/master + + + builders: + - shell: !include-raw scripts/common/jenkins-job.py + + + properties: + - github: + url: https://github.com/gluster/glusterfs-coreutils/ + + + parameters: + - string: + default: scripts/common/run-test.sh + description: Test script to execute on the reserved machine. + name: TEST_SCRIPT + + + triggers: + - pollurl: + cron: H */2 * * * + polling-node: gluster + urls: + - url: http://artifacts.ci.centos.org/gluster/nightly/master/7/x86_64/repodata/repomd.xml + check-date: true + timeout: 300 + check-status: 200 + + + wrappers: + - timestamps + - ansicolor: + colormap: xterm diff --git a/scripts/common/jenkins-job.py b/scripts/common/jenkins-job.py new file mode 100644 index 0000000..49f9ec7 --- /dev/null +++ b/scripts/common/jenkins-job.py @@ -0,0 +1,48 @@ +# +# from: https://raw.githubusercontent.com/kbsingh/centos-ci-scripts/master/build_python_script.py +# +# This script uses the Duffy node management api to get fresh machines to run +# your CI tests on. Once allocated you will be able to ssh into that machine +# as the root user and setup the environ +# +# XXX: You need to add your own api key below, and also set the right cmd= line +# needed to run the tests +# +# Please note, this is a basic script, there is no error handling and there are +# no real tests for any exceptions. Patches welcome! + +import json, urllib, subprocess, sys, os + +print "" +print "This test is part of the Gluster Jenkins jobs that can be found on GitHub:" +print " - https://github.com/gluster/glusterfs-patch-acceptance-tests/tree/master/centos-ci" +print "" + +url_base="http://admin.ci.centos.org:8080" +ver="7" +arch="x86_64" +count=1 +script_url=os.getenv("TEST_SCRIPT") + +# read the API key for Duffy from the ~/duffy.key file +fo=open("/home/gluster/duffy.key") +api=fo.read().strip() +fo.close() + +# build the URL to request the system(s) +get_nodes_url="%s/Node/get?key=%s&ver=%s&arch=%s&count=%s" % (url_base,api,ver,arch,count) + +# request the system +dat=urllib.urlopen(get_nodes_url).read() +b=json.loads(dat) +cmd="""ssh -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@%s ' + yum -y install curl && + curl %s | bash - +'""" % (b['hosts'][0], script_url) +rtn_code=subprocess.call(cmd, shell=True) + +# return the system(s) to duffy +done_nodes_url="%s/Node/done?key=%s&ssid=%s" % (url_base, api, b['ssid']) +das=urllib.urlopen(done_nodes_url).read() + +sys.exit(rtn_code) diff --git a/scripts/common/run-test.sh b/scripts/common/run-test.sh new file mode 100755 index 0000000..a8cd50a --- /dev/null +++ b/scripts/common/run-test.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# error out on any failure +set -e + +# install EPEL (for "bats") and standard Gluster repo +yum -y install epel-release centos-release-gluster yum-utils + +# enable the repository with nightly builds (master branch only, for now) +yum-config-manager --add-repo=http://artifacts.ci.centos.org/gluster/nightly/master.repo + +# Install and start gluster daemon +yum -y install glusterfs-server +systemctl start glusterd + +# Install dependencies for glusterfs-coreutils and the tests +yum -y install git help2man python-gluster readline-devel glusterfs-api-devel libtool bats + +# Git clone the source code +git clone https://github.com/gluster/glusterfs-coreutils.git + +# Install glusterfs-coreutils from source +cd glusterfs-coreutils/ +./autogen.sh +./configure +make -j && make install + +# Run test script +./run-tests.sh