By adding a PowerShell plugin, the published package is pushed to a specific application server using its powerful Windows system commands.
System Management-Plug-in management-powershell
Install it, restart Jenkins, and then modify your previous job to add the PowerShell push file script
Add a build type that is added below MSBuild
The above PS code function is to use the account for remote login, will send data to the shared folder, overwriting its previous files, this operation requires us to configure the application server, as follows:
1 Create an Account
2 assign this account to the IIS Web site Directory
Then using our code, you can remotely push the remote this time.
$remoteDirPath ="\\DESKTOP-9KAK340\remote"Write-host'Connect to remote host ...'net use $remoteDirPath"Zzl"/USER:"Lind"Write-host'recursive copy file (forced overwrite mode) ...'$files= Get-childitem-path"C:\Jenkins_Publish"# Get the files in the local directoryforeach($fileinch$files) {Copy-item-path $file. Fullname-destination $remoteDirPath-include"*"-exclude""-recurse-Force } Write-host'Catalog Copy complete! '
Thanks for reading!
Continuous integration The PowerShell plugin in ~jenkins publishes the remote site.