mirror of
https://github.com/moby/moby.git
synced 2026-06-30 19:58:03 +00:00
gha: windows: skip "Stop OpenTelemetry Collector" if it wasn't started
If setup failed or was skipped, this produced an error;
Run (Stop-Service -DisplayName "OpenTelemetry Collector" -PassThru).WaitForStatus('Stopped', (New-TimeSpan -Seconds 30))
Stop-Service: D:\a\_temp\f0230cca-e5e4-4a0b-9fe2-0d0a6a5bc60e.ps1:2
Line |
2 | (Stop-Service -DisplayName "OpenTelemetry Collector" -PassThru).WaitF …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find any service with display name 'OpenTelemetry Collector'.
Error: Process completed with exit code 1.
Skip this step if we skipped "Set up OpenTelemetry Collector", and ignore situations
where the service could not be found for other reasons.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
8
.github/workflows/.windows.yml
vendored
8
.github/workflows/.windows.yml
vendored
@@ -329,6 +329,7 @@ jobs:
|
||||
cache: false
|
||||
-
|
||||
name: Set up OpenTelemetry Collector
|
||||
id: setup-otel
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path bundles -ErrorAction Continue
|
||||
Start-Process "msiexec" -ArgumentList "/i",
|
||||
@@ -548,9 +549,12 @@ jobs:
|
||||
Tee-Object -file ".\bundles\daemon.log"
|
||||
-
|
||||
name: Stop OpenTelemetry Collector
|
||||
if: always()
|
||||
if: ${{ always() && steps.setup-otel.outcome != 'skipped' }}
|
||||
run: |
|
||||
(Stop-Service -DisplayName "OpenTelemetry Collector" -PassThru).WaitForStatus('Stopped', (New-TimeSpan -Seconds 30))
|
||||
$svc = Get-Service -DisplayName "OpenTelemetry Collector" -ErrorAction SilentlyContinue
|
||||
if ($svc -and $svc.Status -ne "Stopped") {
|
||||
($svc | Stop-Service -PassThru).WaitForStatus("Stopped", (New-TimeSpan -Seconds 30))
|
||||
}
|
||||
-
|
||||
name: Upload reports
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user