forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBundleManifest.groovy
105 lines (84 loc) · 2.53 KB
/
BundleManifest.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
package jenkins
class BundleManifest implements Serializable {
class Build implements Serializable {
String id
String name
String version
String platform
String architecture
String distribution
String location
Build(Map data) {
this.id = data.id
this.name = data.name
this.version = data.version
this.platform = data.platform
this.architecture = data.architecture
this.distribution = data.distribution
this.location = data.location
}
String getFilename() {
return this.name.toLowerCase().replaceAll(' ', '-')
}
String getBuildLocation() {
return this.location
}
}
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 version
String ref
String commit_id
String repository
String location
Component(Map data) {
this.name = data.name
this.version = data.version
this.ref = data.ref
this.commit_id = data.commit_id
this.repository = data.repository
this.location = data.location
}
}
Build build
Components components
BundleManifest(Map data) {
this.build = new BundleManifest.Build(data.build)
this.components = new BundleManifest.Components(data.components)
}
public String getArtifactArchitecture() {
return this.build.architecture
}
public String getArtifactBuildId() {
return this.build.id
}
public String getCommitId (String name) {
return this.components.get(name).commit_id
}
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
}
public String getLocation(String name) {
return this.components.get(name).location
}
}