From 75c17bfaedc1288975c725926de2aa61649a7e83 Mon Sep 17 00:00:00 2001
From: Valera V Harseko <vharseko@3a-systems.ru>
Date: Mon, 22 Jun 2026 09:07:38 +0000
Subject: [PATCH] Rename benchmark workflow and fix OpenLDAP version-capture SIGPIPE

---
 .github/benchmark/people.ldif   |    0 
 .github/benchmark/summary.sh    |    0 
 .github/benchmark/benchmark.jmx |    0 
 .github/workflows/benchmark.yml |   26 ++++++++++++++++----------
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/.github/performance/benchmark.jmx b/.github/benchmark/benchmark.jmx
similarity index 100%
rename from .github/performance/benchmark.jmx
rename to .github/benchmark/benchmark.jmx
diff --git a/.github/performance/people.ldif b/.github/benchmark/people.ldif
similarity index 100%
rename from .github/performance/people.ldif
rename to .github/benchmark/people.ldif
diff --git a/.github/performance/summary.sh b/.github/benchmark/summary.sh
similarity index 100%
rename from .github/performance/summary.sh
rename to .github/benchmark/summary.sh
diff --git a/.github/workflows/performance.yml b/.github/workflows/benchmark.yml
similarity index 86%
rename from .github/workflows/performance.yml
rename to .github/workflows/benchmark.yml
index 77e1d09..c8b7838 100644
--- a/.github/workflows/performance.yml
+++ b/.github/workflows/benchmark.yml
@@ -11,7 +11,7 @@
 # information: "Portions copyright [year] [name of copyright owner]".
 #
 # Copyright 2026 3A Systems, LLC.
-name: Performance
+name: "LDAP benchmark: OpenDJ vs OpenLDAP"
 
 # LDAP benchmark: OpenDJ vs OpenLDAP.
 # Runs manually (workflow_dispatch) and automatically after the "Release" workflow completes.
@@ -49,7 +49,7 @@
   contents: read
 
 concurrency:
-  group: performance-${{ github.ref }}
+  group: benchmark-${{ github.ref }}
   cancel-in-progress: true
 
 defaults:
@@ -113,11 +113,15 @@
             sleep 2
           done
           ldapadd -x -H ldap://localhost:2389 -D "cn=admin,$BASEDN" -w password \
-            -f .github/performance/people.ldif || true
+            -f .github/benchmark/people.ldif || true
 
       - name: Capture OpenLDAP version
         run: |
-          ver="$(docker exec openldap sh -c '/usr/sbin/slapd -VV 2>&1 || slapd -VV 2>&1' | head -1)"
+          # No `| head -1`: head closes the pipe early, slapd -VV then gets SIGPIPE and under
+          # `pipefail` fails the step with exit 141. Capture fully, take the first line in bash.
+          ver="$(docker exec openldap sh -c '/usr/sbin/slapd -VV 2>&1 || slapd -VV 2>&1' || true)"
+          ver="${ver%%$'\n'*}"
+          [ -n "$ver" ] || ver="$OPENLDAP_IMAGE"
           echo "OpenLDAP: $ver"
           {
             echo "OPENLDAP_VER<<EOF"
@@ -128,7 +132,7 @@
       - name: Benchmark OpenLDAP
         run: |
           rm -rf openldap openldap.jtl
-          HEAP="$HEAP" "$JMETER_BIN" -n -t .github/performance/benchmark.jmx \
+          HEAP="$HEAP" "$JMETER_BIN" -n -t .github/benchmark/benchmark.jmx \
             -Jhost=localhost -Jport=2389 \
             -Jbasedn="$BASEDN" \
             -Jadminbinddn="cn=admin,$BASEDN" -Jadminbindpw=password \
@@ -155,12 +159,14 @@
             sleep 2
           done
           ldapadd -x -H ldap://localhost:1389 -D "cn=Directory Manager" -w password \
-            -f .github/performance/people.ldif || true
+            -f .github/benchmark/people.ldif || true
 
       - name: Capture OpenDJ version
         run: |
-          ver="$(ldapsearch -x -LLL -H ldap://localhost:1389 -D 'cn=Directory Manager' -w password \
-                  -b '' -s base fullVendorVersion 2>/dev/null | sed -n 's/^fullVendorVersion: //p')"
+          # `|| true` guards the bind so a transient ldapsearch failure can't trip pipefail;
+          # sed reads all input (no early pipe close), so no SIGPIPE here.
+          ver="$( { ldapsearch -x -LLL -H ldap://localhost:1389 -D 'cn=Directory Manager' -w password \
+                    -b '' -s base fullVendorVersion 2>/dev/null || true; } | sed -n 's/^fullVendorVersion: //p')"
           [ -n "$ver" ] || ver="$OPENDJ_IMAGE"
           echo "OpenDJ: $ver"
           {
@@ -172,7 +178,7 @@
       - name: Benchmark OpenDJ
         run: |
           rm -rf opendj opendj.jtl
-          HEAP="$HEAP" "$JMETER_BIN" -n -t .github/performance/benchmark.jmx \
+          HEAP="$HEAP" "$JMETER_BIN" -n -t .github/benchmark/benchmark.jmx \
             -Jhost=localhost -Jport=1389 \
             -Jbasedn="$BASEDN" \
             -Jadminbinddn="cn=Directory Manager" -Jadminbindpw=password \
@@ -184,7 +190,7 @@
       # ---------------------------------------------------------------- Report
       - name: Build job summary
         run: |
-          bash .github/performance/summary.sh \
+          bash .github/benchmark/summary.sh \
             openldap/statistics.json opendj/statistics.json \
             "$OPENLDAP_VER" "$OPENDJ_VER" \
             "$OPENLDAP_IMAGE" "$OPENDJ_IMAGE" >> "$GITHUB_STEP_SUMMARY"

--
Gitblit v1.10.0