Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JJB job for running the functional test from glusterfs-coreutils #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions gluster_coreutils.yml
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions scripts/common/jenkins-job.py
Original file line number Diff line number Diff line change
@@ -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)
29 changes: 29 additions & 0 deletions scripts/common/run-test.sh
Original file line number Diff line number Diff line change
@@ -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