示例#1
0
        def _on_success_deploy():
            if state.get('success') == True and callable(on_success):
                try:
                    on_success()

                    set_state('on_success', True)
                except Exception as error:
                    set_state('on_success', error)
示例#2
0
def print_deploy_stats(task_name, start_time):
    if fetch('verbose') == True:
        print_verbose()

    error_states = get_error_states()

    if error_states:
        echo_task('Deploy errors', error=True)

        for error_state in error_states:
            echo_comment(('\n[ERROR]\n%s' % state.get(error_state)),
                         error=True)

    if state.get('success'):
        print(yellow('\n-----> Release number: %s' % fetch('release_number')))

    print_stats_args = [task_name, start_time]
    if state.get('success') != True: print_stats_args.append(True)
    print_task_stats(*print_stats_args)
示例#3
0
        def _post_deploy():
            if state.get('deploy') == True:
                try:
                    move_build_to_releases()
                    link_release_to_current()

                    set_state('post_deploy', True)
                except Exception as error:
                    set_state('post_deploy', error)

                    raise error  # escalate exception to 'deploy_wrapper' function
示例#4
0
        def _deploy(*args):
            if state.get('pre_deploy') == True:
                try:
                    with cd(fetch('build_to')):
                        wrapped_function(*args)

                    set_state('deploy', True)
                except Exception as error:
                    set_state('deploy', error)

                    raise error  # escalate exception to 'deploy_wrapper' function
示例#5
0
        def _finalize_deploy():
            if not state.get('success') == True:
                echo_task('Cleaning up failed deploy')

            try:
                cleanup_releases()
                remove_build_path()
                force_unlock()

                set_state('finalize', True)
            except Exception as error:
                set_state('finalize', error)
示例#6
0
def print_verbose():
    print(yellow('\n=====> Verbose subtasks stats\n'))

    subtask_states = [
        'pre_deploy', 'deploy', 'post_deploy', 'finalize', 'on_success'
    ]

    for subtask_state_name in subtask_states:
        state_value = state.get(subtask_state_name)

        if state_value == None:
            print_value = white('not invoked')
        elif state_value == True:
            print_value = green('success')
        else:
            print_value = red('failed')

        print('%s - %s' % (yellow('* %s' % subtask_state_name), print_value))
示例#7
0
    def find_error_states(x):
        if x == 'success': return False

        return state.get(x) not in [True, None]