Мне нужно выполнить следующий скрипт:
Param(
[string]$HostName,
[string]$UserName,
[string]$Password,
[string]$SshHostKeyFingerprint,
[string]$RemoteFTPFolder,
[string]$GitUserEmail,
[string]$GitUserName,
[string]$PersonalAccessToken,
[string]$VSTSProjectName
)
try
{
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = $HostName
UserName = $UserName
Password = $Password
SshHostKeyFingerprint = $SshHostKeyFingerprint
}
$session = New-Object WinSCP.Session
try
{
# Connect
$session.Open($sessionOptions)
# Download files
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferResult =
$session.GetFiles($RemoteFTPFolder+"/*", "D:\a\1\s\", $False, $transferOptions)
# Throw on any error
$transferResult.Check()
# Print results
foreach ($transfer in $transferResult.Transfers)
{
Write-Host "Download of $($transfer.FileName) succeeded"
}
Set-Location -Path "D:\a\1\s\"
git config --global user.email $GitUserEmail
git config --global user.name $GitUserName
git checkout master
git pull --rebase origin master
git add .
git commit -m "Changes done"
git push https://Personal%20Access%20Token:$PersonalAccessToken@mycompany.visualstudio.com/_git/$VSTSProjectName
}
finally
{
# Disconnect, clean up
$session.Dispose()
}
exit 0
}
catch [Exception]
{
Write-Host "Error: $($_.Exception.Message)"
exit 1
}
Я также создал переменные, некоторые из них являются открытым текстом, некоторые похожи на пароли
![enter image description here](https://i.stack.imgur.com/nkdBm.png)
Однако я получаю эту ошибку:
2018-05-29T14:25:41.4804626Z Error: The value supplied is not valid, or the property is read-only. Change the value, and then try again.
2018-05-29T14:25:41.5591148Z ##[error]Process completed with exit code 1.
И даже неясно, где его ошибка