Skip to content

Commit

Permalink
Enable continue on error for distribution build jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Aug 15, 2023
1 parent 75c4cd7 commit 9f8bc57
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 22 deletions.
32 changes: 21 additions & 11 deletions jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib = library(identifier: 'jenkins@5.4.1', retriever: modernSCM([
lib = library(identifier: 'jenkins@5.5.0', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -75,6 +75,11 @@ pipeline {
description: 'To create a github issue for failing component or not.',
defaultValue: true
)
booleanParam(
name: 'CONTINUE_ON_ERROR',
description: 'Continue building the distribution even if a single or few component fails',
defaultValue: true
)
}
stages {
stage('verify-parameters') {
Expand Down Expand Up @@ -161,7 +166,8 @@ pipeline {
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'linux',
architecture: 'x64',
distribution: 'tar'
distribution: 'tar',
continueOnError: ${params.CONTINUE_ON_ERROR}
)
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String buildManifestUrlOpenSearch = [buildManifestObj.getArtifactRootUrl(JOB_NAME_OPENSEARCH, "latest"), "builds", "opensearch", "manifest.yml"].join("/")
Expand Down Expand Up @@ -735,7 +741,8 @@ pipeline {
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'windows',
architecture: 'x64',
distribution: "zip"
distribution: "zip",
continueOnError: ${params.CONTINUE_ON_ERROR}
)
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
Expand Down Expand Up @@ -826,11 +833,21 @@ pipeline {
node(AGENT_X64) {
checkout scm
script {
def findFailedPlugins = buildMessage(search: 'Failed plugins')
if (findFailedPlugins != null) {
currentBuild.result = 'UNSTABLE'
}
closeBuildSuccessGithubIssue(
message: buildMessage(search: 'Successfully built'),
search: "Successfully built",
search: 'Successfully built',
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
if (params.CREATE_GITHUB_ISSUE) {
createBuildFailureGithubIssue(
message: buildMessage(search: 'Error building'),
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
}
postCleanup()
}
}
Expand Down Expand Up @@ -887,13 +904,6 @@ pipeline {
manifest: "${INPUT_MANIFEST}"
)
}
if (params.CREATE_GITHUB_ISSUE) {
createBuildFailureGithubIssue(
message: buildMessage(search: 'Error building'),
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
}

postCleanup()
}
}
Expand Down
32 changes: 21 additions & 11 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib = library(identifier: 'jenkins@5.4.1', retriever: modernSCM([
lib = library(identifier: 'jenkins@5.5.0', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -68,6 +68,11 @@ pipeline {
description: 'To create a github issue for failing component or not.',
defaultValue: true
)
booleanParam(
name: 'CONTINUE_ON_ERROR',
description: 'Continue building the distribution even if a single or few component fails',
defaultValue: true
)
}
stages {
stage('verify-parameters') {
Expand Down Expand Up @@ -287,7 +292,8 @@ pipeline {
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'linux',
architecture: 'x64',
distribution: "tar"
distribution: "tar",
continueOnError: ${params.CONTINUE_ON_ERROR}
)
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
Expand Down Expand Up @@ -789,7 +795,8 @@ pipeline {
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'windows',
architecture: 'x64',
distribution: "zip"
distribution: "zip",
continueOnError: ${params.CONTINUE_ON_ERROR}
)
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
Expand Down Expand Up @@ -878,11 +885,21 @@ pipeline {
node(AGENT_X64) {
checkout scm
script {
def findFailedPlugins = buildMessage(search: 'Failed plugins')
if (findFailedPlugins != null) {
currentBuild.result = 'UNSTABLE'
}
closeBuildSuccessGithubIssue(
message: buildMessage(search: 'Successfully built'),
search: "Successfully built",
search: 'Successfully built',
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
if (params.CREATE_GITHUB_ISSUE) {
createBuildFailureGithubIssue(
message: buildMessage(search: 'Error building'),
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
}
postCleanup()
}
}
Expand Down Expand Up @@ -932,13 +949,6 @@ pipeline {
manifest: "${INPUT_MANIFEST}"
)
}
if (params.CREATE_GITHUB_ISSUE) {
createBuildFailureGithubIssue(
message: buildMessage(search: 'Error building'),
inputManifestPath: "manifests/$INPUT_MANIFEST"
)
}

postCleanup()
}
}
Expand Down

0 comments on commit 9f8bc57

Please sign in to comment.