Skip to content

Commit 6568ae0

Browse files
committed
ci(codeql): persistent self-hosted Conan home + bounded restore retry
The Analyze (c-cpp) job intermittently failed on Install Conan dependencies with "Failed to restore: The operation cannot be completed in timeout", false-redding verified-good release PRs (#751, #756, #758). Root cause is the same shape as the web-static Chrome flake fixed in #748: a self-hosted job pulling a large payload over the network on every run. CONAN_HOME was pinned to $RUNNER_TEMP/conan2 unconditionally, so each self-hosted CodeQL run started with an empty Conan home and depended on actions/cache restoring a multi-hundred-MB tree from the GitHub cache service onto VM905. That restore times out under load; on a miss it also forced a from-source boost rebuild. - self-hosted: CONAN_HOME=$HOME/.conan2-codeql, persistent across runs. Dedicated path rather than the shared ~/.conan2, preserving the torn-cache isolation from #704/#710; this workflow serialises per ref via its concurrency group, so nothing else writes that home. - actions/cache restore is now github-hosted (fork PR) only. - conan install wrapped in a 3x bounded retry with backoff for transient remote hiccups. build-mode stays manual: CodeQL c-cpp requires a real build, and none/autobuild would either drop analysis coverage or still need the same Conan step.
1 parent 65e447e commit 6568ae0

1 file changed

Lines changed: 35 additions & 10 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,22 @@ jobs:
4848
queries: security-and-quality
4949

5050
- if: matrix.build-mode == 'manual'
51-
name: Set per-job Conan home
52-
run: echo "CONAN_HOME=$RUNNER_TEMP/conan2" >> "$GITHUB_ENV"
51+
name: Set Conan home
52+
run: |
53+
# github-hosted: ephemeral per-job home, warmed by actions/cache below.
54+
# self-hosted: PERSISTENT home dedicated to this workflow. Restoring a
55+
# multi-hundred-MB conan2 tree from the GH cache service onto VM905 is
56+
# the flake ("Failed to restore: The operation cannot be completed in
57+
# timeout"), and on a miss it forced a from-source boost rebuild too.
58+
# A local persistent home takes the network off the hot path.
59+
# Dedicated path (NOT the shared ~/.conan2) preserves the torn-cache
60+
# isolation from #704/#710; this workflow's concurrency group
61+
# serialises CodeQL per ref, so nothing else writes this home.
62+
if [ "${{ runner.environment }}" = "github-hosted" ]; then
63+
echo "CONAN_HOME=$RUNNER_TEMP/conan2" >> "$GITHUB_ENV"
64+
else
65+
echo "CONAN_HOME=$HOME/.conan2-codeql" >> "$GITHUB_ENV"
66+
fi
5367
5468
# ── C++ build (manual mode only) ─────────────────────────────────────
5569
- if: matrix.build-mode == 'manual' && runner.environment == 'github-hosted'
@@ -78,8 +92,8 @@ jobs:
7892
conan --version # pre-provisioned at /usr/local/bin on self-hosted
7993
fi
8094
81-
- if: matrix.build-mode == 'manual'
82-
name: Restore Conan package cache
95+
- if: matrix.build-mode == 'manual' && runner.environment == 'github-hosted'
96+
name: Restore Conan package cache (github-hosted only)
8397
uses: actions/cache@v5
8498
with:
8599
path: ${{ runner.temp }}/conan2
@@ -93,13 +107,24 @@ jobs:
93107

94108
- if: matrix.build-mode == 'manual'
95109
name: Install Conan dependencies
110+
# Bounded retry: remote package downloads are the only network step left
111+
# here, and a transient remote/CDN hiccup should not red a verified-good
112+
# release PR.
96113
run: |
97-
conan install . \
98-
-pr:a=ci/conan/linux-gcc13.profile \
99-
--lockfile=conan.lock \
100-
--build=missing \
101-
--output-folder=build_codeql \
102-
--settings=build_type=Release
114+
for attempt in 1 2 3; do
115+
if conan install . \
116+
-pr:a=ci/conan/linux-gcc13.profile \
117+
--lockfile=conan.lock \
118+
--build=missing \
119+
--output-folder=build_codeql \
120+
--settings=build_type=Release; then
121+
exit 0
122+
fi
123+
echo "conan install failed (attempt $attempt/3); retrying in $((attempt * 15))s"
124+
sleep $((attempt * 15))
125+
done
126+
echo "conan install failed after 3 attempts" >&2
127+
exit 1
103128
104129
- if: matrix.build-mode == 'manual'
105130
name: Build for CodeQL analysis

0 commit comments

Comments
 (0)