Commit 7f03f83f authored by Christos Stavrakakis's avatar Christos Stavrakakis

ci: Helper script to run ci commands

Make 'snf-ci' python script to run CI commands.
parent ca40ed29
#!/usr/bin/env python
"""
Build Synnefo packages for debian
"""
from utils import SynnefoCI
def autopkg_debian():
"""Build synnefo packages for debian"""
synnefo_ci = SynnefoCI()
synnefo_ci.build_synnefo()
if __name__ == "__main__":
autopkg_debian()
#!/usr/bin/env python
"""
Deploy Synnefo using snf-deploy
"""
from utils import SynnefoCI
def deploy_synnefo():
"""Deploy Synnefo using snf-deploy"""
synnefo_ci = SynnefoCI()
synnefo_ci.deploy_synnefo()
if __name__ == "__main__":
deploy_synnefo()
#!/usr/bin/env python
"""
Run burnin functional test suite
"""
from utils import SynnefoCI
def run_burnin():
"""Run burnin functional test suite"""
synnefo_ci = SynnefoCI()
synnefo_ci.run_burnin()
if __name__ == "__main__":
run_burnin()
#!/usr/bin/env python
"""
Setup slave server
"""
from utils import SynnefoCI
def setup_slave():
"""Setup slave server"""
synnefo_ci = SynnefoCI(cleanup_config=True)
# Build slave server
synnefo_ci.create_server()
# Copy synnefo repo to server
synnefo_ci.clone_repo()
if __name__ == "__main__":
setup_slave()
#!/usr/bin/env python
"""
"""
from utils import SynnefoCI
from optparse import OptionParser
CREATE_SERVER_CMD = "create"
BUILD_SYNNEFO_CMD = "build"
DEPLOY_SYNNEFO_CMD = "deploy"
TEST_SYNNEFO_CMD = "test"
RUN_BURNIN_CMD = "burnin"
ALL_CMDS = "all"
AVAILABLE_COMMANDS = [
CREATE_SERVER_CMD,
BUILD_SYNNEFO_CMD,
DEPLOY_SYNNEFO_CMD,
TEST_SYNNEFO_CMD,
RUN_BURNIN_CMD,
]
CLEAN_CONFIG_CMDS = [CREATE_SERVER_CMD, ALL_CMDS]
USAGE = """usage: %%prog [options] command
command:
* %s Create the slave server
* %s: Create in Synnefo packages in created server
* %s: Deploy Synnefo in created server
* %s: Run Synnefo unittests
* %s: Run snf-burnin in the deployed Synnefo
* %s: Run all the available commands
""" % tuple([CREATE_SERVER_CMD,
BUILD_SYNNEFO_CMD,
DEPLOY_SYNNEFO_CMD,
TEST_SYNNEFO_CMD,
RUN_BURNIN_CMD,
ALL_CMDS])
def main():
parser = OptionParser(usage=USAGE)
parser.add_option("-c", "--cloud", dest="kamaki_cloud", default=None,
help="Use specified cloud, as is in .kamakirc"),
parser.add_option("-f", "--flavor", dest="flavor", default=None,
help="Name of flavor to use for the server.")
parser.add_option("-i", "--image", dest="image", default=None,
help="UUID of image to use for the server.")
(options, args) = parser.parse_args()
if len(args) != 1:
msg = "ERROR: Command takes exactly one argument"
parser.print_help()
print
print msg
return
command = args[0]
if command == ALL_CMDS:
for cmd in AVAILABLE_COMMANDS:
setattr(options, cmd, True)
elif command not in AVAILABLE_COMMANDS:
msg = "ERROR: Unknown command: %s" % command
parser.print_help()
print
print msg
return
else:
setattr(options, command, True)
cleanup_config = command in CLEAN_CONFIG_CMDS
synnefo_ci = SynnefoCI(cleanup_config=cleanup_config,
cloud=options.kamaki_cloud)
if getattr(options, CREATE_SERVER_CMD, False):
synnefo_ci.create_server(flavor_id=options.flavor,
image_id=options.image)
synnefo_ci.clone_repo()
if getattr(options, BUILD_SYNNEFO_CMD, False):
synnefo_ci.build_synnefo()
if getattr(options, DEPLOY_SYNNEFO_CMD, False):
synnefo_ci.deploy_synnefo()
if getattr(options, TEST_SYNNEFO_CMD, False):
synnefo_ci.unit_test()
if getattr(options, RUN_BURNIN_CMD, False):
synnefo_ci.run_burnin()
if __name__ == "__main__":
main()
#!/usr/bin/env python
"""
Run Synnefo unit test suite
"""
from utils import SynnefoCI
def unit_test():
"""Run Synnefo unit test suite"""
synnefo_ci = SynnefoCI()
synnefo_ci.unit_test()
if __name__ == "__main__":
unit_test()
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