forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use latest image for OSD integ test (opensearch-project#1748)
* use the osd test image Signed-off-by: Tianle Huang <[email protected]> * use image Signed-off-by: Tianle Huang <[email protected]> * fix schema Signed-off-by: Tianle Huang <[email protected]> * fix flake8 Signed-off-by: Tianle Huang <[email protected]> * add unit test Signed-off-by: Tianle Huang <[email protected]> * use test manifest Signed-off-by: Tianle Huang <[email protected]> * use build job name Signed-off-by: Tianle Huang <[email protected]> * test Signed-off-by: Tianle Huang <[email protected]> * remove Signed-off-by: Tianle Huang <[email protected]> * update syntax Signed-off-by: Tianle Huang <[email protected]> * simplify Signed-off-by: Tianle Huang <[email protected]> * add test for the ci image Signed-off-by: Tianle Huang <[email protected]> * fix style Signed-off-by: Tianle Huang <[email protected]>
- Loading branch information
Showing
11 changed files
with
181 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package jenkins | ||
|
||
class TestManifest { | ||
class Ci implements Serializable { | ||
class Image implements Serializable { | ||
String name | ||
String args | ||
|
||
Image(Map data) { | ||
this.name = data.name | ||
this.args = data.args | ||
} | ||
} | ||
|
||
Image image | ||
|
||
Ci(Map data) { | ||
this.image = new TestManifest.Ci.Image(data.image) | ||
} | ||
} | ||
|
||
String name | ||
|
||
Ci ci | ||
|
||
TestManifest(Map data) { | ||
this.name = data.name | ||
this.ci = data.ci ? new TestManifest.Ci(data.ci) : null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
import jenkins.tests.BuildPipelineTest | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
|
||
class TestGetTestDocker extends BuildPipelineTest { | ||
|
||
@Test | ||
public void test() { | ||
super.testPipeline("tests/jenkins/jobs/GetTestDocker_Jenkinsfile") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
pipeline { | ||
agent none | ||
stages { | ||
stage('get test docker') { | ||
steps { | ||
script { | ||
getTestDocker( | ||
testManifest: 'tests/jenkins/data/opensearch-1.3.0-test.yml', | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
GetTestDocker_Jenkinsfile.run() | ||
GetTestDocker_Jenkinsfile.pipeline(groovy.lang.Closure) | ||
GetTestDocker_Jenkinsfile.echo(Executing on agent [label:none]) | ||
GetTestDocker_Jenkinsfile.stage(get test docker, groovy.lang.Closure) | ||
GetTestDocker_Jenkinsfile.script(groovy.lang.Closure) | ||
GetTestDocker_Jenkinsfile.getTestDocker({testManifest=tests/jenkins/data/opensearch-1.3.0-test.yml}) | ||
getTestDocker.legacySCM(groovy.lang.Closure) | ||
getTestDocker.library({identifier=jenkins@20211123, retriever=null}) | ||
getTestDocker.readYaml({file=tests/jenkins/data/opensearch-1.3.0-test.yml}) | ||
TestManifest.asBoolean() | ||
getTestDocker.echo(Using Docker image null (null)) |
12 changes: 12 additions & 0 deletions
12
tests/tests_manifests/data/opensearch-dashboards-test-1.3.0.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
schema-version: '1.0' | ||
name: OpenSearch Dashboards | ||
ci: | ||
image: | ||
name: opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v1 | ||
components: | ||
- name: functionalTestDashboards | ||
integ-test: | ||
test-configs: | ||
- with-security | ||
- without-security |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import os | ||
import unittest | ||
|
||
from manifests.test_manifest import TestManifest | ||
|
||
|
||
class TestTestManifest(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.maxDiff = None | ||
self.data_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "data")) | ||
self.manifest_filename = os.path.join(self.data_path, "opensearch-dashboards-test-1.3.0.yml") | ||
self.manifest = TestManifest.from_path(self.manifest_filename) | ||
|
||
def test_component(self) -> None: | ||
self.assertEqual(self.manifest.name, "OpenSearch Dashboards") | ||
self.assertEqual(self.manifest.ci.image.name, "opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Map call(Map args = [:]) { | ||
def lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm)) | ||
def testManifest = lib.jenkins.TestManifest.new(readYaml(file: args.testManifest)) | ||
|
||
dockerImage = testManifest.ci?.image?.name | ||
dockerArgs = testManifest.ci?.image?.args | ||
echo "Using Docker image ${dockerImage} (${dockerArgs})" | ||
return [ | ||
image: dockerImage, | ||
args: dockerArgs | ||
] | ||
} |