def test_to_file_formatted(self) -> None: data_path = os.path.join(os.path.dirname(__file__), "data") manifest = InputManifest({ "schema-version": "1.0", "build": { "name": "OpenSearch", "version": "2.0.0" }, "ci": { "image": { "name": "image-name", "args": "-e JAVA_HOME=/opt/java/openjdk-11" } }, "components": [{ "name": "OpenSearch", "ref": "main", "repository": "https://github.com/opensearch-project/OpenSearch.git", "checks": ["gradle:publish", "gradle:properties:version"] }] }) with TemporaryDirectory() as path: output_path = os.path.join(path.name, "manifest.yml") manifest.to_file(output_path) with open(output_path) as f: written_manifest = f.read() with open(os.path.join(data_path, "formatted.yml")) as f: formatted_manifest = f.read() self.assertEqual(formatted_manifest, written_manifest)
def create_manifest(self, version: str, components: List = []) -> InputManifest: image_map = { "opensearch": "opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2", "opensearch-dashboards": "opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v2" } data: Dict = { "schema-version": "1.0", "build": { "name": self.name, "version": version }, "ci": { "image": { "name": image_map[self.prefix] } }, "components": [], } for component in components: logging.info(f" Adding {component.name}") data["components"].append(component.to_dict()) return InputManifest(data)
def create_manifest(self, version, components=[]): data = { "schema-version": "1.0", "build": { "name": self.name, "version": version }, "ci": { "image": { "name": "opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028" } }, "components": [], } for component in components: logging.info(f" Adding {component.name}") data["components"].append(component.to_dict()) return InputManifest(data)