Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
zelinh committed Jul 15, 2024
2 parents 8cdc705 + 5124b1a commit d9f998a
Show file tree
Hide file tree
Showing 14 changed files with 680 additions and 44 deletions.
2 changes: 0 additions & 2 deletions jenkins/check-for-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ pipeline {
}
triggers {
parameterizedCron '''
H */6 * * * %INPUT_MANIFEST=1.3.18/opensearch-dashboards-1.3.18.yml;TARGET_JOB_NAME=distribution-build-opensearch-dashboards;BUILD_PLATFORM=linux windows;BUILD_DISTRIBUTION=tar rpm deb zip
H 1 * * * %INPUT_MANIFEST=2.15.1/opensearch-2.15.1.yml;TARGET_JOB_NAME=distribution-build-opensearch;BUILD_PLATFORM=linux macos windows;BUILD_DISTRIBUTION=tar rpm deb zip
H 1 * * * %INPUT_MANIFEST=2.16.0/opensearch-dashboards-2.16.0.yml;TARGET_JOB_NAME=distribution-build-opensearch-dashboards;BUILD_PLATFORM=linux windows;BUILD_DISTRIBUTION=tar rpm deb zip
H 1 * * * %INPUT_MANIFEST=2.16.0/opensearch-2.16.0.yml;TARGET_JOB_NAME=distribution-build-opensearch;BUILD_PLATFORM=linux macos windows;BUILD_DISTRIBUTION=tar rpm deb zip
H */6 * * * %INPUT_MANIFEST=1.3.18/opensearch-1.3.18.yml;TARGET_JOB_NAME=distribution-build-opensearch;BUILD_PLATFORM=linux macos windows;BUILD_DISTRIBUTION=tar rpm deb zip
H 1 * * * %INPUT_MANIFEST=3.0.0/opensearch-3.0.0.yml;TARGET_JOB_NAME=distribution-build-opensearch;BUILD_PLATFORM=linux macos windows;BUILD_DISTRIBUTION=tar rpm deb zip
H 1 * * * %INPUT_MANIFEST=3.0.0/opensearch-dashboards-3.0.0.yml;TARGET_JOB_NAME=distribution-build-opensearch-dashboards;BUILD_PLATFORM=linux windows;BUILD_DISTRIBUTION=tar rpm deb zip
'''
Expand Down
296 changes: 296 additions & 0 deletions jenkins/opensearch/benchmark-pull-request.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

lib = library(identifier: 'jenkins@6.4.3', retriever: modernSCM([

$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
agent {label 'Jenkins-Agent-AL2023-X64-M52xlarge-Benchmark-Test'}
options {
timeout(time: 24, unit: 'HOURS')
buildDiscarder(logRotator(daysToKeepStr: '30'))
}
environment {
JOB_NAME = 'pull-request-benchmark-test'
}
parameters {
string(
name: 'DISTRIBUTION_URL',
description: 'Publicly available download url of the OpenSearch artifact tarball. Currently only supports x64 arch.',
)
string(
name: 'DISTRIBUTION_VERSION',
description: 'The distribution version of of the OpenSearch artifact, only to be provided in combination with DISTRIBUTION_URL param.',
trim: true
)
booleanParam(
name: 'SECURITY_ENABLED',
description: 'Mention if the cluster is secured or insecured.',
defaultValue: false,
)
booleanParam(
name: 'SINGLE_NODE_CLUSTER',
description: 'Benchmark test on a single node cluster',
defaultValue: true
)
booleanParam(
name: 'MIN_DISTRIBUTION',
description: 'Use OpenSearch min distribution',
defaultValue: false
)
string(
name: 'TEST_WORKLOAD',
description: 'The workload name from OpenSearch Benchmark Workloads.',
defaultValue: 'nyc_taxis',
trim: true
)
string(
name: 'MANAGER_NODE_COUNT',
description: 'Number of cluster manager nodes, empty value defaults to 3.',
trim: true
)
string(
name: 'DATA_NODE_COUNT',
description: 'Number of cluster data nodes, empty value defaults to 2.',
trim: true
)
string(
name: 'CLIENT_NODE_COUNT',
description: 'Number of cluster client nodes, empty value default to 0.',
trim: true
)
string(
name: 'INGEST_NODE_COUNT',
description: 'Number of cluster INGEST nodes, empty value defaults to 0.',
trim: true
)
string(
name: 'ML_NODE_COUNT',
description: 'Number of cluster ml nodes, empty value defaults to 0.',
trim: true
)
string(
name: 'DATA_INSTANCE_TYPE',
description: 'EC2 instance type for data node, empty defaults to r5.xlarge.',
trim: true
)
string(
name: 'DATA_NODE_STORAGE',
description: 'Data node ebs block storage size, empty value defaults to 100Gb',
trim: true
)
string(
name: 'ML_NODE_STORAGE',
description: 'ML node ebs block storage size, empty value defaults to 100Gb',
trim: true
)
string(
name: 'JVM_SYS_PROPS',
description: 'A comma-separated list of key=value pairs that will be added to jvm.options as JVM system properties.',
trim: true
)
string(
name: 'ADDITIONAL_CONFIG',
description: 'Additional opensearch.yml config parameters passed as JSON. e.g., `opensearch.experimental.feature.segment_replication_experimental.enabled:true cluster.indices.replication.strategy:SEGMENT`',
trim: true
)
booleanParam(
name: 'USE_50_PERCENT_HEAP',
description: 'Use 50 percent of physical memory as heap.',
defaultValue: true
)
string(
name: 'USER_TAGS',
description: 'Attach arbitrary text to the meta-data of each benchmark metric record, without any spaces. e.g., `run-type:adhoc,segrep:enabled,arch:x64`. ',
trim: true
)
string(
name: 'WORKLOAD_PARAMS',
description: 'With this parameter you can inject variables into workloads. Use json type. e.g., `{"number_of_replicas":"1","number_of_shards":"5"}`',
trim: true
)
string(
name: 'TEST_PROCEDURE',
description: 'Defines a test procedure to use. e.g., `append-no-conflicts,significant-text`',
trim: true
)
string(
name: 'EXCLUDE_TASKS',
description: 'Defines a comma-separated list of test procedure tasks not to run. Default runs all. e.g., `type:search,delete-index`',
trim: true
)
string(
name: 'INCLUDE_TASKS',
description: 'Defines a comma-separated list of test procedure tasks to run. Default runs all. e.g., `type:search,delete-index`',
trim: true
)
booleanParam(
name: 'CAPTURE_NODE_STAT',
description: 'Enable opensearch-benchmark node-stats telemetry to capture system level metrics.',
defaultValue: false
)
string(
name: 'TELEMETRY_PARAMS',
description: 'Allows to set parameters for telemetry devices. Use json type. e.g.,{"node-stats-include-indices":"true","node-stats-include-indices-metrics":"segments"}',
trim: true
)
}
triggers {
GenericTrigger(
genericVariables: [
[key: 'pull_request_number', value: '$.pull_request_number'],
[key: 'repository', value: '$.repository'],
[key: 'DISTRIBUTION_URL', value: '$.DISTRIBUTION_URL'],
[key: 'DISTRIBUTION_VERSION', value: '$.DISTRIBUTION_VERSION'],
[key: 'TEST_WORKLOAD', value: '$.TEST_WORKLOAD'],
[key: 'SECURITY_ENABLED', value: '$.SECURITY_ENABLED'],
[key: 'SINGLE_NODE_CLUSTER', value: '$.SINGLE_NODE_CLUSTER'],
[key: 'MIN_DISTRIBUTION', value: '$.MIN_DISTRIBUTION'],
[key: 'MANAGER_NODE_COUNT', value: '$.MANAGER_NODE_COUNT'],
[key: 'DATA_NODE_COUNT', value: '$.DATA_NODE_COUNT'],
[key: 'CLIENT_NODE_COUNT', value: '$.CLIENT_NODE_COUNT'],
[key: 'INGEST_NODE_COUNT', value: '$.INGEST_NODE_COUNT'],
[key: 'ML_NODE_COUNT', value: '$.ML_NODE_COUNT'],
[key: 'DATA_INSTANCE_TYPE', value: '$.DATA_INSTANCE_TYPE'],
[key: 'DATA_NODE_STORAGE', value: '$.DATA_NODE_STORAGE'],
[key: 'ML_NODE_STORAGE', value: '$.ML_NODE_STORAGE'],
[key: 'JVM_SYS_PROPS', value: '$.JVM_SYS_PROPS'],
[key: 'ADDITIONAL_CONFIG', value: '$.ADDITIONAL_CONFIG'],
[key: 'USE_50_PERCENT_HEAP', value: '$.USE_50_PERCENT_HEAP'],
[key: 'USER_TAGS', value: '$.USER_TAGS'],
[key: 'WORKLOAD_PARAMS', value: '$.WORKLOAD_PARAMS'],
[key: 'TEST_PROCEDURE', value: '$.TEST_PROCEDURE'],
[key: 'EXCLUDE_TASKS', value: '$.EXCLUDE_TASKS'],
[key: 'INCLUDE_TASKS', value: '$.INCLUDE_TASKS'],
[key: 'CAPTURE_NODE_STAT', value: '$.CAPTURE_NODE_STAT'],
[key: 'TELEMETRY_PARAMS', value: '$.TELEMETRY_PARAMS']
],
tokenCredentialId: 'jenkins-pr-benchmark-generic-webhook-token',
causeString: 'Triggered by comment on PR on OpenSearch core repository',
printContributedVariables: true,
printPostContent: true
)
}

stages {
stage('validate-and-set-parameters') {
steps {
script {
if (DISTRIBUTION_URL == '' || DISTRIBUTION_VERSION == '') {
currentBuild.result = 'ABORTED'
error("Benchmark Tests failed to start. Provide DISTRIBUTION_URL and DISTRIBUTION_VERSION to run tests")
}
env.ARCHITECTURE = "x64"
lib.jenkins.Messages.new(this).add(JOB_NAME, "Benchmark tests for ${DISTRIBUTION_URL}")
if (currentBuild.rawBuild.getCauses().toString().contains("GenericCause")) {
currentBuild.description = "Benchmark initiated by PR:${pull_request_number} on ${repository}"
}
else {
currentBuild.description = "Running benchmark test for distribution-url: ${DISTRIBUTION_URL} distribution-version: ${DISTRIBUTION_VERSION}"
}
}
}
}
stage('benchmark-pull-request') {
steps {
script {
echo "security-enabled: ${SECURITY_ENABLED}"

runBenchmarkTestScript(
distributionUrl: DISTRIBUTION_URL,
distributionVersion: DISTRIBUTION_VERSION,
workload: TEST_WORKLOAD,
insecure: !(params.SECURITY_ENABLED),
singleNode: SINGLE_NODE_CLUSTER,
minDistribution: MIN_DISTRIBUTION,
use50PercentHeap: USE_50_PERCENT_HEAP,
managerNodeCount: MANAGER_NODE_COUNT,
dataNodeCount: DATA_NODE_COUNT,
clientNodeCount: CLIENT_NODE_COUNT,
ingestNodeCount: INGEST_NODE_COUNT,
mlNodeCount: ML_NODE_COUNT,
dataInstanceType: DATA_INSTANCE_TYPE,
additionalConfig: ADDITIONAL_CONFIG,
dataStorageSize: DATA_NODE_STORAGE,
mlStorageSize: ML_NODE_STORAGE,
jvmSysProps: JVM_SYS_PROPS,
userTag: USER_TAGS.isEmpty() ? "security-enabled:${SECURITY_ENABLED}" : "${USER_TAGS},security-enabled:${SECURITY_ENABLED}",
suffix: "${BUILD_NUMBER}",
workloadParams: WORKLOAD_PARAMS,
testProcedure: TEST_PROCEDURE,
excludeTasks: EXCLUDE_TASKS,
includeTasks: INCLUDE_TASKS,
captureNodeStat: CAPTURE_NODE_STAT,
telemetryParams: TELEMETRY_PARAMS
)

sh "cp /tmp/final_result_${BUILD_NUMBER}.md final_result_${BUILD_NUMBER}.md"
}
}
post {
success {
sh "sed -i '1i\\#### Benchmark Results for Job: ${BUILD_URL}' final_result_${BUILD_NUMBER}.md"
script {
if (currentBuild.rawBuild.getCauses().toString().contains("GenericCause")) {
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) {
def pull_request = Integer.parseInt("${pull_request_number}")
sh ("gh pr comment ${pull_request} --repo ${repository} --body-file final_result_${BUILD_NUMBER}.md")
}
}
}
postCleanup()

}
failure {
script {
if (currentBuild.rawBuild.getCauses().toString().contains("GenericCause")) {
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) {
def pull_request = Integer.parseInt("${pull_request_number}")
sh ("gh pr comment ${pull_request} --repo ${repository} --body The benchmark job ${BUILD_URL} failed.\n Please see logs to debug.")
}
}
}

}
aborted {
script {
def stackNames = [
"opensearch-infra-stack-${BUILD_NUMBER}"
]
withCredentials([string(credentialsId: 'perf-test-account-id', variable: 'PERF_TEST_ACCOUNT_ID')]) {
withAWS(role: 'cfn-set-up', roleAccount: "${PERF_TEST_ACCOUNT_ID}", duration: 900, roleSessionName: 'jenkins-session', region: 'us-east-1') {
try {
for (String stackName : stackNames) {
def stack = null
try {
stack = cfnDescribe(stack: stackName)
} catch (Exception) {
echo "Stack '${stackName}' does not exist, nothing to remove"
}
if (stack != null) {
echo "Deleting stack '${stackName}'"
cfnDelete(stack: stackName, pollInterval:1000)
}
}
} catch (Exception e) {
error "Exception occurred while deleting the CloudFormation stack: ${e.toString()}"
}
}
}
}
postCleanup()

}
}
}
}
}
2 changes: 2 additions & 0 deletions jenkins/opensearch/benchmark-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pipeline {
H 4 * * * %BUNDLE_MANIFEST_URL=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.16.0/latest/linux/x64/tar/dist/opensearch/manifest.yml;SINGLE_NODE_CLUSTER=false;DATA_NODE_COUNT=3;USE_50_PERCENT_HEAP=true;USER_TAGS=run-type:nightly,segrep:disabled,arch:x64,instance-type:r5.xlarge,major-version:2x,cluster-config:x64-r5.xlarge-3-data-3-shards-0-replica;WORKLOAD_PARAMS={"number_of_replicas":"0","number_of_shards":"3"};EXCLUDE_TASKS=type:search
H 4 * * * %BUNDLE_MANIFEST_URL=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.16.0/latest/linux/x64/tar/dist/opensearch/manifest.yml;SINGLE_NODE_CLUSTER=false;DATA_NODE_COUNT=3;USE_50_PERCENT_HEAP=true;CAPTURE_SEGMENT_REPLICATION_STAT=true;USER_TAGS=run-type:nightly,segrep:enabled,arch:x64,instance-type:r5.xlarge,major-version:2x,cluster-config:x64-r5.xlarge-3-data-3-shards-0-replica;ADDITIONAL_CONFIG=cluster.indices.replication.strategy:SEGMENT;WORKLOAD_PARAMS={"number_of_replicas":"0","number_of_shards":"3"};EXCLUDE_TASKS=type:search

H 5 * * * %DISTRIBUTION_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.11.1/opensearch-2.11.1-linux-x64.tar.gz;DISTRIBUTION_VERSION=2.11.1;TEST_WORKLOAD=big5;SINGLE_NODE_CLUSTER=true;DATA_INSTANCE_TYPE=c5.2xlarge;USE_50_PERCENT_HEAP=true;USER_TAGS=run-type:nightly,segrep:disabled,arch:x64,instance-type:c5.2xlarge,major-version:2x,cluster-config:x64-c5.2xlarge-1-shard-0-replica-snapshot;WORKLOAD_PARAMS={"snapshot_repo_name":"benchmark-workloads-repo-211","snapshot_bucket_name":"benchmark-workload-snapshots","snapshot_region":"us-east-1","snapshot_base_path":"workload-snapshots-211","snapshot_name":"big5_1_shard"};TEST_PROCEDURE=restore-from-snapshot;CAPTURE_NODE_STAT=true
H 5 * * * %DISTRIBUTION_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.7.0/opensearch-2.7.0-linux-x64.tar.gz;DISTRIBUTION_VERSION=2.7.0;TEST_WORKLOAD=big5;SINGLE_NODE_CLUSTER=true;DATA_INSTANCE_TYPE=c5.2xlarge;USE_50_PERCENT_HEAP=true;USER_TAGS=run-type:nightly,segrep:disabled,arch:x64,instance-type:c5.2xlarge,major-version:2x,cluster-config:x64-c5.2xlarge-1-shard-0-replica-snapshot;WORKLOAD_PARAMS={"snapshot_repo_name":"benchmark-workloads-repo-270","snapshot_bucket_name":"benchmark-workload-snapshots","snapshot_region":"us-east-1","snapshot_base_path":"workload-snapshots-270","snapshot_name":"big5_1_shard"};TEST_PROCEDURE=restore-from-snapshot;CAPTURE_NODE_STAT=true
H 5 * * * %DISTRIBUTION_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.12.0/opensearch-2.12.0-linux-x64.tar.gz;DISTRIBUTION_VERSION=2.12.0;TEST_WORKLOAD=big5;SINGLE_NODE_CLUSTER=true;DATA_INSTANCE_TYPE=c5.2xlarge;USE_50_PERCENT_HEAP=true;USER_TAGS=run-type:nightly,segrep:disabled,arch:x64,instance-type:c5.2xlarge,major-version:2x,cluster-config:x64-c5.2xlarge-1-shard-0-replica-snapshot;WORKLOAD_PARAMS={"snapshot_repo_name":"benchmark-workloads-repo","snapshot_bucket_name":"benchmark-workload-snapshots","snapshot_region":"us-east-1","snapshot_base_path":"workload-snapshots","snapshot_name":"big5_1_shard"};TEST_PROCEDURE=restore-from-snapshot;CAPTURE_NODE_STAT=true
H 5 * * * %DISTRIBUTION_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.13.0/opensearch-2.13.0-linux-x64.tar.gz;DISTRIBUTION_VERSION=2.13.0;TEST_WORKLOAD=big5;SINGLE_NODE_CLUSTER=true;DATA_INSTANCE_TYPE=c5.2xlarge;USE_50_PERCENT_HEAP=true;USER_TAGS=run-type:nightly,segrep:disabled,arch:x64,instance-type:c5.2xlarge,major-version:2x,cluster-config:x64-c5.2xlarge-1-shard-0-replica-snapshot;WORKLOAD_PARAMS={"snapshot_repo_name":"benchmark-workloads-repo","snapshot_bucket_name":"benchmark-workload-snapshots","snapshot_region":"us-east-1","snapshot_base_path":"workload-snapshots","snapshot_name":"big5_1_shard"};TEST_PROCEDURE=restore-from-snapshot;CAPTURE_NODE_STAT=true
H 5 * * * %DISTRIBUTION_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.14.0/opensearch-2.14.0-linux-x64.tar.gz;DISTRIBUTION_VERSION=2.14.0;TEST_WORKLOAD=big5;SINGLE_NODE_CLUSTER=true;DATA_INSTANCE_TYPE=c5.2xlarge;USE_50_PERCENT_HEAP=true;USER_TAGS=run-type:nightly,segrep:disabled,arch:x64,instance-type:c5.2xlarge,major-version:2x,cluster-config:x64-c5.2xlarge-1-shard-0-replica-snapshot;WORKLOAD_PARAMS={"snapshot_repo_name":"benchmark-workloads-repo","snapshot_bucket_name":"benchmark-workload-snapshots","snapshot_region":"us-east-1","snapshot_base_path":"workload-snapshots","snapshot_name":"big5_1_shard"};TEST_PROCEDURE=restore-from-snapshot;CAPTURE_NODE_STAT=true
Expand Down
Loading

0 comments on commit d9f998a

Please sign in to comment.