def main(): app_front_path = 'D:\Source\devs\APP-FrontEnd\HtmlSource_app' vue_path = 'D:\Source\devs\APP-FrontEnd\HtmlSource_app\h5-v2' angular_path = 'D:\Source\devs\APP-FrontEnd\HtmlSource_app\h5' vue_zip_path = 'D:\Source\devs\APP-FrontEnd\HtmlSource_app\h5-v2\dist' angular_zip_path = 'D:\Source\devs\APP-FrontEnd\HtmlSource_app\h5\\build\debug' tmp_path = 'D:\Source\\tmp_files' # 用来暂存所有压缩包的目录 target_dir = '/cygdrive/d/workspace/tmp_files/' vue_deploy_path = os.path.join(tmp_path, 'vue.zip') angular_deploy_path = os.path.join(tmp_path, 'angular.zip') vue_target_path = os.path.join(target_dir, 'vue.zip') angular_target_path = os.path.join(target_dir, 'angular.zip') cmd1 = 'cd /cygdrive/d/workspace/AppWeb/debug && rm -rf v2' cmd2 = 'cd /cygdrive/d/workspace/AppWeb/debug && mkdir v2 && cd /cygdrive/d/workspace/tmp_files/ && unzip -d /cygdrive/d/workspace/AppWeb/debug/v2 vue.zip' cmd3 = 'cd /cygdrive/d/workspace/tmp_files/ && unzip -o angular.zip -d /cygdrive/d/workspace/AppWeb/debug' # git拉取代码,传入app前端仓库路径 git_pull(app_front_path) time.sleep(3) # 前端项目构建 build_vue(vue_path) build_h5(angular_path) # print(info('gulp done?')) # t1 = threading.Thread(target=build_vue, args=(vue_path,)) # t2 = threading.Thread(target=build_h5, args=(angular_path,)) # t1.start() # time.sleep(2) # t2.start() time.sleep(30) # angular构建需等待40s
def main(): portal_back_path = 'D:\Source\devs\Portal-BackEnd' portal_sln_path = 'D:\Source\devs\Portal-BackEnd\dotnet_xrm\ServiceOne-Portal.sln' cmd = 'cd /cygdrive/d/workspace/tmp_files && unzip -o pback.zip -d /cygdrive/d/workspace/PortalWeb/bin' # 拉取代码 git_pull(portal_back_path) time.sleep(3) # 编译解决方案 compile_sln(portal_sln_path) time.sleep(3) # 复制到临时dll目录下 copy_dll('D:\Source\devs\Portal-BackEnd\dotnet_xrm\\bin', 'D:\Source\\tmp_files\portal_dll', portal()) # 将此dll目录打包 zip_dir('pback', 'D:\Source\\tmp_files\portal_dll', 'D:\Source\\tmp_files') # 实例化连接 ssh = SSHConnect() # 连接服务器,将dll压缩包上传到tmpfiles目录下 ssh.connect() ssh.upload('D:\Source\\tmp_files\\pback.zip', '/cygdrive/d/workspace/tmp_files/pback.zip') # 直接解压缩到bin目录下 if not ssh.exec_cmd(cmd): print(info('command execute failed')) else: print(info('command execute success')) # 关闭连接 ssh.disconnect()
def main(): portal_front_path = 'D:\Source\devs\Portal-FrontEnd' portal_vue_path = 'D:\Source\devs\Portal-FrontEnd\h5' tmp_path = 'D:\Source\\tmp_files' cmd1 = 'cd /cygdrive/d/workspace/PortalWeb && rm -rf static && rm -rf index.html' cmd2 = 'cd /cygdrive/d/workspace/tmp_files && unzip -o pfront.zip -d /cygdrive/d/workspace/PortalWeb' # 拉取portal前端代码 git_pull(portal_front_path) time.sleep(3) # 前端项目构建 build_vue(portal_vue_path) time.sleep(3) # 构建完打包到tmpfiles目录下 zip_dir('pfront', 'D:\Source\devs\Portal-FrontEnd\h5\\build', tmp_path) # 实例化连接 ssh = SSHConnect() # 连接服务器后,先将压缩包传输到tmp-files目录下 ssh.connect() ssh.upload('D:\Source\\tmp_files\pfront.zip', '/cygdrive/d/workspace/tmp_files/pfront.zip') # 删除D:\workspace\PortalWeb下的static和index,在直接解压 if not ssh.exec_cmd(cmd1) and ssh.exec_cmd(cmd2): print(info('command execute failed')) else: print(info('command execute success')) ssh.disconnect()
def main(): """CRM前端发布""" portalRelease.git_pull('D:\Source\CRM-FrontEnd') time.sleep(3) build_vue('D:\Source\CRM-FrontEnd\CRM\Supervise\supervise') time.sleep(5) # public的发布 portalRelease.copy_dir( 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Public\dist', 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Public\\bak' ) # 删除之前先备份到bak文件夹 appRelease.del_files( 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Public\dist') time.sleep(3) portalRelease.copy_dir( 'D:\Source\CRM-FrontEnd\CRM\Supervise\supervise\dist', 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Public\dist') # inspection的发布 portalRelease.copy_dir( 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Inspection\static\dist', 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Inspection\static\\bak' ) appRelease.del_files( 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Inspection\static\dist' ) time.sleep(3) portalRelease.copy_dir( 'D:\Source\CRM-FrontEnd\CRM\Supervise\supervise\dist', 'C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\Inspection\static\dist' ) print('Finished!')
def main(): app_back_path = 'D:\Source\devs\APP-BackEnd' app_sln_path = 'D:\Source\devs\APP-BackEnd\DotNetSource\RekTec.Xmobile.sln' cmd = 'cd /cygdrive/d/workspace/tmp_files && unzip -o appback.zip -d /cygdrive/d/workspace/AppWeb/bin' # 拉取代码 git_pull(app_back_path) time.sleep(3) # 编译解决方案 compile_sln(app_sln_path) time.sleep(3) # 将需要发布的dll先复制到临时dll目录 copy_dll('D:\Source\devs\APP-BackEnd\DotNetSource\\bin', 'D:\Source\\tmp_files\mobile_dll', mobile()) # 将此dll目录打包 zip_dir('appback', 'D:\Source\\tmp_files\mobile_dll', 'D:\Source\\tmp_files') # 实例化连接 ssh = SSHConnect() # 连接服务器,将dll压缩包上传到tmpfiles目录下 ssh.connect() ssh.upload('D:\Source\\tmp_files\\appback.zip', '/cygdrive/d/workspace/tmp_files/appback.zip') # 直接解压缩到bin目录下 if not ssh.exec_cmd(cmd): print(info('command execute failed')) else: print(info('command execute success')) # 关闭连接 ssh.disconnect()
def main(): git_pull('D:\Source\CRM-FrontEnd') time.sleep(3) build_vue('D:\Source\CRM-FrontEnd\CRM\Supervise\supervise') time.sleep(3) print(datetime.datetime.now().strftime('[%Y-%m-%d %H:%M:%S]') + '====== please wait...') copy_dir('D:\Source\CRM-FrontEnd\CRM\Supervise\supervise\dist', 'D:\Source\workspace\workspace\CRM-Front') time.sleep(3) git_push()
def main(): git_pull('D:\Source\Portal-FrontEnd') time.sleep(3) build_vue('D:\Source\Portal-FrontEnd\h5') time.sleep(3) print(datetime.datetime.now().strftime('[%Y-%m-%d %H:%M:%S]') + '====== please wait...') copy_dir('D:\Source\Portal-FrontEnd\h5\\build', 'D:\Source\workspace\workspace\PORTAL-Front') time.sleep(3) git_push()
def build_and_zip(): # 拉取代码 git_pull(PATH_INFO['app_front_path']) time.sleep(2) # 前端构建 build_vue(PATH_INFO['vue_path']) build_h5(PATH_INFO['angular_path']) time.sleep(30) # 打包到临时目录 zip_dir('PFrontRelease', PATH_INFO['portal_build_path'], PATH_INFO['tmp_path'])
def complie_and_zip(): # 拉取代码 git_pull(PATH_INFO['app_back_path']) time.sleep(3) # 后端编译 compile_sln(PATH_INFO['sln_path']) time.sleep(3) # 复制到临时dll目录下 print(PATH_INFO['back_dll_path']) copy_dll(PATH_INFO['back_dll_path'],PATH_INFO['ABackRelease_path'],mobile()) time.sleep(2) a = PATH_INFO['ABackRelease_path'] b = PATH_INFO['tmp_path'] # 将此dll目录打包 zip_dir('ABackRelease', PATH_INFO['ABackRelease_path'], PATH_INFO['tmp_path'])
def git(): git_pull('D:\Source\devs\APP-FrontEnd\HtmlSource_app')