Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 6.x] Add implementation to get component names from Input manifest #394

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading