def relink(publish_git_tag, env_string): service = DeployByEnvService(env_string) remote_root_path = service.get('REMOTE_PROJECT_ROOT_PATH') project_name = service.get('PROJECT_NAME') remote_deployment_root_path = service.get('REMOTE_PROJECT_DEPLOYMENT_ROOT_PATH') remote_deployment_path = os.path.join(remote_deployment_root_path, project_name) remote_deployment_path = os.path.join(remote_deployment_path, '%s_%s' % (project_name, publish_git_tag)) remote_deployment_path = remote_deployment_path.replace('\\', '/') with cd(remote_root_path): run('rm -rf %s' % project_name) run('ln -s %s %s' % (remote_deployment_path, project_name))
def deploy(publish_git_tag, env_string): """ Deploy package to remote :return: """ service = DeployByEnvService(env_string) tar_file_name, tar_file_path = service.get_package(build_version=publish_git_tag) remote_deployment_root_path = service.get('REMOTE_PROJECT_DEPLOYMENT_ROOT_PATH') project_name = service.get('PROJECT_NAME') remote_deployment_path = os.path.join(remote_deployment_root_path, project_name) remote_deployment_path = remote_deployment_path.replace('\\', '/') with cd(remote_deployment_path): put(tar_file_path, remote_deployment_path) run('tar zvxf ./%s' % tar_file_name)
def package_v2(uri, reversion, env_string): service = DeployByEnvService(env_string) # 清空OUTPUT service.clean() # 初始化 service.init() svn_meta = _get_svn_info(uri, reversion, env_string) publish_tag = uri.replace('/', '_') publish_tag = '%s_%s' % (publish_tag, reversion) # 打包 service.build_package(publish_tag, svn_meta) return publish_tag
def package(publish_git_tag, env_string): service = DeployByEnvService(env_string) # 清空OUTPUT service.clean() # 初始化 service.init() git_tag_meta = _switch_git_tag(publish_git_tag) # 打包 tar_file_path, file_name, tar_file_name = service.build_package(publish_git_tag, git_tag_meta)