Commit 3b4028f4 authored by o9000's avatar o9000

Update periodic testing script

parent acc3ee92
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
set -e
set -x
#!/usr/bin/env python2
# TODO: setup bsd workers
# TODO: prin ssh public key to be added on gitlab
from fabric.api import *
from fabric.contrib.files import *
from fabtools import require
import fabtools
import os
env.use_ssh_config = True
env.user = 'root'
env.sudo_prefix += '-H '
env.roledefs = {
'runner': ['tint2-runner'],
'freebsd': ['tint2-freebsd'],
'openbsd': ['tint2-openbsd'],
def str2hex(s):
return ''.join('{:02x}'.format(ord(c)) for c in s)
def generate_random_password():
return str2hex(os.urandom(32))
def read_file(path):
with open(path) as f:
@roles('runner', 'freebsd', 'openbsd')
def create_users():
require.user('root', password=generate_random_password())
require.user('runner', password=generate_random_password())
sudo('cd; mkdir -p .ssh; chmod 700 .ssh', user='runner')
if not exists('/home/runner/.ssh/id_rsa'):
sudo('cd; ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ""', user='runner')
def install_deps():
# Repo deps
# Build deps
# Tester deps
def pull_code():
if not exists('/home/runner/tint2'):
sudo('cd; git clone', user='runner')
if not exists('/home/runner/'):
sudo('cd; git clone', user='runner')
def add_cron_jobs():
fabtools.cron.add_task('tests', '* * * * *', 'runner', '/home/runner/tint2/test/')
fabtools.cron.add_task('packaging_check', '10 */2 * * *', 'runner', '/home/runner/tint2/packaging/')
def full_runner():
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
set -e
set -x
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment