Skip to content

Commit c3ed883

Browse files
authored
ARM support (RedisJSON#550)
1 parent c7fd240 commit c3ed883

File tree

7 files changed

+72
-18
lines changed

7 files changed

+72
-18
lines changed

.circleci/config.yml

+59-5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ commands:
9393
cd tests/pytest/logs
9494
rm -f *.aof *.rdb
9595
fi
96+
when: always
9697
- store_artifacts:
9798
path: tests/pytest/logs
9899

@@ -194,14 +195,47 @@ commands:
194195
make publish OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH OFFICIAL=0 SHOW=1 VERBOSE=1
195196
- persist-artifacts
196197

198+
vm-build-platforms-steps:
199+
parameters:
200+
platform:
201+
type: string
202+
steps:
203+
- early-returns
204+
- checkout
205+
- setup-automation
206+
- run:
207+
name: Install Docker
208+
command: bash <(curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh)
209+
- run:
210+
name: Build for platform
211+
command: |
212+
ROOT=$PWD
213+
# make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1
214+
cd build/platforms
215+
make build OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH ARTIFACTS=1 TEST=1 SHOW=1
216+
cd $ROOT
217+
mkdir -p tests/pytest/logs
218+
tar -C tests/pytest/logs -xzf bin/artifacts/pytest-logs*.tgz
219+
no_output_timeout: 30m
220+
- save-tests-logs
221+
- early-return-for-forked-pull-requests
222+
- run:
223+
name: Build for platform (publish)
224+
command: |
225+
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
226+
# make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1 PUBLISH=1 DOCKERWRAPPER_EXTRA_VARS="DOCKER_PUSH_ONLY=1"
227+
cd build/platforms
228+
make publish OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH OFFICIAL=0 SHOW=1 VERBOSE=1
229+
- persist-artifacts
230+
197231
benchmark-steps:
198232
parameters:
199233
github_actor:
200234
type: string
201235
default: $CIRCLE_USERNAME
202236
module_path:
203237
type: string
204-
default: ../../target/release/rejson.so
238+
default: bin/linux-x64-release/rejson.so
205239
steps:
206240
- run:
207241
name: Install remote benchmark tool dependencies
@@ -215,15 +249,16 @@ commands:
215249
timeout: 60m
216250
no_output_timeout: 30m
217251
command: |
218-
cd ./tests/benchmarks
252+
ROOT="$PWD"
253+
cd tests/benchmarks
219254
export AWS_ACCESS_KEY_ID=$PERFORMANCE_EC2_ACCESS_KEY
220255
export AWS_SECRET_ACCESS_KEY=$PERFORMANCE_EC2_SECRET_KEY
221256
export AWS_DEFAULT_REGION=$PERFORMANCE_EC2_REGION
222257
export EC2_PRIVATE_PEM=$PERFORMANCE_EC2_PRIVATE_PEM
223258
224259
redisbench-admin run-remote \
225260
--required-module ReJSON \
226-
--module_path "<< parameters.module_path >>" \
261+
--module_path "$ROOT/<< parameters.module_path >>" \
227262
--github_actor "<< parameters.github_actor >>" \
228263
--github_repo $CIRCLE_PROJECT_REPONAME \
229264
--github_org $CIRCLE_PROJECT_USERNAME \
@@ -248,11 +283,22 @@ jobs:
248283
platform:
249284
type: string
250285
docker:
251-
- image: debian:buster
286+
- image: debian:bullseye
252287
steps:
253288
- platforms-build-steps:
254289
platform: <<parameters.platform>>
255290

291+
build-arm-platforms:
292+
parameters:
293+
platform:
294+
type: string
295+
machine:
296+
image: ubuntu-2004:202101-01
297+
resource_class: arm.medium
298+
steps:
299+
- vm-build-platforms-steps:
300+
platform: <<parameters.platform>>
301+
256302
build-macos:
257303
macos:
258304
xcode: 11.6.0
@@ -388,6 +434,12 @@ workflows:
388434
matrix:
389435
parameters:
390436
platform: [focal, bionic, xenial, centos8, centos7, bullseye]
437+
- build-arm-platforms:
438+
<<: *on-integ-and-version-tags
439+
context: common
440+
matrix:
441+
parameters:
442+
platform: [focal]
391443
- build-macos:
392444
<<: *on-integ-and-version-tags
393445
- deploy-artifacts:
@@ -397,15 +449,18 @@ workflows:
397449
<<: *on-integ-branch
398450
requires:
399451
- platforms-build
452+
- build-arm-platforms
400453
- build-macos
401454
- deploy-artifacts:
402455
name: deploy_release
403456
context: common
404457
<<: *on-version-tags
405458
requires:
406459
- platforms-build
460+
- build-arm-platforms
407461
- build-macos
408462
- release-automation:
463+
context: common
409464
<<: *on-version-tags
410465
requires:
411466
- deploy_release
@@ -425,4 +480,3 @@ workflows:
425480
jobs:
426481
- performance-automation:
427482
context: common
428-

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ RUN mkdir -p /var/opt/redislabs/artifacts
6969
RUN chown -R redis:redis /var/opt/redislabs
7070
COPY --from=builder /build/bin/artifacts/ /var/opt/redislabs/artifacts
7171
RUN true
72-
COPY --from=builder /build/target/release/rejson.so "$LIBDIR"
72+
COPY --from=builder /build/bin/linux-${ARCH}-release/rejson.so "$LIBDIR"
7373
RUN true
7474
COPY --from=builder /build/bin/redisearch.so "$LIBDIR"
7575

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ bench benchmark: $(TARGET)
197197
#----------------------------------------------------------------------------------------------
198198

199199
pack:
200-
$(SHOW)./sbin/pack.sh
200+
$(SHOW)MODULE=$(abspath $(TARGET)) ./sbin/pack.sh
201201

202202
.PHONY: pack
203203

build/docker/dockerfile.tmpl

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ RUN set -e ;\
2626
rm -f *.aof *.rdb ;\
2727
tar -czf /build/bin/artifacts/pytest-logs-{{REDIS_ARCH}}-{{REDIS_OSNICK}}.tgz .
2828
{% endif %}
29-
RUN BRANCH={{REDISEARCH_VERSION}} ./sbin/get-redisearch
29+
RUN BRANCH={{REDISEARCH_VERSION}} ./sbin/get-redisearch ;\
30+
cp /build/bin/linux-${REDIS_OSNICK}-${REDIS_ARCH}/RediSearch/redisearch.so /build/bin/
3031

3132
#----------------------------------------------------------------------------------------------
3233
FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}}
3334
WORKDIR /data
3435
{% set LIBDIR= "/usr/lib/redis/modules" %}
3536
RUN mkdir -p {{LIBDIR}}
3637

37-
COPY --from=builder /build/target/release/rejson.so {{LIBDIR}}/rejson.so
38-
COPY --from=builder /build/bin/linux-{{REDIS_OSNICK}}-{{REDIS_ARCH}}/RediSearch/module-enterprise.so {{LIBDIR}}/redisearch.so
38+
COPY --from=builder /build/bin/linux-${{REDIS_ARCH}}-release/rejson.so {{LIBDIR}}/rejson.so
39+
RUN true
40+
COPY --from=builder /build/bin/redisearch.so {{LIBDIR}}/redisearch.so
3941
RUN chown -R redis:redis {{LIBDIR}}
4042
EXPOSE 6379
4143
CMD ["redis-server", "--loadmodule", "{{LIBDIR}}/rejson.so", "--loadmodule", "{{LIBDIR}}/redisearch.so"]

build/platforms/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ RUN mkdir -p /var/opt/redislabs/artifacts
6464
RUN chown -R redis:redis /var/opt/redislabs
6565
COPY --from=builder /build/bin/artifacts/ /var/opt/redislabs/artifacts
6666
RUN true
67-
COPY --from=builder /build/target/release/rejson.so "$LIBDIR"
67+
COPY --from=builder /build/bin/linux-${ARCH}-release/rejson.so "$LIBDIR"
6868

6969
EXPOSE 6379
7070
CMD ["redis-server", \

deps/readies

sbin/pack.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ if [[ $1 == --help || $1 == help ]]; then
1616
[ARGVARS...] pack.sh [--help|help]
1717
1818
Argument variables:
19+
MODULE=path Path of module .so
20+
1921
RAMP=1|0 Build RAMP file
2022
DEPS=0|1 Build dependencies file
2123
SYM=0|1 Build debug symbols file
@@ -25,7 +27,6 @@ if [[ $1 == --help || $1 == help ]]; then
2527
GITSHA=1 Append Git SHA to shapshot package names
2628
2729
ARTDIR=dir Directory in which packages are created (default: bin/artifacts)
28-
BINDIR=dir Directory in which binaries are found (default: target/release)
2930
3031
VERBOSE=1 Print commands
3132
IGNERR=1 Do not abort on error
@@ -43,9 +44,6 @@ RAMP=${RAMP:-1}
4344
DEPS=${DEPS:-1}
4445
SYM=${SYM:-1}
4546

46-
[[ -z $BINDIR ]] && BINDIR=target/release
47-
BINDIR=$(cd $BINDIR && pwd)
48-
4947
[[ -z $ARTDIR ]] && ARTDIR=bin/artifacts
5048
mkdir -p $ARTDIR $ARTDIR/snapshots
5149
ARTDIR=$(cd $ARTDIR && pwd)
@@ -88,7 +86,7 @@ pack_ramp() {
8886
local fq_package=$stem.${verspec}.zip
8987

9088
local packfile="$ARTDIR/$fq_package"
91-
local product_so="$BINDIR/$PRODUCT.so"
89+
local product_so="$MODULE"
9290

9391
local xtx_vars=""
9492
local dep_fname=${PACKAGE_NAME}.${platform}.${verspec}.tgz
@@ -164,7 +162,7 @@ pack_deps() {
164162

165163
prepare_symbols_dep() {
166164
echo "Preparing debug symbols dependencies ..."
167-
echo $BINDIR > $ARTDIR/debug.dir
165+
echo $(cd "$(dirname $MODULE)" && pwd) > $ARTDIR/debug.dir
168166
echo $PRODUCT.so.debug > $ARTDIR/debug.files
169167
echo "" > $ARTDIR/debug.prefix
170168
pack_deps debug

0 commit comments

Comments
 (0)