Skip to content

Commit

Permalink
Add implemntation to get component names from Input manifest
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <divyaasm@amazon.com>
  • Loading branch information
Divyaasm committed Mar 7, 2024
1 parent 8fe1005 commit ca8b674
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/jenkins/InputManifest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,35 @@ class InputManifest {
}
}

class Components extends HashMap<String, Component> {

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) {
Expand All @@ -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
}

}

0 comments on commit ca8b674

Please sign in to comment.