jabbera / my-vsts-tasks

20 stars 18 forks source link

Stop Windows Service Task doesn't through error even though if service not found #55

Open AvinashMitta opened 2 years ago

AvinashMitta commented 2 years ago

Hi Team We are using stop and start windows service tasks in azure devops release pipelines. We have observed that start windows service task throws error if service not found but not the same behavior with stop task. This will often mislead the flow. Below are the complete logs. Please fix the issue // 2022-06-14T07:28:28.2929699Z ##[debug]Evaluating condition for step: 'Stop Windows Service: ABC1234' 2022-06-14T07:28:28.2967839Z ##[debug]Evaluating: succeeded() 2022-06-14T07:28:28.2972910Z ##[debug]Evaluating succeeded: 2022-06-14T07:28:28.3008172Z ##[debug]=> True 2022-06-14T07:28:28.3015692Z ##[debug]Result: True 2022-06-14T07:28:28.3053878Z ##[section]Starting: Stop Windows Service: ABC1234 2022-06-14T07:28:28.3492133Z ============================================================================== 2022-06-14T07:28:28.3492829Z Task : Stop Windows Service 2022-06-14T07:28:28.3493122Z Description : Stop a windows service. 2022-06-14T07:28:28.3493270Z Version : 8.0.0 2022-06-14T07:28:28.3493528Z Author : Michael Barry 2022-06-14T07:28:28.3493909Z Help : More Information 2022-06-14T07:28:28.3494141Z ============================================================================== 2022-06-14T07:28:34.9840142Z ##[debug]VstsTaskSdk 0.6.4 commit a074a158dbd70b5a72d1295ee42684c30a262b19 2022-06-14T07:28:35.6157630Z ##[debug]Entering D:\azagent\A1_work_tasks\StopWindowsService_601cd43e-b65d-49b7-b118-091333bd5b9f\8.0.0\StopWindowsService.ps1. 2022-06-14T07:28:35.6373910Z ##[debug]Env:INPUT_SERVICENAMES: 'ABC1234' 2022-06-14T07:28:35.6408161Z ##[debug]Env:INPUT_INSTANCENAME (empty) 2022-06-14T07:28:35.6460101Z ##[debug]Env:INPUT_STARTUPTYPE: 'Automatic' 2022-06-14T07:28:35.6473806Z ##[debug]Env:INPUT_WAITTIMEOUTINSECONDS: '120' 2022-06-14T07:28:35.6494401Z ##[debug]Env:INPUT_KILLIFTIMEDOUT: 'false' 2022-06-14T07:28:35.6513083Z ##[debug]Env:INPUT_DEPLOYMENTGROUP: 'true' 2022-06-14T07:28:35.6565434Z ##[debug] Converted to bool: True 2022-06-14T07:28:35.6589758Z Stopping Windows Service: and setting startup type to: Automatic. Kill: false 2022-06-14T07:28:36.2852625Z ##[debug]No services match the name: ABC1234 2022-06-14T07:28:36.2878606Z ##[debug]No services matching the given names were found. 2022-06-14T07:28:36.2899721Z ##[debug]Leaving D:\azagent\A1_work_tasks\StopWindowsService_601cd43e-b65d-49b7-b118-091333bd5b9f\8.0.0\StopWindowsService.ps1. 2022-06-14T07:28:36.3118025Z ##[section]Finishing: Stop Windows Service: ABC1234 //

jabbera commented 2 years ago

This was by design. When installing the service for the first time we didn't want the pipeline to fail when the service wasn't there.

AvinashMitta commented 2 years ago

Oh okay .But at least a warning would be helpful stating that service doesn't exists if we intend to use for existing services to stop/start.