def webhook_handler(payload, signature): """Respond to Travis webhook.""" travis = Travis() github = GitHub() # The payload comes in the request, but we need to make sure it is # really signed by Travis CI. If not, respond to this request with # an error. verified_payload = travis.get_verified_payload(payload, signature) error = verified_payload.get('error') if error: return error.get('message'), error.get('code') issue_number = int(verified_payload.get('pull_request_number')) logs = travis.get_logs(verified_payload) comments = parse_logs(logs) # Create a separate comment for every job for title, comment in comments.iteritems(): try: github.post_comment(issue_number, comment, title) except requests.RequestException as err: logging.error(err.response.text) return err.response.text, 500 return "OK", 200
def instance(): travis = Travis(base_url="https://test.travis-ci.org") travis.session = mock.Mock() travis.session.send = mock.Mock() travis.session.send.return_value.status_code = requests.codes.ok return travis
def start(data: Data): admin_files = AdminFiles(data) github = GitHub(data) github.clone_repo() admin_files.start_deploy() if data.use_git_hub(): github.execute() travis = Travis(data) if data.use_travis(): travis.enable_repo() if data.base_64_file(): travis.set_envs("GCLOUD_SERVICE_KEY_DEV", get_base_64(data), False) admin_files.update_travis_badge(travis.get_badge_value(), data.project_dir()) github.commit("Update Travis Badge") else: admin_files.update_travis_badge("", data.project_dir()) github.commit("Remove Travis Badge") if data.use_codeclimate(): code_climate = CodeClimate(data) code_climate.enable_repo() if data.use_travis(): travis.set_envs("CC_TEST_REPORTER_ID", code_climate.get_test_reporter_id, False) admin_files.update_code_climate_badge( code_climate.get_test_coverage_badge(), code_climate.get_maintainability_badge())
Ubuntu('19.04', 'arm32v7'), Ubuntu('18.04', 'x86_64'), Ubuntu('18.04', 'arm32v7'), Ubuntu('16.04', 'x86_64'), Ubuntu('16.04', 'arm32v7'), Debian('stretch', 'x86_64'), Debian('stretch', 'arm32v7'), Debian('buster', 'x86_64'), Debian('buster', 'arm32v7'), Fedora('29', 'x86_64'), Fedora('30', 'x86_64'), Fedora('31', 'x86_64'), Windows('x86_64', 'static'), ] travis = Travis(images) def create_images(): for image in images: image.write() print('Dockerfiles generated in images/\n') def filter_images(filters): if not filters: return images def is_filtered_in(image): return any([filter in image.image_name for filter in filters])
#!/usr/bin/env python import os, json, requests, time from github import GitHub from heroku import Heroku from travis import Travis github = GitHub(os.getenv('GITHUB_KEY')) heroku = Heroku(os.getenv('HEROKU_KEY')) travis = Travis(os.getenv('TRAVIS_ENDPOINT', 'https://api.travis-ci.org/'), os.getenv('TRAVIS_KEY')) APPS = json.loads(os.getenv('APPS')) E2E_OWNER = os.getenv('E2E_OWNER') E2E_REPO = os.getenv('E2E_REPO') SLACK_URL = os.getenv('SLACK_URL') SLACK_CHANNEL = os.getenv('SLACK_CHANNEL') def commit_url(repo_path, commit_id): return "https://github.com/{}/commit/{}".format(repo_path, commit_id[0:7]) def heroku_url(app_name): return "https://{}.herokuapp.com/".format(app_name) def notify(message, emoji = ":monkey_face:"): print message # for heroku log if SLACK_URL and SLACK_CHANNEL:
"https://reviews.bitcoinabc.org/api/") slack_token = os.getenv('SLACK_BOT_TOKEN', None) tc = TeamCity('https://build.bitcoinabc.org', tc_user, tc_pass) phab = PhabWrapper(host=phabricatorUrl, token=conduit_token) phab.update_interfaces() slack_channels = { # #dev 'dev': 'C62NSDC6N', # #abcbot-testing 'test': 'CQMSVCY66', # #infra-support 'infra': 'G016CFAV8KS', } slackbot = SlackBot(slack.WebClient, slack_token, slack_channels) travis = Travis() def main(args): parser = argparse.ArgumentParser( description='Continuous integration build bot service.') parser.add_argument('-p', '--port', help='port for server to start', type=int, default=8080) parser.add_argument('-l', '--log-file', help='log file to dump requests payload', type=str, default='log.log')
def __init__(self): self.github = GitHub() self.travis = Travis()