Skip to content

Commit

Permalink
Merge pull request #1123 from RedisJSON/oshadmi_cp-master-to-2.6-2023…
Browse files Browse the repository at this point in the history
…1024_2

[2.6] MOD-5985: Cherry-pick from master towards v2.6.7
  • Loading branch information
oshadmi committed Oct 24, 2023
2 parents 99a598d + 30868af commit 22ce57d
Show file tree
Hide file tree
Showing 27 changed files with 514 additions and 206 deletions.
123 changes: 13 additions & 110 deletions .circleci/config.yml
Expand Up @@ -4,7 +4,7 @@ parameters:
run_default_flow:
default: true
type: boolean
run_benchmark_flow_label:
run_nightly_twice_a_week_flow_label:
default: false
type: boolean

Expand Down Expand Up @@ -81,7 +81,7 @@ commands:
parameters:
redis_version:
type: string
default: "7"
default: "7.2"
getredis_params:
type: string
default: ""
Expand Down Expand Up @@ -268,70 +268,6 @@ commands:
make publish OSNICK=<<parameters.platform>> VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH OFFICIAL=1 SHOW=1
- persist-artifacts

benchmark-steps:
parameters:
github_actor:
type: string
default: $CIRCLE_USERNAME
module_path:
type: string
default: bin/linux-x64-release/rejson.so
profile_env:
type: string
default: "0"
benchmark_glob:
type: string
default: "*.yml"
triggering_env:
type: string
default: "circleci"
allowed_envs:
type: string
default: "oss-standalone"
steps:
- run:
name: Prepare automation
command: |
./deps/readies/bin/getpy3
python3 -m pip install -r tests/benchmarks/requirements.txt
VERSION=0.14.8 ./deps/readies/bin/getterraform
- run:
name: Run CI benchmarks on aws
timeout: 60m
no_output_timeout: 30m
command: |
ROOT="$PWD"
cd tests/benchmarks
export AWS_ACCESS_KEY_ID=$PERFORMANCE_EC2_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=$PERFORMANCE_EC2_SECRET_KEY
export AWS_DEFAULT_REGION=$PERFORMANCE_EC2_REGION
export EC2_PRIVATE_PEM=$PERFORMANCE_EC2_PRIVATE_PEM
export PROFILE=<< parameters.profile_env >>
export BENCHMARK_GLOB=<< parameters.benchmark_glob >>
export PERF_CALLGRAPH_MODE="dwarf"
redisbench-admin run-remote \
--required-module ReJSON \
--module_path "$ROOT/<< parameters.module_path >>" \
--github_actor "<< parameters.github_actor >>" \
--github_repo $CIRCLE_PROJECT_REPONAME \
--github_org $CIRCLE_PROJECT_USERNAME \
--github_sha $CIRCLE_SHA1 \
--github_branch $CIRCLE_BRANCH \
--upload_results_s3 \
--fail_fast \
--triggering_env << parameters.triggering_env >> \
--push_results_redistimeseries \
--allowed-envs << parameters.allowed_envs >> || true
- run:
name: Generate Pull Request Performance info
command: |
if [[ -n ${CIRCLE_PULL_REQUEST##*/} ]]; then
redisbench-admin compare \
--defaults_filename ./tests/benchmarks/defaults.yml \
--comparison-branch $CIRCLE_BRANCH \
--auto-approve \
--pull-request ${CIRCLE_PULL_REQUEST##*/}
fi
#----------------------------------------------------------------------------------------------------------------------------------

jobs:
Expand Down Expand Up @@ -492,22 +428,6 @@ jobs:
name: Run QA Automation
command: ./tests/qa/qatests -m "$CIRCLE_TAG"

benchmark-json-oss-standalone:
docker:
- image: redisfab/rmbuilder:6.2.7-x64-focal
steps:
- build-steps
- benchmark-steps

benchmark-json-oss-standalone-profiler:
docker:
- image: redisfab/rmbuilder:6.2.7-x64-focal
steps:
- build-steps
- benchmark-steps:
profile_env: "1"
triggering_env: "circleci.profilers" # results generated with profilers attached are not mixed with the ones without it

#----------------------------------------------------------------------------------------------------------------------------------

on-any-branch: &on-any-branch
Expand Down Expand Up @@ -644,23 +564,7 @@ workflows:
context: common
requires:
- upload-release-artifacts
- benchmark-json-oss-standalone:
<<: *on-integ-and-version-tags
context: common
- benchmark-json-oss-standalone-profiler:
<<: *on-integ-and-version-tags
context: common

benchmark_flow_label:
when:
<< pipeline.parameters.run_benchmark_flow_label >>
jobs:
- benchmark-json-oss-standalone:
<<: *on-any-branch
context: common
- benchmark-json-oss-standalone-profiler:
<<: *on-any-branch
context: common

nightly:
triggers:
Expand All @@ -672,21 +576,18 @@ workflows:
name: build-with-redis-<<matrix.redis_version>>
matrix:
parameters:
redis_version: ["7", "unstable"]

nightly-perf-once-a-week:
triggers:
- schedule:
# “At 07:00 on Mondays.”
cron: "00 07 * * 1"
filters:
branches:
only: master
redis_version: ["7", "unstable"]

nightly-twice-a-week-by-param:
when:
<< pipeline.parameters.run_nightly_twice_a_week_flow_label >>
jobs:
- benchmark-json-oss-standalone:
- build-macos-x64:
context: common
- benchmark-json-oss-standalone-profiler:
upload: "yes"
- build-macos-m1:
context: common
upload: "yes"

nightly-twice-a-week:
triggers:
Expand All @@ -695,6 +596,8 @@ workflows:
<<: *on-integ-branch-cron
jobs:
- build-macos-x64:
context: common
upload: "yes"
- build-macos-m1:
context: common
upload: "yes"
34 changes: 34 additions & 0 deletions .github/workflows/backport_pr.yml
@@ -0,0 +1,34 @@
name: Backport merged pull request
on:
pull_request_target:
types: [closed]
issue_comment:
types: [created]
permissions:
contents: write # so it can comment
pull-requests: write # so it can create pull requests
jobs:
backport:
name: Backport pull request
runs-on: ubuntu-latest

# Only run when pull request is merged
# or when a comment containing `/backport` is created by someone other than the
# https://github.com/backport-action bot user (user id: 97796249). Note that if you use your
# own PAT as `github_token`, that you should replace this id with yours.
if: >
(
github.event.pull_request.merged
) || (
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.user.id != 97796249 &&
contains(github.event.comment.body, '/backport')
)
steps:
- uses: actions/checkout@v3
- name: Create backport pull requests
uses: korthout/backport-action@v1
with:
pull_title: '[${target_branch}] ${pull_title}'
merge_commits: 'skip'
118 changes: 118 additions & 0 deletions .github/workflows/benchmark-flow.yml
@@ -0,0 +1,118 @@
name: Run a Benchmark Flow

on:
workflow_call:
inputs:
container:
type: string
default: redisfab/rmbuilder:6.2.7-x64-focal
module_path:
type: string
default: bin/linux-x64-release/rejson.so
profile_env:
type: number # for default of 0
cluster_env:
type: string # for default of ""
benchmark_glob:
type: string
default: "*.yml"
triggering_env:
type: string
default: "circleci" # TODO: change to "github-actions" when ready on grafana
allowed_envs:
type: string
default: "oss-standalone"
allowed_setups:
type: string
benchmark_runner_group_member_id:
type: number
default: 1
benchmark_runner_group_total:
type: number
default: 1

jobs:
benchmark-steps:
runs-on: ubuntu-latest
container: ${{ inputs.container }}
steps:
- name: Checkout
uses: actions/checkout@v4
- run: |
git init
git config --global --add safe.directory '*'
git submodule update --init --recursive
- name: System setup
run: ./sbin/system-setup.py

- name: Get Redis
uses: actions/checkout@v4
with:
repository: redis/redis
ref: '7.2'
path: redis

- name: Build Redis
working-directory: redis
run: make install

- name: Build RedisJSON
run: |
. $HOME/.cargo/env
make build
- name: Prepare automation
run: |
./deps/readies/bin/getpy3
python3 -m pip install -r tests/benchmarks/requirements.txt
VERSION=0.14.8 ./deps/readies/bin/getterraform
- name: Run CI benchmarks on aws for envs ${{ inputs.allowed_envs }}
timeout-minutes: 240 # timeout for the step
working-directory: tests/benchmarks
continue-on-error: true
env:
# Hard-coded
PERF_CALLGRAPH_MODE: dwarf
MAX_PROFILERS: 1
# Secrets
AWS_ACCESS_KEY_ID: ${{ secrets.PERFORMANCE_EC2_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PERFORMANCE_EC2_SECRET_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.PERFORMANCE_EC2_REGION }}
EC2_PRIVATE_PEM: ${{ secrets.PERFORMANCE_EC2_PRIVATE_PEM }}
# Inputs
PROFILE: ${{ inputs.profile_env }}
BENCHMARK_GLOB: ${{ inputs.benchmark_glob }}
BENCHMARK_RUNNER_GROUP_M_ID: ${{ inputs.benchmark_runner_group_member_id }}
BENCHMARK_RUNNER_GROUP_TOTAL: ${{ inputs.benchmark_runner_group_total }}
run: redisbench-admin run-remote
--module_path ../../${{ inputs.module_path }}
--github_actor ${{ github.triggering_actor }}
--github_repo ${{ github.event.repository.name }}
--github_org ${{ github.repository_owner }}
--required-module ReJSON
--github_sha ${{ github.sha }}
--github_branch ${{ github.head_ref || github.ref_name }}
--upload_results_s3
--triggering_env ${{ inputs.triggering_env }}
--allowed-envs ${{ inputs.allowed_envs }}
--allowed-setups ${{ inputs.allowed_setups }}
--push_results_redistimeseries
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }}
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }}
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}'

- name: Generate Pull Request Performance info
if: github.event.number
env:
PERFORMANCE_GH_TOKEN: ${{ secrets.PERFORMANCE_GH_TOKEN }}
PERFORMANCE_WH_TOKEN: ${{ secrets.PERFORMANCE_WH_TOKEN }}
run: redisbench-admin compare
--defaults_filename ./tests/benchmarks/defaults.yml
--comparison-branch ${{ github.head_ref || github.ref_name }}
--auto-approve
--pull-request ${{ github.event.number }}
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }}
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }}
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}'
39 changes: 39 additions & 0 deletions .github/workflows/benchmark-runner.yml
@@ -0,0 +1,39 @@
name: Run RedisJSON Benchmarks

on:
workflow_dispatch:
inputs:
extended:
type: boolean
description: 'Run extended benchmarks'
default: false
workflow_call:
inputs:
extended:
type: boolean
default: false

jobs:
benchmark-json-oss-standalone:
strategy:
matrix:
member_id: [1, 2, 3]
uses: ./.github/workflows/benchmark-flow.yml
secrets: inherit
with:
benchmark_runner_group_member_id: ${{ matrix.member_id }}
benchmark_runner_group_total: ${{ strategy.job-total }}

benchmark-json-oss-standalone-profiler:
strategy:
matrix:
member_id: [1, 2, 3]
uses: ./.github/workflows/benchmark-flow.yml
secrets: inherit
with:
profile_env: 1
# TODO: change to "github-actions.profilers" when ready on grafana
triggering_env: "circleci.profilers" # results generated with profilers attached are not mixed with the ones without it
benchmark_runner_group_member_id: ${{ matrix.member_id }}
benchmark_runner_group_total: ${{ strategy.job-total }}

26 changes: 26 additions & 0 deletions .github/workflows/benchmark-trigger.yml
@@ -0,0 +1,26 @@
name: Check if needs trigger CircleCI benchmark

on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]

jobs:
haslabel:
name: analyse labels
runs-on: ubuntu-latest
outputs:
benchmark: ${{ steps.haslabel.outputs.labeled-run-benchmark }}
steps:
- uses: actions/checkout@v4
- name: Check if labeled with run-benchmark
id: haslabel
uses: DanielTamkin/HasLabel@v1.0.4
with:
contains: 'run-benchmark'

perf-ci:
name: Trigger
needs: haslabel
if: needs.haslabel.outputs.benchmark
uses: ./.github/workflows/benchmark-runner.yml
secrets: inherit

0 comments on commit 22ce57d

Please sign in to comment.