Skip to content

Commit

Permalink
Add implementation to get component names from Input manifest (#393)
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <[email protected]>
  • Loading branch information
Divyaasm authored Mar 11, 2024
1 parent 8fe1005 commit 0721e85
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jacocoTestReport {
}
}

String version = '6.3.2'
String version = '6.3.3'

task updateVersion {
doLast {
Expand Down
36 changes: 36 additions & 0 deletions src/jenkins/InputManifest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,37 @@ 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 ref
String repository

Component(Map data) {
this.name = data.name
this.ref = data.ref
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 +93,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
}

}
4 changes: 4 additions & 0 deletions tests/jenkins/jobs/InputManifest_Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pipeline {
echo inputManifest.build.version
echo inputManifest.build.getFilename()
echo inputManifest.getSHAsRoot('bundle-build')
def componentNames = inputManifest.getNames()
echo componentNames.join(', ')
echo inputManifest.getRepo('OpenSearch')
echo inputManifest.getRepo('dashboards-reports')
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions tests/jenkins/jobs/InputManifest_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@
InputManifest_Jenkinsfile.echo(opensearch)
InputManifest.getSHAsRoot(bundle-build)
InputManifest_Jenkinsfile.echo(bundle-build/1.2.0/shas)
InputManifest.getNames()
InputManifest_Jenkinsfile.echo(index-management, job-scheduler, anomaly-detection, performance-analyzer, common-utils, cross-cluster-replication, asynchronous-search, OpenSearch, alerting, sql, security, k-NN, dashboards-reports, opensearch-observability)
InputManifest.getRepo(OpenSearch)
InputManifest_Jenkinsfile.echo(https://github.com/opensearch-project/OpenSearch.git)
InputManifest.getRepo(dashboards-reports)
InputManifest_Jenkinsfile.echo(https://github.com/opensearch-project/dashboards-reports.git)

0 comments on commit 0721e85

Please sign in to comment.