Skip to content

Commit

Permalink
Redis CE 8.0 Milestone 1 release for Debian
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
adamiBs committed Sep 12, 2024
1 parent a8b4897 commit ffb937f
Show file tree
Hide file tree
Showing 42 changed files with 641 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github/**
.git/**
.git*
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/*/**/Dockerfile linguist-generated
/*/**/docker-entrypoint.sh linguist-generated
/Dockerfile*.template linguist-language=Dockerfile
211 changes: 211 additions & 0 deletions .github/actions/build-and-tag-locally/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
name: Build and Test

inputs:
distribution:
description: "Distribution flavor"
default: "debian"
platform:
description: "Platform"
required: true
publish_image:
description: "Publish image to Docker Hub"
default: "false"
registry_username:
description: "Docker Hub username"
required: false
registry_password:
description: "Docker Hub password"
required: false
registry_repository:
description: 'Repository to push the image to'
required: false

runs:
using: "composite"
steps:
- name: Install QEMU
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Calculate architecture name
id: platform
shell: bash
run: |
case ${{ inputs.platform }} in
linux/amd64)
plaform_name="amd64"
;;
linux/arm64)
plaform_name="arm64"
;;
linux/arm/v5)
plaform_name="arm-v5"
;;
linux/arm/v7)
plaform_name="arm-v7"
;;
linux/i386)
plaform_name="i386"
;;
linux/mips64le)
plaform_name="mips64le"
;;
linux/ppc64le)
plaform_name="ppc64le"
;;
linux/s390x)
plaform_name="s390x"
;;
*)
echo "Architecture not supported: ${{ inputs.platform }}"
exit 1
;;
esac
echo "display_name=$plaform_name" >> "$GITHUB_OUTPUT"
- name: Clean up
shell: bash
run: |
docker rm -f sanity-test-${{ steps.platform.outputs.display_name }} || true
docker rmi -f ${{ github.sha }}:${{ steps.platform.outputs.display_name }} || true
- name: Docker Login
uses: docker/login-action@v3
if: inputs.publish_image == 'true'
with:
registry: ${{ inputs.registry_repository }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}

- name: Build
uses: docker/build-push-action@v6
with:
context: .
file: ${{ inputs.distribution }}/Dockerfile
push: false
load: true
platforms: ${{ inputs.platform }}
tags: ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Save image
shell: bash
run: |
docker save -o /tmp/image-${{ steps.platform.outputs.display_name }}.tar ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
- name: Upload image
uses: actions/upload-artifact@v4
with:
name: ${{ steps.platform.outputs.display_name }}-docker-image.tar
path: /tmp/image-${{ steps.platform.outputs.display_name }}.tar
retention-days: 45

- name: Run container
shell: bash
if: ${{ contains(fromJSON('["amd64", "arm64", "i386"]'), steps.platform.outputs.display_name) }}
run: |
docker run -d --name sanity-test-${{ steps.platform.outputs.display_name }} ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
- name: Container Logs
if: ${{ contains(fromJSON('["amd64", "arm64", "i386"]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
docker logs sanity-test-${{ steps.platform.outputs.display_name }}
- name: Sanity Tests
if: ${{ contains(fromJSON('["amd64", "arm64", "i386"]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli ping
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli info server
- name: Verify installed modules
if: ${{ contains(fromJSON('["amd64", "arm64",]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
modules=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli module list)
echo "Installed modules:"
echo "$modules"
missing_modules=()
for module in "bf" "search" "timeseries" "ReJSON"; do
if ! echo "$modules" | grep -q "$module"; then
missing_modules+=("$module")
fi
done
if [ ${#missing_modules[@]} -eq 0 ]; then
echo "All required modules are installed"
else
echo "The following modules are missing: ${missing_modules[*]}"
exit 1
fi
- name: Test RedisBloom
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.ADD popular_keys "redis:hash"
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli BF.ADD popular_keys "redis:set"
[ "$(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; }
[ "$(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; }
echo "RedisBloom test passed successfully"
- name: Test RediSearch
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
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
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli HSET cmd:set name "SET" description "Set the string value of a key"
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli HSET cmd:get name "GET" description "Get the value of a key"
result=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli FT.SEARCH redis_commands "value")
if echo "$result" | grep -q "Set the string value of a key" && echo "$result" | grep -q "Get the value of a key"; then
echo "RediSearch test passed successfully"
else
echo "RediSearch test failed: expected commands not found in search results"
exit 1
fi
- name: Test RedisTimeSeries
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.CREATE redis:cpu:usage RETENTION 86400
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.ADD redis:cpu:usage "*" 80
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.ADD redis:cpu:usage "*" 65
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.ADD redis:cpu:usage "*" 70
result=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli TS.RANGE redis:cpu:usage - + COUNT 3)
if echo "$result" | grep -q "80" && echo "$result" | grep -q "65" && echo "$result" | grep -q "70"; then
echo "RedisTimeSeries test passed successfully"
else
echo "RedisTimeSeries test failed: expected values not found in time series"
exit 1
fi
- name: Test ReJSON
if: ${{ contains(fromJSON('["amd64", "arm64"]'), steps.platform.outputs.display_name) }}
shell: bash
run: |
docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli JSON.SET redis:config $ '{"maxmemory":"2gb","maxmemory-policy":"allkeys-lru"}'
result=$(docker exec sanity-test-${{ steps.platform.outputs.display_name }} redis-cli JSON.GET redis:config $.maxmemory-policy)
cleaned_result=$(echo $result | tr -d '[]"')
if [ "$cleaned_result" = "allkeys-lru" ]; then
echo "ReJSON test passed successfully"
else
echo "ReJSON test failed: expected 'allkeys-lru', got $result"
exit 1
fi
- name: Push image
uses: docker/build-push-action@v6
if: ${{ inputs.publish_image == 'true' && contains(fromJSON('["amd64","arm64"]'), steps.platform.outputs.display_name) }}
with:
context: .
file: ${{ inputs.distribution }}/Dockerfile
push: true
tags: ${{ inputs.registry_repository }}:${{ github.sha }}-${{ inputs.distribution }}
cache-from: type=gha
cache-to: type=gha,mode=max
35 changes: 35 additions & 0 deletions .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Test
on:
pull_request:
branches:
- master
- release/*

jobs:
build-and-test:
runs-on: [ubuntu-latest]
strategy:
matrix:
distribution:
- debian
#- alpine
platform:
- linux/amd64
- linux/i386
- linux/arm/v5
- linux/arm/v7
- linux/mips64le
- linux/ppc64le
- linux/s390x
- linux/arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/build-and-tag-locally
with:
distribution: ${{ matrix.distribution }}
platform: ${{ matrix.platform }}
registry_username: ${{ vars.REGISTRY_USERNAME }}
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
publish_image: ${{ vars.PUBLISH_IMAGE }}
registry_repository: ${{ vars.REGISTRY_REPOSITORY }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.jq-template.awk
.DS_Store
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# https://github.com/docker-library/redis

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

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.
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.

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).

Expand All @@ -22,5 +22,3 @@ For outstanding `redis` image PRs, check [PRs with the "library/redis" label on
| [![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/) |
| [![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/) |
| [![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/) |

<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->
Loading

0 comments on commit ffb937f

Please sign in to comment.