Ich habe ein Octopus Tentacle, auf dem ein Bereitstellungsskript ausgeführt wird. Der Tentacle wird als LocalSystem-Account ausgeführt.Powershell-Auftrag mit alternativen Anmeldeinformationen von Octopus Deploy
Innerhalb des Skripts kann ich so ziemlich alles machen, was ich brauche, abgesehen von etwas Archivbit. Das Archiv muss unter verschiedenen Domänenanmeldeinformationen ausgeführt werden, da es sich auf einer Netzwerkfreigabe befindet.
Die frustrierend ist, dass der folgende Code lokal funktioniert, aber wenn die Tentakel ablaufen, schlägt es mit dem Fehler
----------------------------------------------------[ Backup Nupkg ]---------------------------------------------------- Storing a backup version of GeoSphere.1.2.1.1722.nupkg for the Development environment
Error 09:24:32 [localhost] There is an error launching the
background process. Error Error 09:24:32 reported: Access is
denied. Error 09:24:32 At
C:\Octopus\Deployments\Development\GeoSphere\1.2.1.1722\deploy.ps1:121
Error 09:24:32 char:1 Error 09:24:32
+ Receive-Job $job Error 09:24:32
+ ~~~~~~~~~~~~~~~~ Error 09:24:32
+ CategoryInfo : OpenError: (localhost:String) [], PSRemotingTran Error 09:24:32 sportException Error 09:24:32
+ FullyQualifiedErrorId : -2147467259,PSSessionStateBroken Info 09:24:32 HasMoreData : False StatusMessage : Location :
localhost Command : Import-Module $args[3]
Backup-Nupkg $args[0] $args[1] $args[2]
JobStateInfo : Failed Finished : System.Threading.ManualResetEvent InstanceId :
0c031592-4c2a-4f8b-b014-a5ba79be09f7 Id : 1 Name :
Job1 ChildJobs : {Job2} PSBeginTime : 13/11/2014 9:24:30 AM
PSEndTime : 13/11/2014 9:24:31 AM PSJobTypeName : BackgroundJob
Output : {} Error : {} Progress : {} Verbose
: {} Debug : {} Warning : {} State : Failed
Fatal 09:24:32 PowerShell script returned a non-zero exit code: 1
Tentacle version 2.5.11.614
Hier den Code
$pwd = convertto-securestring "[PASSWORD]" -asplaintext -force
$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist "[DOMAIN\USER]",$pwd
$packageName = "GeoSphere.$Version.nupkg"
$backupPath = $($es.backupPath)
$artifactsPath = $($es.artifactsPath)
$job = Start-Job -ScriptBlock {
Import-Module $args[3]
Backup-Nupkg $args[0] $args[1] $args[2]
} -ArgumentList @($packageName,$backupPath,$artifactsPath,"$currentDir\modules\ApplicationUtilities") -Credential $cred
Wait-Job $Job
Receive-Job $job
Hier ist das ApplicationUtilities
Modul
function Backup-Nupkg{
param(
[parameter(Mandatory=$true,position=0)] [string] $packageName,
[parameter(Mandatory=$true,position=1)] [string] $backupPath,
[parameter(Mandatory=$true,position=2)] [string] $artifactsPath
)
if(!(Test-Path $($backupPath))) {
md $($backupPath)
} else {
Remove-Item "$($backupPath)\*" -recurse -Force
}
Copy-Item $artifactsPath\$packageName $backupPath
}
Export-ModuleMember Backup-Nupkg
Was ist der Zaubertrick, um davon zu bekommen, davon zu laufen das Tentakel wie es lokal tut?
Ich habe auch versucht, den Tentacle-Dienst als der angegebene Benutzer auszuführen, aber dann bekomme ich ein IIS-Konfigurationsproblem, das einen anderen Schraubenschlüssel in den Mix wirft. Diese Effing-Auth-Probleme sind schmerzhaft. –