jabbera / my-vsts-tasks

20 stars 18 forks source link

Bug: Errors are not reported when target is Deployment Group #43

Open davislabs opened 5 years ago

davislabs commented 5 years ago

When installing a service with the switch option 'Target is Deployment Group', it is reporting errors in the log but the overall status is reported as successful.

jabbera commented 5 years ago

Can you provide the logs please?

davislabs commented 5 years ago
2018-10-16T20:03:36.3151741Z ##[section]Starting: Service
2018-10-16T20:03:36.3155730Z ==============================================================================
2018-10-16T20:03:36.3155912Z Task         : Install Topshelf Service
2018-10-16T20:03:36.3156103Z Description  : Installs a TopShelf service using the standard command line options for Topshelf 4.0.
2018-10-16T20:03:36.3156266Z Version      : 8.0.0
2018-10-16T20:03:36.3156406Z Author       : Michael Barry
2018-10-16T20:03:36.3156583Z Help         : [More Information](https://github.com/jabbera/my-vsts-tasks)
2018-10-16T20:03:36.3156769Z ==============================================================================
2018-10-16T20:03:37.3276592Z Installing TopShelf service: c:\Services\Sub\Service.exe with instanceName: .
2018-10-16T20:03:37.3562432Z CMD: $env:DT_DISABLEINITIALLOGGING='true'
2018-10-16T20:03:37.3562627Z $env:DT_LOGLEVELCON='NONE'
2018-10-16T20:03:37.3562809Z Stop-Process -name mmc,taskmgr -Force -ErrorAction SilentlyContinue
2018-10-16T20:03:37.3563219Z & "c:\Services\Sub\Service.exe" uninstall  -username "user" -password:******** -servicename "Service" -displayname "Service" -description "Service"
2018-10-16T20:03:37.3563601Z & "c:\Services\Sub\Service.exe" install  -username "user" -password:******** -servicename "Service" -displayname "Service" -description "Service" --manual
2018-10-16T20:03:37.3563802Z 
2018-10-16T20:03:38.3485405Z Configuration Result:
2018-10-16T20:03:38.3485740Z [Success] Name Service
2018-10-16T20:03:38.3485894Z [Success] DisplayName Service
2018-10-16T20:03:38.3486048Z [Success] Description Service
2018-10-16T20:03:38.3486215Z [Success] ServiceName Service
2018-10-16T20:03:38.3496556Z Topshelf v4.0.0.0, .NET Framework v4.0.30319.42000
2018-10-16T20:03:38.3607260Z The Service service is not installed.
2018-10-16T20:03:38.9798417Z Configuration Result:
2018-10-16T20:03:38.9798851Z [Success] Name Service
2018-10-16T20:03:38.9799116Z [Success] DisplayName Service
2018-10-16T20:03:38.9799321Z [Success] Description Service
2018-10-16T20:03:38.9799475Z [Success] ServiceName Service
2018-10-16T20:03:38.9809326Z Topshelf v4.0.0.0, .NET Framework v4.0.30319.42000
2018-10-16T20:03:38.9982210Z 
2018-10-16T20:03:38.9982583Z Running a transacted installation.
2018-10-16T20:03:38.9982704Z 
2018-10-16T20:03:38.9982858Z Beginning the Install phase of the installation.
2018-10-16T20:03:38.9997784Z Installing Service service
2018-10-16T20:03:39.0013520Z Installing service Service...
2018-10-16T20:03:39.0589980Z 
2018-10-16T20:03:39.0590321Z An exception occurred during the Install phase.
2018-10-16T20:03:39.0590619Z System.ComponentModel.Win32Exception: The account name is invalid or does not exist, or the password is invalid for the account name specified
2018-10-16T20:03:39.0590782Z 
2018-10-16T20:03:39.0590954Z The Rollback phase of the installation is beginning.
2018-10-16T20:03:39.0599892Z 
2018-10-16T20:03:39.0600088Z The Rollback phase completed successfully.
2018-10-16T20:03:39.0600339Z 
2018-10-16T20:03:39.0600507Z The transacted install has completed.
2018-10-16T20:03:39.0935471Z Topshelf.HostFactory Error: 0 : The service terminated abnormally, System.InvalidOperationException: The installation failed, and the rollback has been performed. ---> System.ComponentModel.Win32Exception: The account name is invalid or does not exist, or the password is invalid for the account name specified
2018-10-16T20:03:39.0936371Z    at System.ServiceProcess.ServiceInstaller.Install(IDictionary stateSaver)
2018-10-16T20:03:39.0936618Z    at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
2018-10-16T20:03:39.0937764Z    at Topshelf.Runtime.Windows.HostInstaller.Install(IDictionary stateSaver)
2018-10-16T20:03:39.0937988Z    at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
2018-10-16T20:03:39.0938165Z    at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
2018-10-16T20:03:39.0938365Z    --- End of inner exception stack trace ---
2018-10-16T20:03:39.0938551Z    at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
2018-10-16T20:03:39.0938808Z    at Topshelf.Runtime.Windows.WindowsHostEnvironment.InstallService(InstallHostSettings settings, Action`1 beforeInstall, Action afterInstall, Action beforeRollback, Action afterRollback)
2018-10-16T20:03:39.0939050Z    at Topshelf.Hosts.InstallHost.Run()
2018-10-16T20:03:39.0939213Z    at Topshelf.HostFactory.Run(Action`1 configureCallback)
2018-10-16T20:03:39.1298146Z ##[section]Finishing: Service
oleksabor commented 5 years ago

I've got the same problem in the deployment group job

Install service task fails (can't understand why) but task does not show error and has succeeded status

2019-09-10T14:39:03.2618580Z ##[section]Starting: Install a Topshelf Service: f:\messageWare\bMKD\messageClient.exe
2019-09-10T14:39:03.2884868Z ==============================================================================
2019-09-10T14:39:03.2884949Z Task         : Install Topshelf Service
2019-09-10T14:39:03.2884985Z Description  : Installs a TopShelf service using the standard command line options for Topshelf 4.0.
2019-09-10T14:39:03.2885040Z Version      : 8.0.0
2019-09-10T14:39:03.2885073Z Author       : Michael Barry
2019-09-10T14:39:03.2885106Z Help         : [More Information](https://github.com/jabbera/my-vsts-tasks)
2019-09-10T14:39:03.2885140Z ==============================================================================
2019-09-10T14:39:04.5374659Z Installing TopShelf service: f:\messageWare\bMKD\messageClient.exe with instanceName: mwbMKD.
2019-09-10T14:39:04.5733266Z CMD: $env:DT_DISABLEINITIALLOGGING='true'
2019-09-10T14:39:04.5733470Z $env:DT_LOGLEVELCON='NONE'
2019-09-10T14:39:04.5733608Z & "f:\messageWare\bMKD\messageClient.exe" uninstall  --networkservice -instance:mwbMKD
2019-09-10T14:39:04.5733688Z & "f:\messageWare\bMKD\messageClient.exe" install  --networkservice -instance:mwbMKD --delayed
2019-09-10T14:39:04.5733741Z 
2019-09-10T14:39:04.6186491Z Error:
2019-09-10T14:39:04.6189537Z   An assembly specified in the application dependencies manifest (MessageClient.deps.json) was not found:
2019-09-10T14:39:04.6190300Z     package: 'System.Diagnostics.EventLog', version: '4.5.0'
2019-09-10T14:39:04.6192026Z     path: 'runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll'
2019-09-10T14:39:04.6737185Z Error:
2019-09-10T14:39:04.6740236Z   An assembly specified in the application dependencies manifest (MessageClient.deps.json) was not found:
2019-09-10T14:39:04.6743739Z     package: 'System.Diagnostics.EventLog', version: '4.5.0'
2019-09-10T14:39:04.6744228Z     path: 'runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll'
2019-09-10T14:39:04.7143723Z ##[section]Finishing: Install a Topshelf Service: f:\messageWare\bMKD\messageClient.exe
andymerts commented 4 years ago

I know this issue and related comments are quite old, but I was experiencing this issue recently and wanted to provide my workaround. Unfortunately, the workaround was to abandon this release task in favor of a Powershell task (had issues with a normal command line task as well) that just invokes the executable with arguments for username, password, etc. This approach reports errors back to the pipeline correctly.

Also, there appears to be an issue with documentation for the CLI. It directs you to provide quoted username/password like ./service.exe -username "domain\service account" -password "some password"

That didn't work for me. Here is the command I have working in a release pipeline right now: ."$(ServiceFolder)\$(ServiceName).exe" install -username:"$(ServiceUsername)" -password:"$(ServicePassword)"

Note the prefixed '.' which is necessary due to this being a Powershell command.