|
46 | 46 | --enable-debug |
47 | 47 | validate: tests/e2e/validate-reachability.sh |
48 | 48 | setup-node: "true" |
| 49 | + # The tier-1 reachability backend intermittently returns empty |
| 50 | + # results while the CLI reports success (ENG-5093). The probe |
| 51 | + # exits 0 when the facts file has alerted components; anything |
| 52 | + # else is retried before validation fails the job. |
| 53 | + retry-probe: bash tests/e2e/reach-facts-probe.sh tests/e2e/fixtures/simple-npm |
49 | 54 |
|
50 | 55 | - name: gitlab |
51 | 56 | args: >- |
@@ -96,15 +101,54 @@ jobs: |
96 | 101 | - name: Run Socket CLI |
97 | 102 | env: |
98 | 103 | SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }} |
| 104 | + RETRY_PROBE: ${{ matrix.retry-probe }} |
99 | 105 | run: | |
100 | 106 | set -o pipefail |
101 | | - socketcli ${{ matrix.args }} 2>&1 | tee /tmp/e2e-output.log |
| 107 | + # Entries with retry-probe get up to 3 attempts: the probe exits 0 |
| 108 | + # when the scan output looks complete, and a run that fails it is |
| 109 | + # re-run on the assumption of a transient backend failure. A |
| 110 | + # persistent failure still reaches the validate step, which fails |
| 111 | + # the job with full context. Retries are surfaced as warning |
| 112 | + # annotations so flake frequency stays visible instead of being |
| 113 | + # silently absorbed. |
| 114 | + max_attempts=3 |
| 115 | + attempt=1 |
| 116 | + while :; do |
| 117 | + socketcli ${{ matrix.args }} 2>&1 | tee /tmp/e2e-output.log |
| 118 | + [ -z "$RETRY_PROBE" ] && break |
| 119 | + if bash -c "$RETRY_PROBE"; then |
| 120 | + break |
| 121 | + fi |
| 122 | + if [ "$attempt" -ge "$max_attempts" ]; then |
| 123 | + echo "::warning title=e2e-${{ matrix.name }} incomplete results::output still fails the completeness probe after ${max_attempts} attempts; letting validation fail the job" |
| 124 | + break |
| 125 | + fi |
| 126 | + echo "::warning title=e2e-${{ matrix.name }} transient retry::attempt ${attempt} failed the completeness probe (suspected backend transient, see ENG-5093); retrying" |
| 127 | + echo "e2e-${{ matrix.name }}: retry after attempt ${attempt} — completeness probe failed (suspected transient)" >> "$GITHUB_STEP_SUMMARY" |
| 128 | + attempt=$((attempt+1)) |
| 129 | + sleep 30 |
| 130 | + done |
102 | 131 |
|
103 | 132 | - name: Validate results |
104 | 133 | env: |
105 | 134 | SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }} |
106 | 135 | run: bash ${{ matrix.validate }} |
107 | 136 |
|
| 137 | + - name: Upload diagnostics on failure |
| 138 | + if: failure() |
| 139 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 140 | + with: |
| 141 | + name: e2e-${{ matrix.name }}-diagnostics-attempt${{ github.run_attempt }} |
| 142 | + path: | |
| 143 | + /tmp/e2e-output.log |
| 144 | + /tmp/*.sarif |
| 145 | + tests/e2e/fixtures/simple-npm/.socket.facts.json |
| 146 | + tests/e2e/fixtures/simple-pypi/.socket.facts.json |
| 147 | + gl-*.json |
| 148 | + license_output.json |
| 149 | + if-no-files-found: ignore |
| 150 | + retention-days: 14 |
| 151 | + |
108 | 152 | # Branch protection requires the e2e-* checks, but the `e2e` job above is |
109 | 153 | # skipped on PRs that can't access repository secrets -- fork PRs and |
110 | 154 | # Dependabot PRs. A job skipped via a job-level `if` never expands its |
|
0 commit comments