diff --git a/gitlab/update_feedstock.py b/gitlab/update_feedstock.py index 36ef15e706ccd517b2ec6e0073730c3acc240387..2e449c9c12398d852e371629ef13fc6cd1ef37dd 100755 --- a/gitlab/update_feedstock.py +++ b/gitlab/update_feedstock.py @@ -94,13 +94,15 @@ class Gitlab(object): pipeline = subprocess.check_output(cmd) return json.loads(pipeline.decode()) - def create_merge_request(self, project_id, source_branch, target_branch, title, - assignee_id='', description='', target_project_id='', - labels='', milestone_id='', remove_source_branch=''): + def create_merge_request(self, project_id, source_branch, target_branch, + title, assignee_id='', description='', + target_project_id='', labels='', milestone_id='', + remove_source_branch=''): url = "projects/{}/merge_requests?" - url += "&".join(['source_branch={}', 'target_branch={}', 'title={}']) - url += "&".join(['assignee_id={}', 'description={}', 'target_project_id={}', - 'labels={}', 'milestone_id={}', 'remove_source_branch={}']) + url += "&".join(['source_branch={}', 'target_branch={}', 'title={}', + 'assignee_id={}', 'description={}', + 'target_project_id={}', 'labels={}', + 'milestone_id={}', 'remove_source_branch={}']) url = url.format(project_id, source_branch, target_branch, title, assignee_id, description, target_project_id, labels, milestone_id, remove_source_branch) @@ -181,12 +183,15 @@ def main(package, direct_push=False): f.write(doc) run_commands(['git', '--no-pager', 'diff'], - ['git', 'config', 'user.email', os.environ.get('GITLAB_USER_EMAIL')], - ['git', 'config', 'user.name', os.environ.get('GITLAB_USER_ID')], + ['git', 'config', 'user.email', + os.environ.get('GITLAB_USER_EMAIL')], + ['git', 'config', 'user.name', + os.environ.get('GITLAB_USER_ID')], ['git', 'add', '-A']) try: run_commands(['git', 'commit', '-am', - 'Update to version {}'.format(stable_version)]) + '[{}] Update to version {}'.format(package, + stable_version)]) except ValueError: print('Feedstock is already uptodate, skipping.') return @@ -202,13 +207,14 @@ def main(package, direct_push=False): 'https://github.com/conda-forge/' '{}-feedstock/commits/master\n\n'.format(package)) else: - subprocess.call(['git', 'remote', 'set-url', 'origin', - 'https://idiapbbb:{}@gitlab.idiap.ch/bob/bob.conda.git'.format(os.environ.get('IDIAPBBB_PASS'))]) + origin_url = 'https://idiapbbb:{}@gitlab.idiap.ch/bob/bob.conda.git' + origin_url = origin_url.format(os.environ.get('IDIAPBBB_PASS')) + subprocess.call(['git', 'remote', 'set-url', 'origin', origin_url]) run_commands(['git', 'push', '--quiet', '--force', '--set-upstream', 'origin', branch_name]) gitlab = Gitlab(os.environ.get('GITLAB_API_TOKEN')) project_id = gitlab.get_project('bob.conda')['id'] - title = 'Update-to-version-{}'.format(branch_name) + title = 'Update-to-{}'.format(branch_name) gitlab.create_merge_request(project_id, branch_name, 'master', title, remove_source_branch='true') finally: