示例#1
0
def test_publish_stack():
    stack_name = settings['publish']['stack_name']
    try:
        stack.publish_stack(settings)
        out = stack.get_outputs(stack_name, wait=True)
        url = out['WebsiteURL']
        response = urllib2.urlopen(url)
        html = response.read()
        assert html == 'Hello, World!'
    finally:
        stack.delete_stack(stack_name, wait=True)
示例#2
0
文件: builder.py 项目: gitbot/builder
def get_worker_outputs(data):
    result = None
    try:
        region = data.region or 'us-east-1'
        root = Folder(data.root or '~')
        source = root.child_folder('src')
        source.make()
        source = source.child_folder('worker')
        repo = data.worker_repo or 'git://github.com/gitbot/worker.git'
        branch = data.worker_branch or 'master'

        #   1. Pull worker repo
        tree = Tree(source, repo, branch)
        tree.clone(tip_only=True)

        #   2. Call gitbot.stack.publish with 'gitbot.yaml'
        worker_stack_name = stack.publish_stack(
                                    source.child_file('gitbot.yaml'),
                                    wait=True)
        result = stack.get_outputs(worker_stack_name, region)
    except Exception, e:
        print repr(e)
        raise
示例#3
0
HERE = File(__file__).parent

# Create worker stack
config = yaml.load(HERE.parent.child_file('gitbot.yaml').read_all())
publish = yaml.load(HERE.child_file('test.gitbot.yaml').read_all())
config.update(publish)
try:
    stack.publish_stack(config, {}, debug=True)
except:
    pass

#
# Wait for stack to be operational

result = stack.get_outputs(config['publish']['stack_name'], wait=True)

print '\n Stack operational. Sending message.\n'

queue_url = result['QueueURL']
access_key = result['ManagerKey']
secret = result['ManagerSecret']

# Send SQS message

data = dict(
    project='gitbot/test',
    actions_repo='git://github.com/gitbot/test.git',
    repo='gitbot/www',
    branch='master',
    bucket='releases.dev.gitbot.test',