From ca8b674ef24208b25bc80db036c7bddb242049ba Mon Sep 17 00:00:00 2001 From: Divya Madala Date: Thu, 7 Mar 2024 09:23:39 -0800 Subject: [PATCH] Add implemntation to get component names from Input manifest Signed-off-by: Divya Madala --- src/jenkins/InputManifest.groovy | 36 +++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/jenkins/InputManifest.groovy b/src/jenkins/InputManifest.groovy index 3e86f15a8..3de94ba10 100644 --- a/src/jenkins/InputManifest.groovy +++ b/src/jenkins/InputManifest.groovy @@ -53,12 +53,35 @@ class InputManifest { } } + class Components extends HashMap { + + Components(ArrayList data) { + data.each { item -> + Component component = new Component(item) + this[component.name] = component + } + } + } + + class Component implements Serializable { + String name + String repository + + Component(Map data) { + this.name = data.name + this.repository = data.repository + } + + } + Build build Ci ci + Components components InputManifest(Map data) { this.build = new InputManifest.Build(data.build) this.ci = data.ci ? new InputManifest.Ci(data.ci) : null + this.components = new InputManifest.Components(data.components) } String getSHAsRoot(String jobName) { @@ -68,4 +91,15 @@ class InputManifest { 'shas' ].join("/") } -} + + public ArrayList getNames() { + def componentsName = [] + this.components.each { key, value -> componentsName.add(key) } + return componentsName + } + + public String getRepo(String name) { + return this.components.get(name).repository + } + +} \ No newline at end of file