You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
10 mesi fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. '"echo ""stopping app pool"" & " & _
  24. 'WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* ""nircmd.exe"" elevatecmd runassystem ""C:\Windows\System32\inetsrv\appcmd.exe"" stop apppool /apppool.name:tracking
  25. '"nircmd.exe elevatecmd runassystem ""C:\Windows\System32\inetsrv\appcmd.exe"" stop apppool /apppool.name:tracking & " & _
  26. '"echo ""stopping site"" & " & _
  27. '"nircmd.exe elevatecmd runassystem ""C:\Windows\System32\inetsrv\appcmd.exe"" stop site /site.name:tracking & " & _
  28. '"echo ""removing files"" & " & _
  29. '"nircmd.exe elevatecmd runassystem ""powershell"" Get-ChildItem -Path 'C:\inetpub\tracking\' -File -Recurse -Force | Remove-Item -WhatIf" & _
  30. WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* cmd.exe /C " & _
  31. "copy /Y """ & transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & _
  32. " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"" & exit" _
  33. ,1,True
  34. 'WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* " &_
  35. '"nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking"
  36. '"nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking & " & _
  37. '"nircmd.exe elevatecmd runassystem C:\Windows\System32\inetsrv\appcmd.exe stop site /site.name:tracking & " & _
  38. '"copy /Y """ & transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"" & exit",1,True
  39. End Sub
  40. Sub Cleanup
  41. WshShell.CurrentDirectory = DeployRoot
  42. WshShell.Run "cmd.exe /c rmdir /s /q """ & DeployRoot & "test\""" , 0,True
  43. WScript.Sleep 2500
  44. WScript.Sleep 2500
  45. fso.DeleteFile DeployRoot & "\zzip.zip"
  46. End Sub
  47. Sub ZipRepo
  48. WScript.Sleep 2500
  49. WScript.Sleep 2500
  50. fso.OpenTextFile(DeployRoot & "zzip.zip", 2, True).Write "PK" & Chr(5) & Chr(6) _
  51. & String(18, Chr(0))
  52. WScript.Sleep 2500
  53. WScript.Sleep 2500
  54. Dim objZip
  55. Set objZip = objShell.NameSpace(DeployRoot & "zzip.zip")
  56. Dim objFolder:Set objFolder = objShell.NameSpace(DeployRoot & "test\")
  57. objZip.CopyHere objFolder.Items
  58. Do Until objZip.Items.Count = objFolder.Items.Count
  59. WScript.Sleep 200
  60. Loop
  61. fso.CopyFile DeployRoot & "zzip.zip", transferFolder & "zzip.zip", True
  62. Set objFolder = nothing
  63. End Sub
  64. Sub CloneRepo
  65. WshShell.Exec("git init test")
  66. WScript.Sleep 2500
  67. WshShell.CurrentDirectory = DeployRoot & "test"
  68. WshShell.Exec("git remote add -f origin https://dcovington:_3ggUSA6YELP@onefortheroadgit.sytes.net/dcovington/tracking_kits")
  69. WshShell.Exec("git config core.sparseCheckout true")
  70. Dim objFile
  71. Set objFile = fso.CreateTextFile(".git/info/sparse-checkout")
  72. objFile.WriteLine("App/")
  73. objFile.WriteLine("Data/arrow ne.jpg")
  74. objFile.WriteLine("Data/Label_Report.rep")
  75. objFile.WriteLine("Data/png-transparent-arrow-arrow-angle-triangle-black-thumbnail.jpg")
  76. objFile.WriteLine("Data/purple_envelope_sample_Page_1.jpg")
  77. objFile.WriteLine("Data/purple_envelope_sample_Page_2.jpg")
  78. objFile.WriteLine("Data/Proofs.rep")
  79. objFile.WriteLine("dist/")
  80. objFile.WriteLine("MVC/")
  81. objFile.WriteLine("Dependancies/")
  82. objFile.WriteLine("ImportService/")
  83. objFile.WriteLine("index.asp")
  84. 'objFile.WriteLine("web.config")
  85. WshShell.Exec("git pull origin master")
  86. objFile.Close
  87. Do until fso.FileExists(DeployRoot & "test\App\app.config.asp")
  88. WScript.Sleep 250
  89. Loop
  90. Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",1)
  91. Dim readConfigFile:readConfigFile = objFile.ReadAll
  92. objFile.Close
  93. Dim devToFalseSetting:devToFalseSetting = Replace(readConfigFile,"dev = true","dev = false")
  94. Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",2)
  95. objFile.Write(devToFalseSetting)
  96. objFile.Close
  97. End Sub
  98. '"F:\Development\Tracking_Kits\CiCd\test\App\app.config.asp"
  99. 'C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:tracking
  100. 'C:\Windows\System32\inetsrv\appcmd.exe stop site /site.name:tracking
  101. 'C:\Windows\System32\inetsrv\appcmd.exe start apppool /apppool.name:tracking
  102. 'C:\Windows\System32\inetsrv\appcmd.exe start site /site.name:tracking
  103. 'nircmd.exe elevatecmd runassystem

Powered by TurnKey Linux.