def postback_atlas(check_changed_status=False): """ Send information about a Jenkins job (and resulting data) back to Atlas. check_changed_status: bool. If we want to only return data if the status of the build has changed from the previous run. This should only be called from within a Jenkins Post-Build Action. """ print "DEBUG: atlas_postback.postback_atlas" # Get job_name and build_number. job_name, build_number = postback.get_job_and_id() # Get build info: job_name, build_number, build_status, build_parameters. response = postback.get_build_info(job_name, build_number, check_changed_status) # If there is data we want to send back. if response: # Get build data from build actions (in jenkins workspace). response.update({'build_data': postback.get_build_data()}) # Send response to Atlas. postback.postback(response) else: print('Build status has not changed. No postback performed.')
def post_update_pantheon(): """Determine if cron run of pantheon_update was successful. """ response = {'update_pantheon': dict()} log_path = '/var/log/pantheon/update_pantheon.log' if os.path.isfile(log_path): with open(log_path, 'r') as log: if 'UPDATE COMPLETED SUCCESSFULLY' in log: response['update_pantheon']['status'] = 'SUCCESS' response['update_pantheon']['msg'] = '' else: response['update_pantheon']['status'] = 'FAILURE' response['update_pantheon'][ 'msg'] = 'Pantheon update did not complete.' else: response['update_pantheon']['status'] = 'FAILURE' response['update_pantheon'][ 'msg'] = 'No Pantheon update log was found.' print 'No update log found.' postback.postback(response)
def post_update_pantheon(): """Determine if cron run of pantheon_update was successful. """ response = {'update_pantheon': dict()} log_path = '/var/log/pantheon/update_pantheon.log' if os.path.isfile(log_path): with open(log_path, 'r') as log: if 'UPDATE COMPLETED SUCCESSFULLY' in log: response['update_pantheon']['status'] = 'SUCCESS' response['update_pantheon']['msg'] = '' else: response['update_pantheon']['status'] = 'FAILURE' response['update_pantheon']['msg'] = 'Pantheon update did not complete.' else: response['update_pantheon']['status'] = 'FAILURE' response['update_pantheon']['msg'] = 'No Pantheon update log was found.' print 'No update log found.' postback.postback(response)