This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pr = { | |
'title': '{}: {}...{}'.format(repo, | |
commit_info[repo]['live'], | |
commit_info[repo]['latest']), | |
'body': body, | |
'base': 'master', | |
'head': 'henchbot:{}_bump'.format(repo) | |
} | |
res = requests.post('https://api.github.com/repos/jupyterhub/mybinder.org-deploy/pulls', | |
headers={'Authorization': 'token {}'.format(TOKEN)}, json=pr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if repo == 'repo2docker': | |
compare_url = 'https://github.com/jupyter/repo2docker/compare/{}...{}'.format( | |
commit_info['repo2docker']['live'], | |
commit_info['repo2docker']['latest']) | |
body = '\n'.join(['This is a repo2docker version bump. See the link below for a diff of new changes:\n', compare_url + ' \n']) | |
elif repo == 'binderhub': | |
compare_url = 'https://github.com/jupyterhub/binderhub/compare/{}...{}'.format( | |
commit_info['binderhub']['live'], | |
commit_info['binderhub']['latest']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use var fname from editing step | |
subprocess.check_call(['git', 'add', fname]) | |
if repo == 'repo2docker': | |
commit_message = 'repo2docker: https://github.com/jupyter/repo2docker/compare/{}...{}'.format( | |
commit_info['repo2docker']['live'],commit_info['repo2docker']['latest']) | |
elif repo == 'binderhub': | |
commit_message = 'binderhub: https://github.com/jupyterhub/binderhub/compare/{}...{}'.format( | |
commit_info['binderhub']['live'], commit_info['binderhub']['latest']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elif repo == 'binderhub': | |
with open('mybinder/requirements.yaml', 'r') as f: | |
requirements_yaml = f.read() | |
updated_yaml = requirements_yaml.replace( | |
"version: 0.2.0-{}".format(commit_info[upgrade]['live']), | |
"version: 0.2.0-{}".format(commit_info[upgrade]['latest'])) | |
fname = 'mybinder/requirements.yaml' | |
with open(fname, 'w') as f: | |
f.write(updated_yaml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if repo == 'repo2docker': | |
with open('mybinder/values.yaml', 'r') as f: | |
values_yaml = f.read() | |
updated_yaml = values_yaml.replace( | |
"jupyter/repo2docker:{}".format(commit_info[upgrade]['live']), | |
"jupyter/repo2docker:{}".format(commit_info[upgrade]['latest'])) | |
fname = 'mybinder/values.yaml' | |
with open(fname, 'w') as f: | |
f.write(updated_yaml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os.chdir('mybinder.org-deploy') | |
subprocess.check_call(['git', 'checkout', '-b', '{}_bump'.format(repo)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subprocess.check_call(['git', 'clone', 'https://github.com/henchbot/mybinder.org-deploy']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
TOKEN = os.environ.get('HENCHBOT_TOKEN') | |
for repo in ['binderhub', 'repo2docker']: | |
if commit_info[repo]['live'] != commit_info[repo]['latest']: | |
res = requests.post('https://api.github.com/repos/jupyterhub/mybinder.org-deploy/forks', | |
headers={'Authorization': 'token {}'.format(TOKEN)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to commit_info dictionary | |
commit_info['repo2docker']['latest'] = r2d_master | |
print('repo2docker', commit_info['repo2docker']['live'], commit_info['repo2docker']['latest']) | |
commit_info['binderhub']['latest'] = bh_master | |
print('binderhub', commit_info['binderhub']['live'], commit_info['binderhub']['latest']) | |
print(commit_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url_helm_chart = 'https://raw.githubusercontent.com/jupyterhub/helm-chart/gh-pages/index.yaml' | |
helm_chart_yaml = load(requests.get(url_helm_chart).text) | |
# sort by date created | |
updates_sorted = sorted(helm_chart_yaml['entries']['binderhub'], key=lambda k: k['created']) | |
bh_master = updates_sorted[-1]['version'].split('-')[-1] | |
print(bh_master) |
NewerOlder