Skip to content

Commit 8f1a23f

Browse files
authored
Redis CE 8.0 Milestone 1 release for Debian
- Change the repository structure of the project to support usage of release branches. - Save the legacy templating scripts in a separate directory. - Add a GitHub Actions workflow that builds and tests the Docker images. #409
1 parent a8b4897 commit 8f1a23f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+640
-6
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.github/**
2+
.git/**
3+
.git*

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/*/**/Dockerfile linguist-generated
22
/*/**/docker-entrypoint.sh linguist-generated
3-
/Dockerfile*.template linguist-language=Dockerfile
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
name: Build and Test
2+
3+
inputs:
4+
distribution:
5+
description: "Distribution flavor"
6+
default: "debian"
7+
platform:
8+
description: "Platform"
9+
required: true
10+
publish_image:
11+
description: "Publish image to Docker Hub"
12+
default: "false"
13+
registry_username:
14+
description: "Docker Hub username"
15+
required: false
16+
registry_password:
17+
description: "Docker Hub password"
18+
required: false
19+
registry_repository:
20+
description: 'Repository to push the image to'
21+
required: false
22+
23+
runs:
24+
using: "composite"
25+
steps:
26+
- name: Install QEMU
27+
shell: bash
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y qemu-user-static
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Calculate architecture name
35+
id: platform
36+
shell: bash
37+
run: |
38+
case ${{ inputs.platform }} in
39+
linux/amd64)
40+
plaform_name="amd64"
41+
;;
42+
linux/arm64)
43+
plaform_name="arm64"
44+
;;
45+
linux/arm/v5)
46+
plaform_name="arm-v5"
47+
;;
48+
linux/arm/v7)
49+
plaform_name="arm-v7"
50+
;;
51+
linux/i386)
52+
plaform_name="i386"
53+
;;
54+
linux/mips64le)
55+
plaform_name="mips64le"
56+
;;
57+
linux/ppc64le)
58+
plaform_name="ppc64le"
59+
;;
60+
linux/s390x)
61+
plaform_name="s390x"
62+
;;
63+
*)
64+
echo "Architecture not supported: ${{ inputs.platform }}"
65+
exit 1
66+
;;
67+
esac
68+
echo "display_name=$plaform_name" >> "$GITHUB_OUTPUT"
69+
70+
- name: Clean up
71+
shell: bash
72+
run: |
73+
docker rm -f sanity-test-${{ steps.platform.outputs.display_name }} || true
74+
docker rmi -f ${{ github.sha }}:${{ steps.platform.outputs.display_name }} || true
75+
76+
- name: Docker Login
77+
uses: docker/login-action@v3
78+
if: inputs.publish_image == 'true'
79+
with:
80+
registry: ${{ inputs.registry_repository }}
81+
username: ${{ inputs.registry_username }}
82+
password: ${{ inputs.registry_password }}
83+
84+
- name: Build
85+
uses: docker/build-push-action@v6
86+
with:
87+
context: .
88+
file: ${{ inputs.distribution }}/Dockerfile
89+
push: false
90+
load: true
91+
platforms: ${{ inputs.platform }}
92+
tags: ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
93+
cache-from: type=gha
94+
cache-to: type=gha,mode=max
95+
96+
- name: Save image
97+
shell: bash
98+
run: |
99+
docker save -o /tmp/image-${{ steps.platform.outputs.display_name }}.tar ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
100+
101+
- name: Upload image
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: ${{ steps.platform.outputs.display_name }}-docker-image.tar
105+
path: /tmp/image-${{ steps.platform.outputs.display_name }}.tar
106+
retention-days: 45
107+
108+
- name: Run container
109+
shell: bash
110+
if: ${{ contains(fromJSON('["amd64", "arm64", "i386"]'), steps.platform.outputs.display_name) }}
111+
run: |
112+
docker run -d --name sanity-test-${{ steps.platform.outputs.display_name }} ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
113+
114+
- name: Container Logs
115+
if: ${{ contains(fromJSON('["amd64", "arm64", "i386"]'), steps.platform.outputs.display_name) }}
116+
shell: bash
117+
run: |
118+
docker logs sanity-test-${{ steps.platform.outputs.display_name }}
119+
120+
- name: Sanity Tests
121+
if: ${{ contains(fromJSON('["amd64", "arm64", "i386"]'), steps.platform.outputs.display_name) }}
122+
shell: bash
123+
run: |
124+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli ping
125+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli info server
126+
127+
- name: Verify installed modules
128+
if: ${{ contains(fromJSON('["amd64", "arm64",]'), steps.platform.outputs.display_name) }}
129+
shell: bash
130+
run: |
131+
modules=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli module list)
132+
echo "Installed modules:"
133+
echo "$modules"
134+
missing_modules=()
135+
for module in "bf" "search" "timeseries" "ReJSON"; do
136+
if ! echo "$modules" | grep -q "$module"; then
137+
missing_modules+=("$module")
138+
fi
139+
done
140+
if [ ${#missing_modules[@]} -eq 0 ]; then
141+
echo "All required modules are installed"
142+
else
143+
echo "The following modules are missing: ${missing_modules[*]}"
144+
exit 1
145+
fi
146+
147+
- name: Test RedisBloom
148+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
149+
shell: bash
150+
run: |
151+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.ADD popular_keys "redis:hash"
152+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.ADD popular_keys "redis:set"
153+
[ "$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.EXISTS popular_keys "redis:hash")" = "1" ] || { echo "RedisBloom test failed: 'redis:hash' not found"; exit 1; }
154+
[ "$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.EXISTS popular_keys "redis:list")" = "0" ] || { echo "RedisBloom test failed: 'redis:list' found unexpectedly"; exit 1; }
155+
echo "RedisBloom test passed successfully"
156+
157+
- name: Test RediSearch
158+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
159+
shell: bash
160+
run: |
161+
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
162+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli HSET cmd:set name "SET" description "Set the string value of a key"
163+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli HSET cmd:get name "GET" description "Get the value of a key"
164+
result=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli FT.SEARCH redis_commands "value")
165+
if echo "$result" | grep -q "Set the string value of a key" && echo "$result" | grep -q "Get the value of a key"; then
166+
echo "RediSearch test passed successfully"
167+
else
168+
echo "RediSearch test failed: expected commands not found in search results"
169+
exit 1
170+
fi
171+
172+
- name: Test RedisTimeSeries
173+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
174+
shell: bash
175+
run: |
176+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.CREATE redis:cpu:usage RETENTION 86400
177+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.ADD redis:cpu:usage "*" 80
178+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.ADD redis:cpu:usage "*" 65
179+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.ADD redis:cpu:usage "*" 70
180+
result=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.RANGE redis:cpu:usage - + COUNT 3)
181+
if echo "$result" | grep -q "80" && echo "$result" | grep -q "65" && echo "$result" | grep -q "70"; then
182+
echo "RedisTimeSeries test passed successfully"
183+
else
184+
echo "RedisTimeSeries test failed: expected values not found in time series"
185+
exit 1
186+
fi
187+
188+
- name: Test ReJSON
189+
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
190+
shell: bash
191+
run: |
192+
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli JSON.SET redis:config $ '{"maxmemory":"2gb","maxmemory-policy":"allkeys-lru"}'
193+
result=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli JSON.GET redis:config $.maxmemory-policy)
194+
cleaned_result=$(echo $result | tr -d '[]"')
195+
if [ "$cleaned_result" = "allkeys-lru" ]; then
196+
echo "ReJSON test passed successfully"
197+
else
198+
echo "ReJSON test failed: expected 'allkeys-lru', got $result"
199+
exit 1
200+
fi
201+
202+
- name: Push image
203+
uses: docker/build-push-action@v6
204+
if: ${{ inputs.publish_image == 'true' && contains(fromJSON('["amd64","arm64"]'), steps.platform.outputs.display_name) }}
205+
with:
206+
context: .
207+
file: ${{ inputs.distribution }}/Dockerfile
208+
push: true
209+
tags: ${{ inputs.registry_repository }}:${{ github.sha }}-${{ inputs.distribution }}
210+
cache-from: type=gha
211+
cache-to: type=gha,mode=max

.github/workflows/pre-merge.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and Test
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- release/*
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: [ubuntu-latest]
11+
strategy:
12+
matrix:
13+
distribution:
14+
- debian
15+
#- alpine
16+
platform:
17+
- linux/amd64
18+
- linux/i386
19+
- linux/arm/v5
20+
- linux/arm/v7
21+
- linux/mips64le
22+
- linux/ppc64le
23+
- linux/s390x
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
- uses: ./.github/actions/build-and-tag-locally
28+
with:
29+
distribution: ${{ matrix.distribution }}
30+
platform: ${{ matrix.platform }}
31+
registry_username: ${{ vars.REGISTRY_USERNAME }}
32+
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
33+
publish_image: ${{ vars.PUBLISH_IMAGE }}
34+
registry_repository: ${{ vars.REGISTRY_REPOSITORY }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.jq-template.awk
1+
.DS_Store

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# https://github.com/docker-library/redis
22

3-
## Maintained by: [the Docker Community](https://github.com/docker-library/redis)
3+
## Maintained by: [Redis LTD](https://redis.io/)
44

5-
This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`redis`](https://hub.docker.com/_/redis/) (not to be confused with any official `redis` image provided by `redis` upstream). See [the Docker Hub page](https://hub.docker.com/_/redis/) for the full readme on how to use this Docker image and for information regarding contributing and issues.
5+
This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`redis`](https://hub.docker.com/_/redis/). See [the Docker Hub page](https://hub.docker.com/_/redis/) for the full `README` on how to use this Docker image and for information regarding contributing and issues.
66

77
The [full image description on Docker Hub](https://hub.docker.com/_/redis/) is generated/maintained over in [the docker-library/docs repository](https://github.com/docker-library/docs), specifically in [the `redis` directory](https://github.com/docker-library/docs/tree/master/redis).
88

@@ -22,5 +22,3 @@ For outstanding `redis` image PRs, check [PRs with the "library/redis" label on
2222
| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/redis.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/redis/) | [![arm32v5 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/redis.svg?label=arm32v5)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/redis/) | [![arm32v6 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/redis.svg?label=arm32v6)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/redis/) | [![arm32v7 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/redis.svg?label=arm32v7)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/redis/) |
2323
| [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/redis.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/redis/) | [![i386 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/i386/job/redis.svg?label=i386)](https://doi-janky.infosiftr.net/job/multiarch/job/i386/job/redis/) | [![mips64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/redis.svg?label=mips64le)](https://doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/redis/) | [![ppc64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/redis.svg?label=ppc64le)](https://doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/redis/) |
2424
| [![s390x build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/s390x/job/redis.svg?label=s390x)](https://doi-janky.infosiftr.net/job/multiarch/job/s390x/job/redis/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/redis.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/redis/) |
25-
26-
<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->

0 commit comments

Comments
 (0)