mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add initial jenkins python script for jenkins tests
This commit is contained in:
parent
82e6ccf9cd
commit
d50d438545
1 changed files with 31 additions and 0 deletions
31
tests/jenkins.py
Normal file
31
tests/jenkins.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
'''
|
||||
This script is used to test salt from a jenkins server, specifically
|
||||
jenkins.satstack.com.
|
||||
|
||||
This script is intended to be shell centric!!
|
||||
'''
|
||||
|
||||
import subprocess
|
||||
import hashlib
|
||||
import random
|
||||
import optparse
|
||||
|
||||
|
||||
def run(platform, provider):
|
||||
'''
|
||||
RUN!
|
||||
'''
|
||||
htag = hashlib.md5(str(random.randint(1, 100000000))).hexdigest()[:6]
|
||||
vm_name = '{0}{1}'.format(platform, htag)
|
||||
subprocess.call(
|
||||
'salt-cloud -p {0}_{1} {2}'.format(provider, platform, vm_name),
|
||||
shell=True)
|
||||
# Run tests here
|
||||
subprocess.call(
|
||||
'salt {0} state.sls testrun'.format(vm_name),
|
||||
shell=True)
|
||||
# Clean up the vm
|
||||
subprocess.call(
|
||||
'salt-cloud -d {0} -y'.format(vm_name),
|
||||
shell=True)
|
Loading…
Add table
Reference in a new issue