def _get_diff(environment, deploy_revs): global DEPLOY_DIFF if DEPLOY_DIFF is not None: return DEPLOY_DIFF tag_commits = environment.fab_settings_config.tag_deploy_commits repo = github_repo('dimagi/commcare-hq', require_write_permissions=tag_commits) deployed_version = _get_deployed_version(environment) latest_version = repo.get_commit( deploy_revs['commcare']).sha if repo else None new_version_details = { 'Branch deployed': ', '.join([f'{repo}: {ref}' for repo, ref in deploy_revs.items()]) } if environment.fab_settings_config.custom_deploy_details: new_version_details.update( environment.fab_settings_config.custom_deploy_details) DEPLOY_DIFF = DeployDiff( repo, deployed_version, latest_version, new_version_details=new_version_details, generate_diff=environment.fab_settings_config.generate_deploy_diffs) return DEPLOY_DIFF
def _get_diff(environment, deploy_revs): global DEPLOY_DIFF if DEPLOY_DIFF is not None: return DEPLOY_DIFF tag_commits = environment.fab_settings_config.tag_deploy_commits repo = github_repo('dimagi/commcare-hq', require_write_permissions=tag_commits) deployed_version = _get_deployed_version(environment) latest_version = repo.get_commit(deploy_revs['commcare']).sha if repo else None DEPLOY_DIFF = DeployDiff(repo, deployed_version, latest_version, new_version_details=deploy_revs) return DEPLOY_DIFF
def get_deploy_diff(environment, repo): print(color_summary(">> Compiling deploy summary")) current_commit = get_current_formplayer_version(environment) latest_version = get_latest_formplayer_version(environment.name) new_version_details = {} if latest_version: new_version_details["Release Name"] = environment.new_release_name() new_version_details["Commit"] = latest_version.commit new_version_details["Commit message"] = latest_version.message new_version_details["Commit date"] = f"{latest_version.commit_time_ago} ({latest_version.time})" new_version_details["Build time"] = f"{latest_version.build_time_ago} ({latest_version.build_time})" diff = DeployDiff( repo, current_commit, latest_version.commit, new_version_details=new_version_details, generate_diff=environment.fab_settings_config.generate_deploy_diffs ) return diff