Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a basic Jenkins job for running OpenSearch Dashboards integ test #1368

Closed
wants to merge 17 commits into from
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this identifier, why use fixed date value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jenkins caches the library sometimes, so when we make code changes we tend to increment this everywhere.


pipeline {
agent none
parameters {
string(
defaultValue: '',
name: 'opensearch_version',
description: 'OpenSearch version to run test on',
trim: true
)

string(
defaultValue: '',
name: 'opensearch_dashboards_version',
description: 'OpenSearch Dashboards version to run test on',
trim: true
)
string(
defaultValue: '',
name: 'opensearch_build_id',
description: 'The build number of OpenSearch for which tests should be run',
trim: true
)
string(
defaultValue: '',
name: 'opensearch_dashboards_build_id',
description: 'The build number of OpenSearch Dashboards for which tests should be run',
trim: true
)
string(
defaultValue: '',
name: 'architecture',
description: 'Architecture of the build of OpenSearch/OpenSearch Dashboards',
trim: true
)
string(
defaultValue: '',
name: 'platform',
description: 'Platform of the build of OpenSearch/OpenSearch Dashboards',
trim: true
)
Copy link
Member

@dblock dblock Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if the parameters to this job was 1) an OpenSearch Dashboards build URL (e.g. ci.opensearch....) that contains a manifest that would get loaded and all these features such as build ID and architecture and platform were to be extracted, and 2) an OpenSearch URL. Otherwise we keep building assumptions in the URL structure of where things are built, ie. this job "knows" something it shouldn't about the location of builds. Then this code loads the manifest(s) and has everything it needs, it would be shorter and easier to grok.

Use CAPS for variables similarly to other Jenkinsfile.

}
stages {
stage('integ-test') {
agent {
docker {
label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host'
image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028'
alwaysPull true
}
}
steps {
script {
basePathOpenSearch = getPublicUrl(
name:'Open Search',
jobName:'distribution-build-opensearch',
architecture:architecture,
platform:platform,
buildNumber:opensearch_build_id,
version: opensearch_version
)

basePathOpenSearchDashboards = getPublicUrl(
name:'Open Search Dashboards',
jobName:'distribution-build-opensearch-dashboards',
architecture:architecture,
platform:platform,
buildNumber:opensearch_dashboards_build_id,
version: opensearch_dashboards_version
)

sh "./test.sh integ-test manifests/${opensearch_dashboards_version}/opensearch-dashboards-${opensearch_dashboards_version}-test.yml -p opensearch=${basePathOpenSearch} opensearch-dashboards=${basePathOpenSearchDashboards} --test-run-id ${env.BUILD_NUMBER}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets just pass the test manifest path, this is forward compatible with path changes

Suggested change
sh "./test.sh integ-test manifests/${opensearch_dashboards_version}/opensearch-dashboards-${opensearch_dashboards_version}-test.yml -p opensearch=${basePathOpenSearch} opensearch-dashboards=${basePathOpenSearchDashboards} --test-run-id ${env.BUILD_NUMBER}"
sh "./test.sh integ-test ${TEST-MANIFEST} -p opensearch=${basePathOpenSearch} opensearch-dashboards=${basePathOpenSearchDashboards} --test-run-id ${env.BUILD_NUMBER}"

}
}
post {
always {
postCleanup()
}
}
}
}
post {
success {
node('Jenkins-Agent-al2-x64-c54xlarge-Docker-Host') {
script {
postCleanup()
}
}
Comment on lines +85 to +89
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@dblock dblock Dec 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to extract the whole post part with tests.

}
failure {
node('Jenkins-Agent-al2-x64-c54xlarge-Docker-Host') {
script {
postCleanup()
}
}
}
}
}
14 changes: 14 additions & 0 deletions vars/getPublicUrl.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Map call(Map args = [:]) {
def lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))

def buildManifest = lib.jenkins.BuildManifest.new(
build: [
name: args.name,
version: args.version,
platform: args.platform,
architecture: args.architecture
]
)

return buildManifest.getArtifactRootUrl(args.jobName, args.buildNumber)
}