25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

110 satır
4.8KB

  1. Option Explicit
  2. Dim DeployMachine:DeployMachine = "KCI-APP01"
  3. Dim remoteDeployPath:remoteDeployPath = "C:\inetpub\tracking"
  4. Dim ScriptDirectory:ScriptDirectory = Replace(WScript.ScriptFullName,WScript.ScriptName,"")
  5. Dim DeployRoot:DeployRoot = "F:\Development\Tracking_Kits\CiCd\" '"C:\inetpub\wwwroot\"
  6. Dim fso:Set fso = WScript.CreateObject("Scripting.Filesystemobject")
  7. Dim WshShell:Set WshShell = WScript.CreateObject("Wscript.Shell")
  8. Dim objShell:Set objShell = CreateObject("Shell.Application")
  9. Dim transferFolder:transferFolder = "\\KCI-SYN-CL01\PC Transfer\"
  10. If fso.FolderExists(DeployRoot & "test") Then
  11. WshShell.Run "cmd.exe /c rmdir /s /q """ & DeployRoot & "test""" , 0,True
  12. End If
  13. CloneRepo
  14. ZipRepo
  15. Cleanup
  16. Deploy
  17. Sub Deploy
  18. Debug.WriteLine ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* cmd.exe /C " & _
  19. "nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking & " & _
  20. "nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop site /site.name:tracking & " & _
  21. "copy /Y """ & transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"" & exit"
  22. WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* cmd.exe /C " & _
  23. "copy /Y """ & transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"" & exit",1,True
  24. 'WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* " &_
  25. '"nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking"
  26. '"nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking & " & _
  27. '"nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop site /site.name:tracking & " & _
  28. '"copy /Y """ & transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"" & exit",1,True
  29. End Sub
  30. Sub Cleanup
  31. WshShell.CurrentDirectory = DeployRoot
  32. WshShell.Run "cmd.exe /c rmdir /s /q """ & DeployRoot & "test\""" , 0,True
  33. WScript.Sleep 2500
  34. WScript.Sleep 2500
  35. fso.DeleteFile DeployRoot & "\zzip.zip"
  36. End Sub
  37. Sub ZipRepo
  38. WScript.Sleep 2500
  39. WScript.Sleep 2500
  40. fso.OpenTextFile(DeployRoot & "zzip.zip", 2, True).Write "PK" & Chr(5) & Chr(6) _
  41. & String(18, Chr(0))
  42. WScript.Sleep 2500
  43. WScript.Sleep 2500
  44. Dim objZip
  45. Set objZip = objShell.NameSpace(DeployRoot & "zzip.zip")
  46. Dim objFolder:Set objFolder = objShell.NameSpace(DeployRoot & "test\")
  47. objZip.CopyHere objFolder.Items
  48. Do Until objZip.Items.Count = objFolder.Items.Count
  49. WScript.Sleep 200
  50. Loop
  51. fso.CopyFile DeployRoot & "zzip.zip", transferFolder & "zzip.zip", True
  52. Set objFolder = nothing
  53. End Sub
  54. Sub CloneRepo
  55. WshShell.Exec("git init test")
  56. WScript.Sleep 2500
  57. WshShell.CurrentDirectory = DeployRoot & "test"
  58. WshShell.Exec("git remote add -f origin https://dcovington:_3ggUSA6YELP@onefortheroadgit.sytes.net/dcovington/tracking_kits")
  59. WshShell.Exec("git config core.sparseCheckout true")
  60. Dim objFile
  61. Set objFile = fso.CreateTextFile(".git/info/sparse-checkout")
  62. objFile.WriteLine("App/")
  63. objFile.WriteLine("Data/arrow ne.jpg")
  64. objFile.WriteLine("Data/Label_Report.rep")
  65. objFile.WriteLine("Data/png-transparent-arrow-arrow-angle-triangle-black-thumbnail.jpg")
  66. objFile.WriteLine("Data/purple_envelope_sample_Page_1.jpg")
  67. objFile.WriteLine("Data/purple_envelope_sample_Page_2.jpg")
  68. objFile.WriteLine("Data/Proofs.rep")
  69. objFile.WriteLine("dist/")
  70. objFile.WriteLine("MVC/")
  71. objFile.WriteLine("Dependancies/")
  72. objFile.WriteLine("ImportService/")
  73. objFile.WriteLine("index.asp")
  74. 'objFile.WriteLine("web.config")
  75. WshShell.Exec("git pull origin master")
  76. objFile.Close
  77. Do until fso.FileExists(DeployRoot & "test\App\app.config.asp")
  78. WScript.Sleep 250
  79. Loop
  80. Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",1)
  81. Dim readConfigFile:readConfigFile = objFile.ReadAll
  82. objFile.Close
  83. Dim devToFalseSetting:devToFalseSetting = Replace(readConfigFile,"dev = true","dev = false")
  84. Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",2)
  85. objFile.Write(devToFalseSetting)
  86. objFile.Close
  87. End Sub
  88. '"F:\Development\Tracking_Kits\CiCd\test\App\app.config.asp"
  89. 'C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking
  90. 'C:\Windows\System32\inetsrv\appcmd.exe stop site /site.name:tracking
  91. 'C:\Windows\System32\inetsrv\appcmd.exe start apppool /apppool.name:tracking
  92. 'C:\Windows\System32\inetsrv\appcmd.exe start site /site.name:tracking
  93. 'nircmd.exe elevatecmd runassystem

Powered by TurnKey Linux.