Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
srudeepk committed Dec 4, 2024
0 parents commit dae9bdb
Show file tree
Hide file tree
Showing 982 changed files with 3,084,188 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Workspace Dockerfile",
// We have no context for the devcontainer.
"context": ".",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../docker/benchbase/devcontainer/Dockerfile",
"build": {
"args": {
"http_proxy": "${localEnv:http_proxy}",
"https_proxy": "${localEnv:https_proxy}",
"no_proxy": "${localEnv:no_proxy}",
"--tag": "benchbase-dev:latest"
},
"cacheFrom": "benchbase.azurecr.io/benchbase-dev:latest"
},
"initializeCommand": [
".devcontainer/scripts/initializeCommand"
],
"runArgs": [
// Allow us to resolve the host network from inside the devcontainer.
"--add-host=host.docker.internal:host-gateway",
// Secret injection as environment variables
// https://code.visualstudio.com/remote/advancedcontainers/environment-variables#_option-2-use-an-env-file
"--env-file=.env"
],
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker": {},
"ghcr.io/stuartleeks/dev-container-features/shell-history": {}
},
"containerEnv": {
"http_proxy": "${localEnv:http_proxy}",
"https_proxy": "${localEnv:https_proxy}",
"no_proxy": "${localEnv:no_proxy}",
"MAVEN_CONFIG_DIR": "${localEnv:HOME}/.m2",
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}",
"CONTAINER_WORKSPACE_FOLDER": "${containerWorkspaceFolder}"
},
// Set *default* container specific settings.json values on container create.
"customizations": {
"vscode": {
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"EditorConfig.EditorConfig",
"GitHub.copilot",
"eamodio.gitlens",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"huntertran.auto-markdown-toc",
"redhat.fabric8-analytics",
"vscjava.vscode-java-pack"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use the local maven cache.
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.m2,target=/home/containeruser/.m2,type=bind,consistency=cached"
],
"remoteUser": "containeruser",
"containerUser": "containeruser"
}
3 changes: 3 additions & 0 deletions .devcontainer/scripts/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
initializeCommand text eol=lf
initializeCommand.cmd text eol=crlf
initializeCommand.ps1 text eol=crlf
17 changes: 17 additions & 0 deletions .devcontainer/scripts/initializeCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -eu

set -x

scriptdir=$(dirname "$(readlink -f "$0")")
# Start in the root of the repository.
cd "$scriptdir/../../"

# Make sure the .env file exists for the devcontainer to load.
if [ ! -f .env ]; then
echo "Creating empty .env file for devcontainer."
touch .env
fi
# Attempt to pre-create the maven cache directory for bind mounting into the devcontainer.
mkdir -p ~/.m2 || true
2 changes: 2 additions & 0 deletions .devcontainer/scripts/initializeCommand.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd %~dp0/../../
powershell.exe -Version 3.0 -NoProfile .devcontainer/scripts/initializeCommand.ps1
16 changes: 16 additions & 0 deletions .devcontainer/scripts/initializeCommand.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Requires -Version 3.0
# A script to prepare the build/run environment for the devcontainer.

$ErrorActionPreference = 'Stop'

# Make sure we're in the root of the repository.
Set-Location "$PSScriptRoot/../../"

# Make sure the .env file exists for the devcontainer to load.
if (!(Test-Path -PathType Leaf '.env')) {
Write-Host "Creating empty .env file for devcontainer."
New-Item -ErrorAction SilentlyContinue -Type File -Name '.env'
}

# Attempt to pre-create the maven cache directory for bind mounting into the devcontainer.
New-Item -ErrorAction SilentlyContinue -Type Directory -Name ~/.m2
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

# Makefiles need tab indentation
[{Makefile,*.mk}]
indent_style = tab
tab_width = 8
end_of_line = lf

[{*.ps1,*.cmd,*.bat}]
end_of_line = crlf

[*.sh]
end_of_line = lf

[*.yml]
indent_size = 2

[*.java]
# https://google.github.io/styleguide/javaguide.html#s4.2-block-indentation
indent_size = 2
# https://google.github.io/styleguide/javaguide.html#s4.4-column-limit
max_line_length = 100
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enforce and apply Google Java Style formatting (#416)
56e3191bf8df94dcdf226ae814a9aa2c08b931b9
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 0
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "daily"
open-pull-requests-limit: 0
- package-ecosystem: "docker"
directory: "/docker/benchbase/devcontainer/"
schedule:
interval: "daily"
open-pull-requests-limit: 0
- package-ecosystem: "docker"
directory: "/docker/benchbase/fullimage/"
schedule:
interval: "daily"
open-pull-requests-limit: 0
136 changes: 136 additions & 0 deletions .github/workflows/dsqlmaven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: DSQL BenchBase Integ Test

on:
push:
branches: [ dsql ]
# Generate new docker images on release tags.
tags:
- 'v*'
pull_request:
branches: [ dsql ]
# Give us a button to allow running the workflow on demand for testing.
workflow_dispatch:
inputs:
tags:
description: 'Manual Workflow Run'
required: false
type: string

env:
POM_VERSION: 2023-SNAPSHOT
JAVA_VERSION: 21
ERRORS_THRESHOLD: 0.01

jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{env.JAVA_VERSION}}
cache: 'maven'
distribution: 'temurin'

- name: Check formatting
run: mvn -B fmt:check --file pom.xml

- name: Compile with Maven
run: mvn -B compile test-compile --file pom.xml

# Don't need testing, its done in maven.yml
# - name: Test exec plugin
# run: |
# mvn exec:java -P sqlite -Dexec.args="-b noop -c config/sqlite/sample_noop_config.xml --create=true --load=true --execute=true"

# - name: Test with Maven
# run: mvn -B test --file pom.xml

package-and-upload:
needs: compile
runs-on: ubuntu-latest
strategy:
matrix:
profile: [ 'auroradsql' ]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{env.JAVA_VERSION}}
cache: 'maven'
distribution: 'temurin'

- name: Package and verify with Maven
run: |
mvn -B package verify -P ${{matrix.profile}} --file pom.xml -DskipTests -D descriptors=src/main/assembly/tgz.xml
- name: Upload TGZ artifact
uses: actions/upload-artifact@v4
with:
name: benchbase-${{matrix.profile}}
path: target/benchbase-${{matrix.profile}}.tgz

## ----------------------------------------------------------------------------------
## AURORA DSQL
## ----------------------------------------------------------------------------------
auroradsql:
needs: package-and-upload
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
id-token: write # This is required for requesting the JWT
contents: read
strategy:
fail-fast: false
matrix:
benchmark: [ 'tpcc' ]
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: benchbase-auroradsql

- name: Extract artifact
run: |
tar xvzf benchbase-auroradsql.tgz --strip-components=1
- name: Delete artifact
run: |
rm -rf benchbase-auroradsql.tgz
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{env.JAVA_VERSION}}
distribution: 'temurin'

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.IAM_ROLE }}
aws-region: us-east-1

- name: Run benchmark
run: |
sed 's/localhost:5432/${{ secrets.CLUSTER_ENDPOINT }}:5432/g' config/auroradsql/sample_${{matrix.benchmark}}_config.xml > sample.xml
java -jar benchbase.jar -b ${{matrix.benchmark}} -c sample.xml -im 1000 -mt advanced --create=true --load=true --execute=true --json-histograms results/histograms.json
# FIXME: Reduce the error rate so we don't need these overrides.
results_benchmark=${{matrix.benchmark}}
./scripts/check_latest_benchmark_results.sh $results_benchmark
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD
# Running the monitor should create at least three files in the 'monitor' directory.
if ![ $(find "./results/monitor" -maxdepth 1 -mindepth 1 | wc -l) -gt 2]; then
echo "ERROR: Advanced monitoring unsuccessful, file directory and/or appropriate files not created." >&2
exit 1
fi
32 changes: 32 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Scan for leaked secrets

on:
push:
branches: [ to-be-upstreamed, dsql ]
tags:
- 'v*'
pull_request:
branches: [ to-be-upstreamed, dsql ]

jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
# Explicitly set permissions, following the principle of least privilege
actions: read
checks: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# For pull requests, check out the base branch, not the PR branch
ref: ${{ github.event.pull_request.base.sha }}
- name: gitleaks
uses: gitleaks/gitleaks-action@v1.6.0
env:
# GitHub Token automatically created on run
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit dae9bdb

Please sign in to comment.