forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
s2i_images.go
132 lines (124 loc) · 2.55 KB
/
s2i_images.go
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package image_ecosystem
import "fmt"
type ImageBaseType string
type tc struct {
// The image version string (eg. '27' or '34')
Version string
// Command to execute
Cmd string
// Expected output from the command
Expected string
// Repository is either openshift/ or rhcsl/
// The default is 'openshift'
Repository string
// Internal: We resolve this in JustBeforeEach
DockerImageReference string
}
// This is a complete list of supported S2I images
var s2iImages = map[string][]tc{
"ruby": {
{
Version: "22",
Cmd: "ruby --version",
Expected: "ruby 2.2",
Repository: "centos",
},
{
Version: "23",
Cmd: "ruby --version",
Expected: "ruby 2.3",
Repository: "centos",
},
{
Version: "24",
Cmd: "ruby --version",
Expected: "ruby 2.4",
Repository: "centos",
},
},
"python": {
{
Version: "27",
Cmd: "python --version",
Expected: "Python 2.7",
Repository: "centos",
},
{
Version: "34",
Cmd: "python --version",
Expected: "Python 3.4",
Repository: "centos",
},
{
Version: "35",
Cmd: "python --version",
Expected: "Python 3.5",
Repository: "centos",
},
{
Version: "36",
Cmd: "python --version",
Expected: "Python 3.6",
Repository: "centos",
},
},
"nodejs": {
{
Version: "4",
Cmd: "node --version",
Expected: "v4",
Repository: "centos",
},
{
Version: "6",
Cmd: "node --version",
Expected: "v6",
Repository: "centos",
},
},
"perl": {
{
Version: "520",
Cmd: "perl --version",
Expected: "v5.20",
Repository: "centos",
},
{
Version: "524",
Cmd: "perl --version",
Expected: "v5.24",
Repository: "centos",
},
},
"php": {
{
Version: "56",
Cmd: "php --version",
Expected: "5.6",
Repository: "centos",
},
{
Version: "70",
Cmd: "php --version",
Expected: "7.0",
Repository: "centos",
},
},
}
func GetTestCaseForImages() map[string][]tc {
result := make(map[string][]tc)
for name, variants := range s2iImages {
for i := range variants {
resolveDockerImageReference(name, &variants[i])
result[name] = append(result[name], variants[i])
}
}
return result
}
// resolveDockerImageReferences resolves the pull specs for all images
func resolveDockerImageReference(name string, t *tc) {
if len(t.Repository) == 0 {
t.Repository = "openshift"
}
t.DockerImageReference = fmt.Sprintf("%s/%s-%s-centos7", t.Repository, name, t.Version)
}