Skip to content

Commit 0d55be9

Browse files
authored
Enhance unstable with 8.0+ improvements and testing infrastructure (#463)
This commit consolidates multiple improvements to the Redis Docker library: **Major Infrastructure Changes:** - Restructure repository by moving legacy templating scripts to dedicated directory - Add new simplified Dockerfile structure for Alpine and Debian variants - Introduce comprehensive entrypoint testing framework with shunit2 **Docker Image Improvements:** - Bump Alpine base image from 3.21 to 3.22 - Add support for Rust compilation with clang-static, llvm-dev, ncurses-dev packages - Set RUST_DYN_CRT=1 environment variable for dynamic runtime linking - Fix file permissions for Redis configuration files - Preserve apk package management tools in final image - Use setpriv instead of gosu for privilege dropping in entrypoint - Improve entrypoint script robustness and remove eval usage **CI/CD Enhancements:** - Add GitHub Actions workflow for pre-merge testing - Implement ARM64 support in build and test actions - Configure fail-fast: false for better parallel testing - Fix PR workflow to test merge commits instead of head commits - Add callable workflow options for flexibility **Testing & Quality:** - Introduce comprehensive entrypoint testing suite - Add container initialization wait logic - Implement version-specific test cases for unstable builds - Add .dockerignore for optimized build context **Version Management:** - Cherry-pick Redis 8.2 M01 improvements while maintaining unstable branch builds - Ensure compatibility with Redis 8.0+ features - Maintain backward compatibility with existing configurations
1 parent 43f7860 commit 0d55be9

File tree

7 files changed

+2556
-40
lines changed

7 files changed

+2556
-40
lines changed

.github/actions/build-and-tag-locally/action.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,25 @@ runs:
166166

167167
- name: Run container
168168
shell: bash
169-
if: ${{ contains(fromJSON('["amd64", "i386"]'), steps.platform.outputs.display_name) }}
169+
if: ${{ contains(fromJSON('["amd64", "i386", "arm64"]'), steps.platform.outputs.display_name) }}
170170
run: |
171171
docker run -d --name sanity-test-${{ steps.platform.outputs.display_name }} ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
172172
173173
- name: Container Logs
174-
if: ${{ contains(fromJSON('["amd64", "i386"]'), steps.platform.outputs.display_name) }}
174+
if: ${{ contains(fromJSON('["amd64", "i386", "arm64"]'), steps.platform.outputs.display_name) }}
175175
shell: bash
176176
run: |
177177
docker logs sanity-test-${{ steps.platform.outputs.display_name }}
178178
179179
- name: Sanity Tests
180-
if: ${{ contains(fromJSON('["amd64", "i386"]'), steps.platform.outputs.display_name) }}
180+
if: ${{ contains(fromJSON('["amd64", "i386", "arm64"]'), steps.platform.outputs.display_name) }}
181181
shell: bash
182182
run: |
183183
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli ping
184184
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli info server
185185
186186
- name: Verify installed modules
187-
if: ${{ contains(fromJSON('["amd64"]'), steps.platform.outputs.display_name) }}
187+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
188188
shell: bash
189189
run: |
190190
modules=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli module list)
@@ -204,7 +204,7 @@ runs:
204204
fi
205205
206206
- name: Test RedisBloom
207-
if: ${{ contains(fromJSON('["amd64"]'), steps.platform.outputs.display_name) }}
207+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
208208
shell: bash
209209
run: |
210210
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.ADD popular_keys "redis:hash"
@@ -214,7 +214,7 @@ runs:
214214
echo "RedisBloom test passed successfully"
215215
216216
- name: Test RediSearch
217-
if: ${{ contains(fromJSON('["amd64"]'), steps.platform.outputs.display_name) }}
217+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
218218
shell: bash
219219
run: |
220220
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli FT.CREATE redis_commands ON HASH PREFIX 1 cmd: SCHEMA name TEXT SORTABLE description TEXT
@@ -229,7 +229,7 @@ runs:
229229
fi
230230
231231
- name: Test RedisTimeSeries
232-
if: ${{ contains(fromJSON('["amd64"]'), steps.platform.outputs.display_name) }}
232+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
233233
shell: bash
234234
run: |
235235
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.CREATE redis:cpu:usage RETENTION 86400
@@ -245,7 +245,7 @@ runs:
245245
fi
246246
247247
- name: Test ReJSON
248-
if: ${{ contains(fromJSON('["amd64"]'), steps.platform.outputs.display_name) }}
248+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
249249
shell: bash
250250
run: |
251251
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli JSON.SET redis:config $ '{"maxmemory":"2gb","maxmemory-policy":"allkeys-lru"}'
@@ -257,3 +257,32 @@ runs:
257257
echo "ReJSON test failed: expected 'allkeys-lru', got $result"
258258
exit 1
259259
fi
260+
- name: Test the entrypoint
261+
id: test_entrypoint
262+
if: ${{ contains(fromJSON('["amd64", "i386", "arm64"]'), steps.platform.outputs.display_name) }}
263+
shell: bash
264+
run: >
265+
cd test && env
266+
PLATFORM=${{ steps.platform.outputs.display_name }}
267+
REDIS_IMG=${{ github.sha }}:${{ steps.platform.outputs.display_name }}
268+
./run-entrypoint-tests.sh
269+
-- --output-junit-xml=report-entrypoint.xml
270+
271+
- name: Test Report
272+
uses: dorny/test-reporter@v2
273+
# run this step even if previous step failed, but not if it was skipped
274+
if: ${{ !cancelled() && steps.test_entrypoint.conclusion != 'skipped' }}
275+
with:
276+
name: Entrypoint Tests
277+
path: test/report-entrypoint.xml
278+
reporter: java-junit
279+
280+
- name: Push image
281+
uses: docker/build-push-action@v6
282+
if: ${{ inputs.publish_image == 'true' && contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
283+
with:
284+
context: ${{ inputs.distribution }}
285+
push: true
286+
tags: ${{ inputs.registry_repository }}:${{ github.sha }}-${{ inputs.distribution }}
287+
cache-from: type=gha
288+
cache-to: type=gha,mode=max

.github/workflows/pre-merge.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build-and-test:
10-
runs-on: 'ubuntu-latest'
10+
runs-on: ${{ contains(matrix.platform, 'arm64') && 'ubuntu24-arm64-2-8' || 'ubuntu-latest' }}
1111
strategy:
1212
fail-fast: false
1313
matrix:
@@ -23,7 +23,7 @@ jobs:
2323
- linux/mips64le
2424
- linux/ppc64le
2525
- linux/s390x
26-
# - linux/arm64 # Currently the unstable isn't running on arm64
26+
- linux/arm64
2727
- linux/riscv64
2828
exclude:
2929
- distribution: alpine
@@ -38,7 +38,7 @@ jobs:
3838
- name: Checkout code
3939
uses: actions/checkout@v4
4040
with:
41-
ref: unstable
41+
ref: ${{ github.event.pull_request && github.sha || 'unstable' }}
4242
- uses: ./.github/actions/build-and-tag-locally
4343
with:
4444
distribution: ${{ matrix.distribution }}

alpine/Dockerfile

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alpine/docker-entrypoint.sh

Lines changed: 116 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)