Ho un Octopus Tentacle che esegue uno script di distribuzione. Il tentacolo è in esecuzione come account LocalSystem.Lavoro Powershell con credenziali alternative di Octopus Deploy
All'interno della sceneggiatura, sono in grado di fare praticamente tutto ciò di cui ho bisogno, a parte qualche bit di archivio. L'archivio deve essere eseguito con credenziali di dominio diverse perché si trova su una condivisione di rete.
Il frustrante è che il codice qui sotto funziona a livello locale, ma quando scappare i tentacoli, non riesce con l'errore
----------------------------------------------------[ 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
Ecco il codice
$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
Ecco il ApplicationUtilities
modulo
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
Qual è il trucco magico per far sì che questo si esaurisca il Tentacle come fa localmente?
Inoltre, ho provato a far funzionare il servizio Tentacle come l'utente specificato, ma poi ho un problema di configurazione IIS che getta un'altra chiave nel mix. Questi problemi di autorizzazione effing sono dolorosi. –