From 5394d802e2ecdf07be40ec4ced59e2f58ce28e44 Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Fri, 28 Jun 2024 12:34:07 -0700 Subject: [PATCH 1/2] Add bwc.checkout.align parameter support in gradle-check Signed-off-by: Rishabh Singh --- jenkins/gradle/gradle-check.jenkinsfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jenkins/gradle/gradle-check.jenkinsfile b/jenkins/gradle/gradle-check.jenkinsfile index bed22d1ea8..cf1dc1285d 100644 --- a/jenkins/gradle/gradle-check.jenkinsfile +++ b/jenkins/gradle/gradle-check.jenkinsfile @@ -7,7 +7,7 @@ * compatible open source license. */ -lib = library(identifier: 'jenkins@6.5.0', retriever: modernSCM([ +lib = library(identifier: 'jenkins@6.6.0', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -107,6 +107,7 @@ pipeline { echo("Build Cause: ${BUILD_CAUSE}") withCredentials([usernamePassword(credentialsId: CREDENTIAL_ID, usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) { + def bwc_checkout_align = "false" def dockerLogin = sh(returnStdout: true, script: "set +x && (echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin) || echo docker error").trim() @@ -117,12 +118,14 @@ pipeline { currentBuild.description = """runner: ${agent_name}
Others: ${pr_title}""" } else { - currentBuild.description = """runner: ${agent_name}
PR #${pr_number}: ${pr_title}""" + currentBuild.description = """runner: ${agent_name}
PR #${pr_number}: ${pr_title} with bwc.checkout.align=true""" + bwc_checkout_align = "true" } runGradleCheck( gitRepoUrl: "${pr_from_clone_url}", - gitReference: "${pr_from_sha}" + gitReference: "${pr_from_sha}", + bwcCheckoutAlign: "${bwc_checkout_align}" ) } else { @@ -132,7 +135,8 @@ pipeline { runGradleCheck( gitRepoUrl: "${GIT_REPO_URL}", - gitReference: "${GIT_REFERENCE}" + gitReference: "${GIT_REFERENCE}", + bwcCheckoutAlign: "${bwc_checkout_align}" ) } From f024ff336bad1e2974b75bf6e200bf796d999536 Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Tue, 2 Jul 2024 13:56:14 -0700 Subject: [PATCH 2/2] add new job for pull request benchmarks Signed-off-by: Rishabh Singh --- .../benchmark-pull-request.jenkinsfile | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 jenkins/opensearch/benchmark-pull-request.jenkinsfile diff --git a/jenkins/opensearch/benchmark-pull-request.jenkinsfile b/jenkins/opensearch/benchmark-pull-request.jenkinsfile new file mode 100644 index 0000000000..c1edf3f783 --- /dev/null +++ b/jenkins/opensearch/benchmark-pull-request.jenkinsfile @@ -0,0 +1,173 @@ +/* + * 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@main', retriever: modernSCM([ + + $class: 'GitSCMSource', + remote: 'https://github.com/rishabh6788/opensearch-build-libraries.git', +])) + +pipeline { + agent none + options { + timeout(time: 24, unit: 'HOURS') + buildDiscarder(logRotator(daysToKeepStr: '30')) + } + environment { + AGENT_LABEL = 'Jenkins-Agent-AL2023-X64-M52xlarge-Benchmark-Test' + JOB_NAME = 'pull-request-benchmark-test' + } + parameters { + password( + name: 'CLUSTER_ENDPOINT', + description: 'Provide an endpoint to a cluster for running benchmark tests against it.', + ) + booleanParam( + name: 'SECURITY_ENABLED', + description: 'Mention if the cluster is secured or insecured.', + defaultValue: false, + ) + password( + name: 'USERNAME', + description: 'Enter username for the cluster endpoint', + defaultValue: '' + ) + password( + name: 'PASSWORD', + description: 'Enter password for the cluster endpoint', + defaultValue: '' + ) + string( + name: 'TEST_WORKLOAD', + description: 'The workload name from OpenSearch Benchmark Workloads.', + defaultValue: 'nyc_taxis', + trim: 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 + ) + booleanParam( + name: 'CAPTURE_SEGMENT_REPLICATION_STAT', + description: 'Enable opensearch-benchmark segment-replication-stats telemetry to capture metrics such as replication lag.', + 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: 'CLUSTER_ENDPOINT', value: '$.CLUSTER_ENDPOINT'], + [key: 'SECURITY_ENABLED', value: '$.SECURITY_ENABLED'], + [key: 'USERNAME', value: '$.USERNAME'], + [key: 'PASSWORD', value: '$.PASSWORD'], + [key: 'TEST_WORKLOAD', value: '$.TEST_WORKLOAD'], + [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'] + ], + tokenCredentialId: 'jenkins-benchmark-generic-webhook-token', + causeString: 'Triggered by PR on OpenSearch core repository', + printContributedVariables: true, + printPostContent: true + ) + } + + stages { + stage('validate-and-set-parameters') { + agent { label AGENT_LABEL } + steps { + script { + if (CLUSTER_ENDPOINT == '') { + currentBuild.result = 'ABORTED' + error("Benchmark Tests failed to start. Provide CLUSTER_ENDPOINT to run tests") + } + } + } + post { + always { + postCleanup() + } + } + } + stage('benchmark-test-with-cluster') { + agent { label AGENT_LABEL } + steps { + script { + echo "security-enabled: ${SECURITY_ENABLED}" + + runBenchmarkTestScript( + endpoint: CLUSTER_ENDPOINT, + insecure: !(params.SECURITY_ENABLED), + username: USERNAME, + password: PASSWORD, + workload: TEST_WORKLOAD, + 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, + captureSegmentReplicationStat: CAPTURE_SEGMENT_REPLICATION_STAT, + telemetryParams: TELEMETRY_PARAMS + ) + stash includes: 'test_execution*.csv', name: "benchmark" + stash includes: 'test_execution*.json', name: "benchmark-json" + + } + } + post { + always { + unstash "benchmark" + unstash "benchmark-json" + archiveArtifacts artifacts: 'test_execution*.csv' + sh 'pwd' + sh 'ls -l' + postCleanup() + } + } + } + } +}