diff options
| author | Stefan Boberg <[email protected]> | 2026-04-01 11:42:21 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-01 11:42:21 +0200 |
| commit | ba4c137e5f5447c37e303ac64519c7c7329ab3e8 (patch) | |
| tree | 1d2e7dcd1323827666ff4462066f95dcced3c673 /.github/workflows/validate.yml | |
| parent | Zs/oplog export zero size attachment fix (#911) (diff) | |
| download | zen-ba4c137e5f5447c37e303ac64519c7c7329ab3e8.tar.xz zen-ba4c137e5f5447c37e303ac64519c7c7329ab3e8.zip | |
kill stale test processes (zenserver, minio, nomad, consul) before and after CI test runs (#909)
Adds steps to the validate workflow on all platforms that kill any zenserver, minio, nomad, or consul processes launched from the build output directory. Runs before tests to clear stale processes from previous runs, and after tests (always, even on failure) to clean up.
Diffstat (limited to '.github/workflows/validate.yml')
| -rw-r--r-- | .github/workflows/validate.yml | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 601f000fe..99bf1e2d2 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -84,11 +84,39 @@ jobs: if: ${{ matrix.config == 'debug' }} run: if (Test-Path build/reports) { Remove-Item -Recurse -Force build/reports } + - name: Kill stale test processes + if: ${{ matrix.config == 'debug' }} + shell: powershell + run: | + $buildDir = "${{ github.workspace }}\build" + foreach ($name in @('zenserver', 'minio', 'nomad', 'consul')) { + $procs = Get-Process -Name $name -ErrorAction SilentlyContinue | + Where-Object { $_.Path -and $_.Path.StartsWith($buildDir, [System.StringComparison]::OrdinalIgnoreCase) } + foreach ($p in $procs) { + Write-Host "Killing stale $name (PID $($p.Id)): $($p.Path)" + $p | Stop-Process -Force -ErrorAction SilentlyContinue + } + } + - name: Build & Test if: ${{ matrix.config == 'debug' }} run: | xmake test -v -y --junit + - name: Kill test processes + if: ${{ always() && matrix.config == 'debug' }} + shell: powershell + run: | + $buildDir = "${{ github.workspace }}\build" + foreach ($name in @('zenserver', 'minio', 'nomad', 'consul')) { + $procs = Get-Process -Name $name -ErrorAction SilentlyContinue | + Where-Object { $_.Path -and $_.Path.StartsWith($buildDir, [System.StringComparison]::OrdinalIgnoreCase) } + foreach ($p in $procs) { + Write-Host "Killing leftover $name (PID $($p.Id)): $($p.Path)" + $p | Stop-Process -Force -ErrorAction SilentlyContinue + } + } + - name: Upload report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: actions/upload-artifact@v3-node20 @@ -152,11 +180,39 @@ jobs: shell: bash run: rm -rf build/reports + - name: Kill stale test processes + if: ${{ matrix.config == 'debug' }} + shell: bash + run: | + build_dir="${{ github.workspace }}/build" + for name in zenserver minio nomad consul; do + pgrep -a "$name" 2>/dev/null | while read -r pid cmd; do + if [[ "$cmd" == "$build_dir"* ]]; then + echo "Killing stale $name (PID $pid): $cmd" + kill -9 "$pid" 2>/dev/null || true + fi + done || true + done + - name: Build & Test if: ${{ matrix.config == 'debug' }} run: | xmake test -v -y --junit + - name: Kill test processes + if: ${{ always() && matrix.config == 'debug' }} + shell: bash + run: | + build_dir="${{ github.workspace }}/build" + for name in zenserver minio nomad consul; do + pgrep -a "$name" 2>/dev/null | while read -r pid cmd; do + if [[ "$cmd" == "$build_dir"* ]]; then + echo "Killing leftover $name (PID $pid): $cmd" + kill -9 "$pid" 2>/dev/null || true + fi + done || true + done + - name: Upload report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: actions/upload-artifact@v3-node20 @@ -221,11 +277,39 @@ jobs: shell: bash run: rm -rf build/reports + - name: Kill stale test processes + if: ${{ matrix.config == 'debug' }} + shell: bash + run: | + build_dir="${{ github.workspace }}/build" + for name in zenserver minio nomad consul; do + pgrep -a "$name" 2>/dev/null | while read -r pid cmd; do + if [[ "$cmd" == "$build_dir"* ]]; then + echo "Killing stale $name (PID $pid): $cmd" + kill -9 "$pid" 2>/dev/null || true + fi + done || true + done + - name: Build & Test if: ${{ matrix.config == 'debug' }} run: | xmake test -v -y --junit + - name: Kill test processes + if: ${{ always() && matrix.config == 'debug' }} + shell: bash + run: | + build_dir="${{ github.workspace }}/build" + for name in zenserver minio nomad consul; do + pgrep -a "$name" 2>/dev/null | while read -r pid cmd; do + if [[ "$cmd" == "$build_dir"* ]]; then + echo "Killing leftover $name (PID $pid): $cmd" + kill -9 "$pid" 2>/dev/null || true + fi + done || true + done + - name: Upload report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: actions/upload-artifact@v3-node20 |