From b90d25ab0332e5a30c83094f5cf19df561b6c209 Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Tue, 1 Sep 2026 12:19:27 -0400 Subject: [PATCH] fix(ci): keep master behind architecture gates Signed-off-by: Yordis Prieto --- .../github-actions/resolve-comparison-refs | 35 +++++++---- .../workflows/build-container-ubuntu-lts.yml | 3 + .github/workflows/build-ubuntu-lts-arm64.yml | 8 +++ .github/workflows/build-ubuntu-lts-x64.yml | 8 +++ .github/workflows/common.yml | 5 ++ ...quest_forwarding_survives_leader_change.cs | 58 ++++++++++++++++--- 6 files changed, 98 insertions(+), 19 deletions(-) diff --git a/.config/mise/tasks/github-actions/resolve-comparison-refs b/.config/mise/tasks/github-actions/resolve-comparison-refs index 84b447facd..64a496798f 100755 --- a/.config/mise/tasks/github-actions/resolve-comparison-refs +++ b/.config/mise/tasks/github-actions/resolve-comparison-refs @@ -6,16 +6,29 @@ set -eu : "${GITHUB_OUTPUT:?GITHUB_OUTPUT is required}" : "${EVENT_NAME:?EVENT_NAME is required}" -if [ "$EVENT_NAME" = pull_request ]; then - : "${BASE_SHA:?BASE_SHA is required for pull requests}" - : "${HEAD_SHA:?HEAD_SHA is required for pull requests}" - base=$BASE_SHA - head=$HEAD_SHA -else - : "${BEFORE_SHA:?BEFORE_SHA is required for push events}" - : "${CURRENT_SHA:?CURRENT_SHA is required for push events}" - base=$BEFORE_SHA - head=$CURRENT_SHA -fi +case "$EVENT_NAME" in + pull_request) + : "${BASE_SHA:?BASE_SHA is required for pull requests}" + : "${HEAD_SHA:?HEAD_SHA is required for pull requests}" + base=$BASE_SHA + head=$HEAD_SHA + ;; + merge_group) + : "${MERGE_GROUP_BASE_SHA:?MERGE_GROUP_BASE_SHA is required for merge groups}" + : "${MERGE_GROUP_HEAD_SHA:?MERGE_GROUP_HEAD_SHA is required for merge groups}" + base=$MERGE_GROUP_BASE_SHA + head=$MERGE_GROUP_HEAD_SHA + ;; + push) + : "${BEFORE_SHA:?BEFORE_SHA is required for push events}" + : "${CURRENT_SHA:?CURRENT_SHA is required for push events}" + base=$BEFORE_SHA + head=$CURRENT_SHA + ;; + *) + echo "Unsupported event '$EVENT_NAME'." >&2 + exit 1 + ;; +esac printf 'base=%s\nhead=%s\n' "$base" "$head" >>"$GITHUB_OUTPUT" diff --git a/.github/workflows/build-container-ubuntu-lts.yml b/.github/workflows/build-container-ubuntu-lts.yml index 8132a8f98b..4c847f6f41 100644 --- a/.github/workflows/build-container-ubuntu-lts.yml +++ b/.github/workflows/build-container-ubuntu-lts.yml @@ -6,6 +6,9 @@ on: - "docs/**" - "samples/**" - "**.md" + merge_group: + types: + - checks_requested push: branches: - master diff --git a/.github/workflows/build-ubuntu-lts-arm64.yml b/.github/workflows/build-ubuntu-lts-arm64.yml index 4a7e1fd108..727cb503bb 100644 --- a/.github/workflows/build-ubuntu-lts-arm64.yml +++ b/.github/workflows/build-ubuntu-lts-arm64.yml @@ -1,6 +1,14 @@ name: Ubuntu LTS ARM64 on: + pull_request: + paths-ignore: + - "docs/**" + - "samples/**" + - "**.md" + merge_group: + types: + - checks_requested push: branches: - master diff --git a/.github/workflows/build-ubuntu-lts-x64.yml b/.github/workflows/build-ubuntu-lts-x64.yml index 989ae3469c..1cd88f24cc 100644 --- a/.github/workflows/build-ubuntu-lts-x64.yml +++ b/.github/workflows/build-ubuntu-lts-x64.yml @@ -1,6 +1,14 @@ name: Ubuntu LTS X64 on: + pull_request: + paths-ignore: + - "docs/**" + - "samples/**" + - "**.md" + merge_group: + types: + - checks_requested push: branches: - master diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 76a31041eb..c96d76a860 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -6,6 +6,9 @@ on: - "docs/**" - "samples/**" - "**.md" + merge_group: + types: + - checks_requested push: branches: - master @@ -73,6 +76,8 @@ jobs: EVENT_NAME: ${{ github.event_name }} BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + MERGE_GROUP_BASE_SHA: ${{ github.event.merge_group.base_sha }} + MERGE_GROUP_HEAD_SHA: ${{ github.event.merge_group.head_sha }} BEFORE_SHA: ${{ github.event.before }} CURRENT_SHA: ${{ github.sha }} run: mise run --skip-tools github-actions:resolve-comparison-refs diff --git a/src/EventStore.Core.Tests/Integration/grpc_request_forwarding_survives_leader_change.cs b/src/EventStore.Core.Tests/Integration/grpc_request_forwarding_survives_leader_change.cs index 85b1256a74..ee84291069 100644 --- a/src/EventStore.Core.Tests/Integration/grpc_request_forwarding_survives_leader_change.cs +++ b/src/EventStore.Core.Tests/Integration/grpc_request_forwarding_survives_leader_change.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Http; @@ -24,23 +25,30 @@ public class grpc_request_forwarding_survives_leader_change _nodes.Count(node => node.NodeState == VNodeState.Leader) == 1 && _nodes.Count(node => node.NodeState == VNodeState.Follower) == 2, - ClusterTransitionTimeout, + RemainingScenarioTime(scenario), "The initial cluster topology did not stabilize", MiniNodeLogging.WriteLogs); var initialLeader = _nodes.Single(node => node.NodeState == VNodeState.Leader); var initialFollowers = _nodes.Where(node => node.NodeState == VNodeState.Follower).ToArray(); - Assert.That(await Append(initialFollowers[0].HttpEndPoint, ExpectedStreamRevision.NoStream), Is.EqualTo(0)); - Assert.That(await Append(initialFollowers[1].HttpEndPoint, ExpectedStreamRevision.Exact(0)), Is.EqualTo(1)); + Assert.That(await Append(initialFollowers[0].HttpEndPoint, ExpectedStreamRevision.NoStream, scenario), + Is.EqualTo(0)); + Assert.That(await Append(initialFollowers[1].HttpEndPoint, ExpectedStreamRevision.Exact(0), scenario), + Is.EqualTo(1)); await initialLeader.Shutdown(keepDb: true); _nodes[initialLeader.DebugIndex] = null; @@ -49,16 +57,40 @@ public async Task completes_writes_through_a_surviving_follower_after_a_new_lead () => _nodes.Count(node => node is not null && node.NodeState == VNodeState.Leader) == 1 && _nodes.Count(node => node is not null && node.NodeState == VNodeState.Follower) == 1, - ClusterTransitionTimeout, + RemainingScenarioTime(scenario), "The surviving nodes did not elect a leader", MiniNodeLogging.WriteLogs); var forwardingFollower = _nodes.Single(node => node is not null && node.NodeState == VNodeState.Follower); Assert.That(initialFollowers, Does.Contain(forwardingFollower)); - Assert.That(await Append(forwardingFollower.HttpEndPoint, ExpectedStreamRevision.Exact(1)), Is.EqualTo(2)); + Assert.That(await Append(forwardingFollower.HttpEndPoint, ExpectedStreamRevision.Exact(1), scenario), + Is.EqualTo(2)); } - private static async Task Append(IPEndPoint endpoint, ExpectedStreamRevision expectedRevision) + private static async Task Append( + IPEndPoint endpoint, + ExpectedStreamRevision expectedRevision, + Stopwatch scenario) + { + while (true) + { + try + { + return await AppendOnce(endpoint, expectedRevision, RemainingScenarioTime(scenario)); + } + catch (RpcException ex) when ( + ex.StatusCode is StatusCode.Unauthenticated or StatusCode.Unavailable && + scenario.Elapsed < ScenarioTimeout) + { + await Task.Delay(AuthenticationRetryDelay); + } + } + } + + private static async Task AppendOnce( + IPEndPoint endpoint, + ExpectedStreamRevision expectedRevision, + TimeSpan remainingScenarioTime) { using var handler = new SocketsHttpHandler { @@ -78,7 +110,9 @@ private static async Task Append(IPEndPoint endpoint, ExpectedStreamRevis metadata.Add("authorization", AuthorizationHeaderValue); return Task.CompletedTask; }), - deadline: DateTime.UtcNow.AddSeconds(30))); + deadline: DateTime.UtcNow.Add(remainingScenarioTime < RequestTimeout + ? remainingScenarioTime + : RequestTimeout))); var options = new AppendReq.Types.Options { @@ -121,6 +155,14 @@ await call.RequestStream.WriteAsync(new AppendReq return response.Success.CurrentRevision; } + private static TimeSpan RemainingScenarioTime(Stopwatch scenario) + { + var remaining = ScenarioTimeout - scenario.Elapsed; + return remaining > TimeSpan.Zero + ? remaining + : throw new TimeoutException("The forwarding failover scenario exceeded its time budget"); + } + private enum ExpectedStreamRevisionKind { NoStream,