-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Jenkins CI for CCR Performance tests
Signed-off-by: Ankit Kala <ankikala@amazon.com>
- Loading branch information
Showing
13 changed files
with
300 additions
and
60 deletions.
There are no files selected for viewing
141 changes: 141 additions & 0 deletions
141
jenkins/cross-cluster-replication/perf-test.jenkinsfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm)) | ||
|
||
pipeline { | ||
agent none | ||
options { | ||
timeout(time: 10, unit: 'HOURS') | ||
} | ||
environment { | ||
AGENT_LABEL = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' | ||
AGENT_IMAGE = 'opensearchstaging/ci-runner:ci-runner-centos7-v1' | ||
BUNDLE_MANIFEST = 'bundle-manifest.yml' | ||
JOB_NAME = 'ccr-perf-test' | ||
} | ||
parameters { | ||
string( | ||
name: 'GITHUB_TOKEN', | ||
description: 'Github token for account access.', | ||
trim: true | ||
) | ||
string( | ||
name: 'BUNDLE_MANIFEST_URL', | ||
description: 'The bundle manifest URL, e.g. https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.2.2/98/linux/x64/builds/opensearch/manifest.yml.', | ||
trim: true | ||
) | ||
} | ||
|
||
stages { | ||
stage('validate-and-set-parameters') { | ||
agent { | ||
docker { | ||
label AGENT_LABEL | ||
image AGENT_IMAGE | ||
alwaysPull true | ||
} | ||
} | ||
steps { | ||
script { | ||
if (BUNDLE_MANIFEST_URL == '') { | ||
currentBuild.result = 'ABORTED' | ||
error("Performance Tests failed to start. Missing parameter: BUNDLE_MANIFEST_URL.") | ||
} | ||
if (GITHUB_TOKEN == '') { | ||
currentBuild.result = 'ABORTED' | ||
error("Performance Tests failed to start. Missing parameter: GITHUB_TOKEN.") | ||
} | ||
def bundleManifestObj = downloadBuildManifest( | ||
url: BUNDLE_MANIFEST_URL, | ||
path: BUNDLE_MANIFEST | ||
) | ||
String buildId = bundleManifestObj.getArtifactBuildId() | ||
env.BUILD_ID = buildId | ||
env.HAS_SECURITY = bundleManifestObj.components.containsKey("security") | ||
env.ARCHITECTURE = bundleManifestObj.getArtifactArchitecture() | ||
echo "HAS_SECURITY: ${env.HAS_SECURITY}" | ||
lib.jenkins.Messages.new(this).add(JOB_NAME, "CCR Performance tests for #${BUILD_ID}") | ||
} | ||
} | ||
} | ||
stage('perf-test') { | ||
agent { | ||
docker { | ||
label AGENT_LABEL | ||
image AGENT_IMAGE | ||
alwaysPull true | ||
} | ||
} | ||
when { | ||
expression { return env.HAS_SECURITY } | ||
} | ||
steps { | ||
script { | ||
def bundleManifestObj = downloadBuildManifest( | ||
url: BUNDLE_MANIFEST_URL, | ||
path: BUNDLE_MANIFEST | ||
) | ||
echo "BUNDLE_MANIFEST: ${BUNDLE_MANIFEST}" | ||
echo "BUILD_ID: ${BUILD_ID}" | ||
echo "Architecture: ${ARCHITECTURE}" | ||
|
||
runPerfTestScript(bundleManifest: BUNDLE_MANIFEST, | ||
buildId: BUILD_ID, | ||
architecture: ARCHITECTURE, | ||
component: "cross-cluster-replication") | ||
|
||
lib.jenkins.Messages.new(this).add(JOB_NAME, | ||
lib.jenkins.Messages.new(this).get([JOB_NAME]) + | ||
"\nCCR Performance tests for ${BUILD_ID} completed") | ||
} | ||
} | ||
post { | ||
success { | ||
script { | ||
uploadTestResults( | ||
buildManifestFileName: BUNDLE_MANIFEST, | ||
jobName: JOB_NAME, | ||
buildNumber: BUILD_ID | ||
) | ||
} | ||
postCleanup() | ||
} | ||
failure { | ||
postCleanup() | ||
} | ||
aborted { | ||
postCleanup() | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
success { | ||
node(AGENT_LABEL) { | ||
script { | ||
def stashed = lib.jenkins.Messages.new(this).get([JOB_NAME]) | ||
publishNotification( | ||
icon: ':white_check_mark:', | ||
message: 'CCR Performance Tests Successful', | ||
extra: stashed, | ||
credentialsId: 'INTEG_TEST_WEBHOOK', | ||
) | ||
postCleanup() | ||
} | ||
} | ||
} | ||
failure { | ||
node(AGENT_LABEL) { | ||
script { | ||
def stashed = lib.jenkins.Messages.new(this).get([JOB_NAME]) | ||
publishNotification( | ||
icon: ':warning:', | ||
message: 'Failed CCR Performance Tests', | ||
extra: stashed, | ||
credentialsId: 'INTEG_TEST_WEBHOOK', | ||
) | ||
postCleanup() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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. | ||
|
||
class PerfTestClusterConfig(): | ||
""" | ||
Maintains the cluster level configuration. | ||
""" | ||
def __init__(self, security=False, data_nodes=1, master_nodes=0, ingest_nodes=0, client_nodes=0): | ||
self.security = security | ||
self.data_nodes = data_nodes | ||
self.master_nodes = master_nodes | ||
self.ingest_nodes = ingest_nodes | ||
self.client_nodes = client_nodes | ||
|
||
def is_single_node_cluster(self): | ||
return True if (self.data_nodes == 1 and self.master_nodes == 0 | ||
and self.ingest_nodes == 0 and self.client_nodes == 0) else False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.