Skip to content

Commit

Permalink
Add test jenkins file
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <[email protected]>
  • Loading branch information
Divyaasm committed Oct 4, 2023
1 parent 0fe2554 commit d140b90
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions jenkins/validate-artifacts/validate-artifacts.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([
]))

def docker_images = [
"tar": "opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v4",
"rpm": "opensearchstaging/ci-runner:ci-runner-rockylinux8-systemd-base-integtest-v3",
"yum": "opensearchstaging/ci-runner:ci-runner-rockylinux8-systemd-base-integtest-v3",
"tar": "opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2",
"rpm": "opensearchstaging/ci-runner:ci-runner-rockylinux8-systemd-base-integtest-v1",
"yum": "opensearchstaging/ci-runner:ci-runner-rockylinux8-systemd-base-integtest-v1",
]

def docker_args = [
"tar": "-u 1000",
"rpm": "--entrypoint=/usr/lib/systemd/systemd -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host",
"yum": "--entrypoint=/usr/lib/systemd/systemd -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host",
"rpm": "--entrypoint=/usr/sbin/init -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro",
"yum": "--entrypoint=/usr/sbin/init -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro",
]

def agent_nodes_docker = [
"x64": "Jenkins-Agent-AL2023-X64-C54xlarge-Single-Host",
"arm64": "Jenkins-Agent-AL2023-Arm64-C6g4xlarge-Single-Host",
"x64": "Jenkins-Agent-AL2-X64-C54xlarge-Single-Host",
"arm64": "Jenkins-Agent-AL2-Arm64-C6g4xlarge-Single-Host",
]

def agent_nodes = [
"x64": "Jenkins-Agent-AL2023-X64-C54xlarge-Docker-Host",
"arm64": "Jenkins-Agent-AL2023-Arm64-C6g4xlarge-Docker-Host",
"x64": "Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host",
"arm64": "Jenkins-Agent-AL2-Arm64-C6g4xlarge-Docker-Host",
]

pipeline {
Expand All @@ -36,6 +36,11 @@ pipeline {
description: 'Enter the OpenSearch and OpenSearch Dashboards version that needs to be validated',
trim: true
)
string(
name: 'FILE_PATH',
description: 'Enter url link of the corresponding artifact',
trim: true
)
string(
name: 'DISTRIBUTION',
description: 'Enter the distribution type among tar, rpm, yum, docker separated by space. Defaults to "tar rpm yum docker"',
Expand Down Expand Up @@ -65,6 +70,19 @@ pipeline {
trim: true,
defaultValue: "using-staging-artifact-only"
)
string(
name: 'PROJECTS',
description: 'Enter opensearch or opensearch-dashboards',
trim: true,
defaultValue: "opensearch"
)
string(
name: 'ARTIFACT_TYPE',
description: 'Enter staging or production',
trim: true,
defaultValue: "production"
)


}

Expand All @@ -73,10 +91,6 @@ pipeline {
agent { label agent_nodes["x64"] }
steps {
script {
if (VERSION == '') {
currentBuild.result = 'ABORTED'
error('VERSION cannot be empty. Please provide version of the artifacts to validate')
}

if (params.DISTRIBUTION.contains('docker') && (OS_BUILD_NUMBER == '' || OSD_BUILD_NUMBER == '')) {
currentBuild.result = 'ABORTED'
Expand Down Expand Up @@ -115,7 +129,7 @@ pipeline {
// Using scripted pipelines to trigger dynamic parallel stages
timeout(time: 30) {
if ("${local_distribution}" == "docker"){
node(agent_nodes_docker["$local_architecture"]) {
node(agent_nodes["$local_architecture"]) {
try {
stage("${local_distribution}") {
unstash "validate-artifacts-$BUILD_NUMBER"
Expand All @@ -126,8 +140,12 @@ pipeline {
arch: "${local_architecture}",
"os-build-number": "$OS_BUILD_NUMBER",
"osd-build-number": "$OSD_BUILD_NUMBER",
projects: "$PROJECTS",
"$OPTIONAL_ARGS" : ""
)
validateArtifacts(
"file-path": "$FILE_PATH"
)
}
} catch (e) {
echo "Error occurred while validating ${local_distribution}-${local_architecture}"
Expand All @@ -148,8 +166,14 @@ pipeline {
validateArtifacts(
version: "$VERSION",
distribution: "${local_distribution}",
arch: "${local_architecture}"
arch: "${local_architecture}",
projects: "$PROJECTS",
"artifact-type": "$ARTIFACT_TYPE"
)
validateArtifacts(
"file-path": "$FILE_PATH"
)

}
} catch (e) {
echo "Error occurred while validating ${local_distribution}-${local_architecture}"
Expand Down

0 comments on commit d140b90

Please sign in to comment.