25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.3KB

  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 copy """ & _
  19. transferFolder & "zzip.zip"" " & """" & remoteDeployPath & "\zzip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"""
  20. WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* cmd.exe /C copy """ & _
  21. transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking""",1,True
  22. End Sub
  23. Sub Cleanup
  24. WshShell.CurrentDirectory = DeployRoot
  25. WshShell.Run "cmd.exe /c rmdir /s /q """ & DeployRoot & "test\""" , 0,True
  26. WScript.Sleep 2500
  27. WScript.Sleep 2500
  28. fso.DeleteFile DeployRoot & "\zzip.zip"
  29. End Sub
  30. Sub ZipRepo
  31. WScript.Sleep 2500
  32. WScript.Sleep 2500
  33. fso.OpenTextFile(DeployRoot & "zzip.zip", 2, True).Write "PK" & Chr(5) & Chr(6) _
  34. & String(18, Chr(0))
  35. WScript.Sleep 2500
  36. WScript.Sleep 2500
  37. Dim objZip
  38. Set objZip = objShell.NameSpace(DeployRoot & "zzip.zip")
  39. Dim objFolder:Set objFolder = objShell.NameSpace(DeployRoot & "test\")
  40. objZip.CopyHere objFolder.Items
  41. Do Until objZip.Items.Count = objFolder.Items.Count
  42. WScript.Sleep 200
  43. Loop
  44. fso.CopyFile DeployRoot & "zzip.zip", transferFolder & "zzip.zip", True
  45. Set objFolder = nothing
  46. End Sub
  47. Sub CloneRepo
  48. WshShell.Exec("git init test")
  49. WScript.Sleep 2500
  50. WshShell.CurrentDirectory = DeployRoot & "test"
  51. WshShell.Exec("git remote add -f origin https://dcovington:_3ggUSA6YELP@onefortheroadgit.sytes.net/dcovington/tracking_kits")
  52. WshShell.Exec("git config core.sparseCheckout true")
  53. Dim objFile
  54. Set objFile = fso.CreateTextFile(".git/info/sparse-checkout")
  55. objFile.WriteLine("App/")
  56. objFile.WriteLine("Data/arrow ne.jpg")
  57. objFile.WriteLine("Data/Label_Report.rep")
  58. objFile.WriteLine("Data/png-transparent-arrow-arrow-angle-triangle-black-thumbnail.jpg")
  59. objFile.WriteLine("dist/")
  60. objFile.WriteLine("MVC/")
  61. objFile.WriteLine("Dependancies/")
  62. objFile.WriteLine("index.asp")
  63. objFile.WriteLine("web.config")
  64. WshShell.Exec("git pull origin master")
  65. objFile.Close
  66. WScript.Sleep 10000
  67. Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",1)
  68. Dim readConfigFile:readConfigFile = objFile.ReadAll
  69. objFile.Close
  70. Dim devToFalseSetting:devToFalseSetting = Replace(readConfigFile,"dev = true","dev = false")
  71. Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",2)
  72. objFile.Write(devToFalseSetting)
  73. End Sub
  74. '"F:\Development\Tracking_Kits\CiCd\test\App\app.config.asp"

Powered by TurnKey Linux.