Skip to content

Commit

Permalink
Fail fast if input manifest is not provided
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Jan 28, 2025
1 parent c1e2d1f commit a7a2127
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
31 changes: 17 additions & 14 deletions jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,62 +28,62 @@ pipeline {
}
parameters {
string(
name: 'COMPONENT_NAME',
description: '<Optional> If this field contains one or more component names (e.g. OpenSearch-Dashboards reportsDashboards ...), will build with "--component <COMPONENT_NAME> ...", else build everything in the INPUT_MANIFEST.',
name: 'INPUT_MANIFEST',
description: '\<Required\> Input manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-2.0.0.yml.',
trim: true
)
string(
name: 'INPUT_MANIFEST',
description: '<Required> Input manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-2.0.0.yml.',
name: 'COMPONENT_NAME',
description: '\<Optional\> If this field contains one or more component names (e.g. OpenSearch-Dashboards reportsDashboards ...), will build with "--component <COMPONENT_NAME\> ...", else build everything in the INPUT_MANIFEST.',
trim: true
)
string(
name: 'TEST_MANIFEST',
description: '<Optional> Test manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-2.0.0-test.yml.',
description: '\<Optional\> 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: '<Optional> Name of integration test job that will be triggered, e.g. Playground/integ-test-opensearch-dashboards. A non-null empty value here will skip integration tests.',
description: '\<Optional\> Name of integration test job that will be triggered, e.g. Playground/integ-test-opensearch-dashboards. A non-null empty value here will skip integration tests.',
defaultValue: 'integ-test-opensearch-dashboards',
trim: true
)
string(
name: 'BWC_TEST_JOB_NAME',
description: '<Optional> Name of backwards compatibility test job that will be triggered, e.g. Playground/bwc-test-opensearch-dashboards. A non-null empty value here will skip BWC tests.',
description: '\<Optional\> Name of backwards compatibility test job that will be triggered, e.g. Playground/bwc-test-opensearch-dashboards. A non-null empty value here will skip BWC tests.',
defaultValue: 'bwc-test-opensearch-dashboards',
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new platform(s)
name: 'BUILD_PLATFORM',
description: "<Required> Build selected platform, choices include 'linux', 'windows'. Can combine multiple platforms with space in between (docker is only available on linux)",
description: "\<Required\> Build selected platform, choices include 'linux', 'windows'. Can combine multiple platforms with space in between (docker is only available on linux)",
defaultValue: 'linux windows',
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new distribution(s)
name: 'BUILD_DISTRIBUTION',
description: "<Required> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions with space in between (docker is only available on tar)",
description: "\<Required\> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions with space in between (docker is only available on tar)",
defaultValue: 'tar rpm deb zip',
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new platform(s)
name: 'TEST_PLATFORM',
description: "<Optional> Test selected platform, choices include 'linux', 'windows'. Can combine multiple platforms with space in between (docker is only available on linux)",
description: "\<Optional\> Test selected platform, choices include 'linux', 'windows'. Can combine multiple platforms with space in between (docker is only available on linux)",
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new distribution(s)
name: 'TEST_DISTRIBUTION',
description: "<Optional> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions with space in between (docker is only available on tar)",
description: "\<Optional\> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions with space in between (docker is only available on tar)",
trim: true
)
string(
name: 'RC_NUMBER',
description: '<Required> The RC build count. Default is 0 which means its not a Release Candidate.',
description: '\<Required\> The RC build count. Default is 0 which means its not a Release Candidate.',
defaultValue: '0'
)
choice(
name: 'BUILD_DOCKER',
description: '<Required> Build docker image or not with options.',
description: '\<Required\> Build docker image or not with options.',
choices: ['build_docker', 'build_docker_with_build_number_tag', 'do_not_build_docker'],
)
booleanParam(
Expand Down Expand Up @@ -125,10 +125,13 @@ pipeline {
}
steps {
script {
if (INPUT_MANIFEST == '' || !fileExists("manifests/${INPUT_MANIFEST}")) {
currentBuild.result = 'ABORTED'
error("Input manifest was not provided or not found at manifests/${INPUT_MANIFEST}.")
}
echo('Detect Docker Images and Related Parameters')
dockerAgent = detectDockerAgent()
currentBuild.description = INPUT_MANIFEST

paramType = [
'BUILD_PLATFORM': 'linux windows',
'BUILD_DISTRIBUTION': 'tar rpm deb zip',
Expand Down
30 changes: 17 additions & 13 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,62 @@ pipeline {
}
parameters {
string(
name: 'COMPONENT_NAME',
description: '<Optional> If this field contains one or more component names (e.g. OpenSearch common-utils ...), will build with "--component <COMPONENT_NAME> ...", else build everything in the INPUT_MANIFEST.',
name: 'INPUT_MANIFEST',
description: '\<Required\> Input manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0.yml.',
trim: true
)
string(
name: 'INPUT_MANIFEST',
description: '<Required> Input manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0.yml.',
name: 'COMPONENT_NAME',
description: '\<Optional\> If this field contains one or more component names (e.g. OpenSearch common-utils ...), will build with "--component \<COMPONENT_NAME\> ...", else build everything in the INPUT_MANIFEST.',
trim: true
)
string(
name: 'TEST_MANIFEST',
description: '<Optional> Test manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0-test.yml.',
description: '\<Optional\> 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: '<Optional> Name of integration test job that will be triggered, e.g. Playground/integ-test. A non-null empty value here will skip integration tests.',
description: '\<Optional\> Name of integration test job that will be triggered, e.g. Playground/integ-test. A non-null empty value here will skip integration tests.',
defaultValue: 'integ-test',
trim: true
)
string(
name: 'BWC_TEST_JOB_NAME',
description: '<Optional> Name of backwards compatibility test job that will be triggered, e.g. Playground/bwc-test. A non-null empty value here will skip BWC tests.',
description: '\<Optional\> Name of backwards compatibility test job that will be triggered, e.g. Playground/bwc-test. A non-null empty value here will skip BWC tests.',
defaultValue: 'bwc-test',
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new platform(s)
name: 'BUILD_PLATFORM',
description: "<Required> Build selected platform, choices include 'linux', 'windows'. Can combine multiple platforms separated by space (docker is only available on linux)",
description: "\<Required\> Build selected platform, choices include 'linux', 'windows'. Can combine multiple platforms separated by space (docker is only available on linux)",
defaultValue: 'linux windows',
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new distribution(s)
name: 'BUILD_DISTRIBUTION',
description: "<Required> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions separated by space (docker is only available on tar)",
description: "\<Required\> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions separated by space (docker is only available on tar)",
defaultValue: 'tar rpm deb zip',
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new platform(s)
name: 'TEST_PLATFORM',
description: "<Optional> Test selected platform, choices include 'linux', 'windows'. Can combine multiple platforms separated by space",
description: "\<Optional\\> Test selected platform, choices include 'linux', 'windows'. Can combine multiple platforms separated by space",
trim: true
)
string( // Note: need to update 'verify-parameters' entries if you add new distribution(s)
name: 'TEST_DISTRIBUTION',
description: "<Optional> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions separated by space",
description: "\<Optional\> Build selected distribution, choices include 'tar', 'rpm', 'deb', 'zip'. Can combine multiple distributions separated by space",
trim: true
)
string(
name: 'RC_NUMBER',
description: '<Required> The RC build count. Default is 0 which means its not a Release Candidate.',
description: '\<Required\> The RC build count. Default is 0 which means its not a Release Candidate.',
defaultValue: '0'
)
choice(
name: 'BUILD_DOCKER',
description: '<Required> Build docker image or not with options.',
description: '\<Required\> Build docker image or not with options.',
choices: ['build_docker', 'build_docker_with_build_number_tag', 'do_not_build_docker'],
)
booleanParam(
Expand Down Expand Up @@ -124,6 +124,10 @@ pipeline {
}
steps {
script {
if (INPUT_MANIFEST == '' || !fileExists("manifests/${INPUT_MANIFEST}")) {
currentBuild.result = 'ABORTED'
error("Input manifest was not provided or not found at manifests/${INPUT_MANIFEST}.")
}
echo('Detect Docker Images and Related Parameters')
dockerAgent = detectDockerAgent()
env.javaVersionNumber = dockerAgent.javaVersion.replaceAll('[^0-9]', '') // Only get number
Expand Down

0 comments on commit a7a2127

Please sign in to comment.