Skip to content

Commit 3701b50

Browse files
authored
Build: Simplify Docker layout, fix Envoy, and upgrade tests (#2774)
It seems the Envoy apts have gone missing breaking out build, so instead of relying on the install let's docker compose their image as a proxy against the Redis supervisor instance as a simpler and faster-to-start setup that also works. This rearranged some things to simplify the Docker story overall. A move to AzDO or just GitHub builds would simplify everything further, but we need to figure out Windows testing against a Docker setup in CI. Note: we still can't use Linux containers on a Windows GitHub Actions host (actions/runner#904), so this remains much more complicated and not-really-testing-the-real-thing in the Windows front.
1 parent e208905 commit 3701b50

26 files changed

+130
-138
lines changed

.github/workflows/CI.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
with:
2525
dotnet-version: |
2626
6.0.x
27-
7.0.x
27+
8.0.x
2828
- name: .NET Build
2929
run: dotnet build Build.csproj -c Release /p:CI=true
3030
- name: Start Redis Services (docker-compose)
3131
working-directory: ./tests/RedisConfigs
32-
run: docker compose -f docker-compose.yml up -d
32+
run: docker compose -f docker-compose.yml up -d --wait
3333
- name: StackExchange.Redis.Tests
3434
run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
3535
- uses: dorny/test-reporter@v1
@@ -49,6 +49,7 @@ jobs:
4949
NUGET_CERT_REVOCATION_MODE: offline # Disabling signing because of massive perf hit, see https://github.com/NuGet/Home/issues/11548
5050
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1" # Note this doesn't work yet for Windows - see https://github.com/dotnet/runtime/issues/68340
5151
TERM: xterm
52+
DOCKER_BUILDKIT: 1
5253
steps:
5354
- name: Checkout code
5455
uses: actions/checkout@v1
@@ -57,9 +58,13 @@ jobs:
5758
# with:
5859
# dotnet-version: |
5960
# 6.0.x
60-
# 7.0.x
61+
# 8.0.x
6162
- name: .NET Build
6263
run: dotnet build Build.csproj -c Release /p:CI=true
64+
# We can't do this combination - see https://github.com/actions/runner/issues/904
65+
# - name: Start Redis Services (docker-compose)
66+
# working-directory: .\tests\RedisConfigs
67+
# run: docker compose -f docker-compose.yml up -d --wait
6368
- name: Start Redis Services (v3.0.503)
6469
working-directory: .\tests\RedisConfigs\3.0.503
6570
run: |

Directory.Packages.props

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
<!-- Packages only used in the solution, upgrade at will -->
1212
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
13-
<PackageVersion Include="GitHubActionsTestLogger" Version="2.0.0-alpha" />
13+
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
1414
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
1515
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
1616
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
17-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
18-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
19-
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.4.255" />
20-
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
21-
<PackageVersion Include="NSubstitute" Version="5.0.0" />
17+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
18+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
19+
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.141" />
20+
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
21+
<PackageVersion Include="NSubstitute" Version="5.1.0" />
2222
<PackageVersion Include="StackExchange.Redis" Version="2.6.96" />
2323
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
2424
<!-- For binding redirect testing, main package gets this transitively -->
2525
<PackageVersion Include="System.IO.Pipelines" Version="5.0.1" />
2626
<PackageVersion Include="System.Runtime.Caching" Version="5.0.0" />
27-
<PackageVersion Include="xunit" Version="2.5.0" />
28-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />
27+
<PackageVersion Include="xunit" Version="2.9.0" />
28+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
2929
</ItemGroup>
3030
</Project>

src/StackExchange.Redis/Maintenance/AzureMaintenanceEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public sealed class AzureMaintenanceEvent : ServerMaintenanceEvent
1515
{
1616
private const string PubSubChannelName = "AzureRedisEvents";
1717

18-
internal AzureMaintenanceEvent(string azureEvent)
18+
internal AzureMaintenanceEvent(string? azureEvent)
1919
{
2020
if (azureEvent == null)
2121
{

src/StackExchange.Redis/ResultProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ internal sealed class ScriptLoadProcessor : ResultProcessor<byte[]>
526526

527527
private static readonly Regex sha1 = new Regex("^[0-9a-f]{40}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
528528

529-
internal static bool IsSHA1(string script) => script is not null && script.Length == SHA1Length && sha1.IsMatch(script);
529+
internal static bool IsSHA1(string? script) => script is not null && script.Length == SHA1Length && sha1.IsMatch(script);
530530

531531
internal const int Sha1HashLength = 20;
532532
internal static byte[] ParseSHA1(byte[] value)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM envoyproxy/envoy:v1.31-latest
2+
3+
COPY envoy.yaml /etc/envoy/envoy.yaml
4+
RUN chmod go+r /etc/envoy/envoy.yaml
5+
6+
EXPOSE 7015
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
admin:
2+
address: { socket_address: { protocol: TCP, address: 0.0.0.0, port_value: 8001 } }
3+
static_resources:
4+
listeners:
5+
- name: redis_listener
6+
address: { socket_address: { protocol: TCP, address: 0.0.0.0, port_value: 7015 } }
7+
filter_chains:
8+
- filters:
9+
- name: envoy.filters.network.redis_proxy
10+
typed_config:
11+
"@type": type.googleapis.com/envoy.extensions.filters.network.redis_proxy.v3.RedisProxy
12+
stat_prefix: envoy_redis_stats
13+
settings:
14+
op_timeout: 3s
15+
dns_cache_config:
16+
name: dynamic_forward_proxy_cache_config
17+
dns_lookup_family: V4_ONLY
18+
prefix_routes:
19+
catch_all_route:
20+
cluster: redis_cluster
21+
clusters:
22+
- name: redis_cluster
23+
connect_timeout: 3s
24+
type: STRICT_DNS
25+
dns_lookup_family: V4_ONLY
26+
load_assignment:
27+
cluster_name: redis_cluster
28+
endpoints:
29+
- lb_endpoints:
30+
- endpoint: { address: { socket_address: { address: redis, port_value: 7000 } } }
31+
- endpoint: { address: { socket_address: { address: redis, port_value: 7001 } } }
32+
- endpoint: { address: { socket_address: { address: redis, port_value: 7002 } } }
33+
- endpoint: { address: { socket_address: { address: redis, port_value: 7003 } } }
34+
- endpoint: { address: { socket_address: { address: redis, port_value: 7004 } } }
35+
- endpoint: { address: { socket_address: { address: redis, port_value: 7005 } } }
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM redis:7.4-rc1
2+
3+
COPY --from=configs ./Basic /data/Basic/
4+
COPY --from=configs ./Failover /data/Failover/
5+
COPY --from=configs ./Cluster /data/Cluster/
6+
COPY --from=configs ./Sentinel /data/Sentinel/
7+
COPY --from=configs ./Certs /Certs/
8+
9+
RUN chown -R redis:redis /data
10+
RUN chown -R redis:redis /Certs
11+
12+
COPY docker-entrypoint.sh /usr/local/bin/
13+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
14+
15+
RUN apt-get -y update && apt-get install supervisor -y
16+
17+
RUN apt-get clean
18+
19+
ADD supervisord.conf /etc/
20+
21+
ENTRYPOINT ["docker-entrypoint.sh"]
22+
23+
EXPOSE 6379 6380 6381 6382 6383 6384 7000 7001 7002 7003 7004 7005 7010 7011 26379 26380 26381

tests/RedisConfigs/Docker/supervisord.conf renamed to tests/RedisConfigs/.docker/Redis/supervisord.conf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ stdout_logfile=/var/log/supervisor/%(program_name)s.log
9999
stderr_logfile=/var/log/supervisor/%(program_name)s.log
100100
autorestart=true
101101

102-
[program:redis-7015]
103-
command=/usr/bin/envoy -c /envoy/envoy.yaml
104-
directory=/envoy
105-
stdout_logfile=/var/log/supervisor/%(program_name)s.log
106-
stderr_logfile=/var/log/supervisor/%(program_name)s.log
107-
autorestart=true
108-
109102
[program:sentinel-26379]
110103
command=/usr/local/bin/redis-server /data/Sentinel/sentinel-26379.conf --sentinel
111104
directory=/data/Sentinel

tests/RedisConfigs/Docker/install-envoy.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)