-
Notifications
You must be signed in to change notification settings - Fork 282
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
[Build][Test] OS and OSD improvements plus support for Playground #1756
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ pipeline { | |
agent none | ||
environment { | ||
AGENT_X64 = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' | ||
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host' | ||
INTEG_TEST_JOB_NAME = 'integ-test-opensearch-dashboards' | ||
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host' | ||
DEFAULT_INTEG_TEST_JOB_NAME = 'integ-test-opensearch-dashboards' | ||
} | ||
parameters { | ||
string( | ||
|
@@ -23,8 +23,33 @@ pipeline { | |
description: 'Test manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-2.0.0-test.yml.', | ||
trim: true | ||
) | ||
string( | ||
name: 'INTEG_TEST_JOB_NAME', | ||
description: "Name of integration test job that will be triggered, e.g. Playground/integ-test-opensearch-dashboards.", | ||
defaultValue: "integ-test-opensearch-dashboards", | ||
trim: true | ||
) | ||
booleanParam( | ||
name: 'BUILD_DOCKER', | ||
description: 'Build docker image or not.', | ||
defaultValue: true | ||
) | ||
booleanParam( | ||
name: 'PUBLISH_NOTIFICATION', | ||
description: 'Publish the status of this build job or not.', | ||
defaultValue: true | ||
) | ||
} | ||
stages { | ||
stage('verify-parameters') { | ||
steps { | ||
script { | ||
env.INTEG_TEST_JOB_NAME = INTEG_TEST_JOB_NAME != '' ? | ||
INTEG_TEST_JOB_NAME : | ||
DEFAULT_INTEG_TEST_JOB_NAME | ||
} | ||
} | ||
} | ||
stage('detect docker image + args') { | ||
agent { | ||
docker { | ||
|
@@ -65,22 +90,19 @@ pipeline { | |
echo "artifactUrl (x64): ${artifactUrl}" | ||
|
||
def integTestResults = | ||
build job: INTEG_TEST_JOB_NAME, | ||
build job: env.INTEG_TEST_JOB_NAME, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think according to @abhinavGupta16, use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I wanted to ensure the right variable is used. If we go the route not worrying about the empty string case (which would require someone manually triggering the build and clearing it) then I will remove the |
||
propagate: false, | ||
wait: true, | ||
parameters: [ | ||
string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), | ||
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), | ||
string(name: 'AGENT_LABEL', value: AGENT_X64), | ||
string(name: 'CONTAINER_IMAGE', value: getTestDocker(testManifest: "manifests/${TEST_MANIFEST}")?.image ?: dockerAgent.image) | ||
string(name: 'AGENT_LABEL', value: AGENT_X64) | ||
] | ||
|
||
String status = integTestResults.getResult() | ||
String icon = status == 'SUCCESS' ? ':white_check_mark:' : ':warning:' | ||
lib.jenkins.Messages.new(this).add( | ||
STAGE_NAME, | ||
lib.jenkins.Messages.new(this).get([STAGE_NAME]) + | ||
"\nInteg Tests (x64): ${icon} ${status} ${integTestResults.getAbsoluteUrl()}" | ||
createTestResultsMessage( | ||
testType: "Integ Tests (x64)", | ||
status: integTestResults.getResult(), | ||
absoluteUrl: integTestResults.getAbsoluteUrl() | ||
) | ||
} | ||
} | ||
|
@@ -141,22 +163,19 @@ pipeline { | |
echo "artifactUrl (arm64): ${artifactUrl}" | ||
|
||
def integTestResults = | ||
build job: INTEG_TEST_JOB_NAME, | ||
build job: env.INTEG_TEST_JOB_NAME, | ||
propagate: false, | ||
wait: true, | ||
parameters: [ | ||
string(name: 'TEST_MANIFEST', value: TEST_MANIFEST), | ||
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl), | ||
string(name: 'AGENT_LABEL', value: AGENT_ARM64), | ||
string(name: 'CONTAINER_IMAGE', value: getTestDocker(testManifest: "manifests/${TEST_MANIFEST}")?.image ?: dockerAgent.image) | ||
string(name: 'AGENT_LABEL', value: AGENT_ARM64) | ||
] | ||
|
||
String status = integTestResults.getResult() | ||
String icon = status == 'SUCCESS' ? ':white_check_mark:' : ':warning:' | ||
lib.jenkins.Messages.new(this).add( | ||
STAGE_NAME, | ||
lib.jenkins.Messages.new(this).get([STAGE_NAME]) + | ||
"\nInteg Tests (arm64): ${icon} ${status} ${integTestResults.getAbsoluteUrl()}" | ||
createTestResultsMessage( | ||
testType: "Integ Tests (arm64)", | ||
status: integTestResults.getResult(), | ||
absoluteUrl: integTestResults.getAbsoluteUrl() | ||
) | ||
} | ||
} | ||
|
@@ -171,6 +190,10 @@ pipeline { | |
} | ||
} | ||
stage('docker build') { | ||
when { | ||
beforeAgent true | ||
equals expected: true, actual: BUILD_DOCKER | ||
} | ||
steps { | ||
node(AGENT_X64) { | ||
script { | ||
|
@@ -191,19 +214,20 @@ pipeline { | |
success { | ||
node(AGENT_X64) { | ||
script { | ||
def stashed = lib.jenkins.Messages.new(this).get([ | ||
'build-and-test-linux-x64', | ||
'build-archive-linux-arm64', | ||
'assemble-archive-and-test-linux-arm64' | ||
]) | ||
if (params.PUBLISH_NOTIFICATION) { | ||
def stashed = lib.jenkins.Messages.new(this).get([ | ||
'build-and-test-linux-x64', | ||
'assemble-archive-and-test-linux-arm64' | ||
]) | ||
|
||
publishNotification( | ||
icon: ':white_check_mark:', | ||
message: 'Successful Build', | ||
extra: stashed, | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
publishNotification( | ||
icon: ':white_check_mark:', | ||
message: 'Successful Build', | ||
extra: stashed, | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
} | ||
|
||
postCleanup() | ||
} | ||
|
@@ -212,12 +236,14 @@ pipeline { | |
failure { | ||
node(AGENT_X64) { | ||
script { | ||
publishNotification( | ||
icon: ':warning:', | ||
message: 'Failed Build', | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
if (params.PUBLISH_NOTIFICATION) { | ||
publishNotification( | ||
icon: ':warning:', | ||
message: 'Failed Build', | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
} | ||
|
||
postCleanup() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ pipeline { | |
environment { | ||
AGENT_X64 = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' | ||
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host' | ||
INTEG_TEST_JOB_NAME = 'integ-test' | ||
DEFAULT_INTEG_TEST_JOB_NAME = 'integ-test' | ||
} | ||
parameters { | ||
string( | ||
|
@@ -18,8 +18,33 @@ pipeline { | |
description: 'Test manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0-test.yml.', | ||
trim: true | ||
) | ||
string( | ||
name: 'INTEG_TEST_JOB_NAME', | ||
description: "Name of integration test job that will be triggered, e.g. Playground/integ-test.", | ||
defaultValue: "integ-test", | ||
trim: true | ||
) | ||
booleanParam( | ||
name: 'BUILD_DOCKER', | ||
description: 'Build docker image or not.', | ||
defaultValue: true | ||
) | ||
booleanParam( | ||
name: 'PUBLISH_NOTIFICATION', | ||
description: 'Publish the status of this build job or not.', | ||
defaultValue: true | ||
) | ||
} | ||
stages { | ||
stage('verify-parameters') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. I don't think this stage is necessary. |
||
steps { | ||
script { | ||
env.INTEG_TEST_JOB_NAME = INTEG_TEST_JOB_NAME != '' ? | ||
INTEG_TEST_JOB_NAME : | ||
DEFAULT_INTEG_TEST_JOB_NAME | ||
} | ||
} | ||
} | ||
stage('detect docker image + args') { | ||
agent { | ||
docker { | ||
|
@@ -125,7 +150,7 @@ pipeline { | |
echo "artifactUrl (x64): ${artifactUrl}" | ||
|
||
def integTestResults = | ||
build job: INTEG_TEST_JOB_NAME, | ||
build job: env.INTEG_TEST_JOB_NAME, | ||
propagate: false, | ||
wait: true, | ||
parameters: [ | ||
|
@@ -134,12 +159,10 @@ pipeline { | |
string(name: 'AGENT_LABEL', value: AGENT_X64) | ||
] | ||
|
||
String status = integTestResults.getResult() | ||
String icon = status == 'SUCCESS' ? ':white_check_mark:' : ':warning:' | ||
lib.jenkins.Messages.new(this).add( | ||
STAGE_NAME, | ||
lib.jenkins.Messages.new(this).get([STAGE_NAME]) + | ||
"\nInteg Tests (x64): ${icon} ${status} ${integTestResults.getAbsoluteUrl()}" | ||
createTestResultsMessage( | ||
testType: "Integ Tests (x64)", | ||
status: integTestResults.getResult(), | ||
absoluteUrl: integTestResults.getAbsoluteUrl() | ||
) | ||
} | ||
} | ||
|
@@ -171,7 +194,7 @@ pipeline { | |
echo "artifactUrl (arm64): ${artifactUrl}" | ||
|
||
def integTestResults = | ||
build job: INTEG_TEST_JOB_NAME, | ||
build job: env.INTEG_TEST_JOB_NAME, | ||
propagate: false, | ||
wait: true, | ||
parameters: [ | ||
|
@@ -180,12 +203,10 @@ pipeline { | |
string(name: 'AGENT_LABEL', value: AGENT_ARM64) | ||
] | ||
|
||
String status = integTestResults.getResult() | ||
String icon = status == 'SUCCESS' ? ':white_check_mark:' : ':warning:' | ||
lib.jenkins.Messages.new(this).add( | ||
STAGE_NAME, | ||
lib.jenkins.Messages.new(this).get([STAGE_NAME]) + | ||
"\nInteg Tests (arm64): ${icon} ${status} ${integTestResults.getAbsoluteUrl()}" | ||
createTestResultsMessage( | ||
testType: "Integ Tests (arm64)", | ||
status: integTestResults.getResult(), | ||
absoluteUrl: integTestResults.getAbsoluteUrl() | ||
) | ||
} | ||
} | ||
|
@@ -198,6 +219,10 @@ pipeline { | |
} | ||
} | ||
stage('docker build') { | ||
when { | ||
beforeAgent: true | ||
equals expected: true, actual: BUILD_DOCKER | ||
} | ||
steps { | ||
node('Jenkins-Agent-al2-x64-c54xlarge-Docker-Host') { | ||
script { | ||
|
@@ -219,15 +244,17 @@ pipeline { | |
success { | ||
node(AGENT_X64) { | ||
script { | ||
def stashed = lib.jenkins.Messages.new(this).get(['build-and-test-x64', 'build-and-test-arm64']) | ||
if (params.PUBLISH_NOTIFICATION) { | ||
def stashed = lib.jenkins.Messages.new(this).get(['build-and-test-x64', 'build-and-test-arm64']) | ||
|
||
publishNotification( | ||
icon: ':white_check_mark:', | ||
message: 'Successful Build', | ||
extra: stashed, | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
publishNotification( | ||
icon: ':white_check_mark:', | ||
message: 'Successful Build', | ||
extra: stashed, | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
} | ||
|
||
postCleanup() | ||
} | ||
|
@@ -236,12 +263,14 @@ pipeline { | |
failure { | ||
node(AGENT_X64) { | ||
script { | ||
publishNotification( | ||
icon: ':warning:', | ||
message: 'Failed Build', | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
if (params.PUBLISH_NOTIFICATION) { | ||
publishNotification( | ||
icon: ':warning:', | ||
message: 'Failed Build', | ||
credentialsId: 'BUILD_NOTICE_WEBHOOK', | ||
manifest: "${INPUT_MANIFEST}" | ||
) | ||
} | ||
|
||
postCleanup() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the check here since
INTEG_TEST_JOB_NAME
always has the default value which is the same as theDEFAULT_INTEG_TEST_JOB_NAME
if not assigned?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably me being too protective but technically someone can kick off a build and empty out the string for
INTEG_TEST_JOB_NAME
. I can remove this if we do not want to handle those situations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had some offline discussion with @kavilla, this makes sense to me that we could leave the parameter empty with this stage of check. These situation could happen for example when we pass the params from cron jobs. This shouldn't be a blocker for me.