@@ -5,9 +5,29 @@ import { FormValues } from '../useForm'
5
5
6
6
const seContainerRegistry = 'se-images'
7
7
const genericImagePrefix = 'postgresai/extended-postgres'
8
+ // since some tags are rc, we need to specify the exact tags to use
9
+ const dockerImagesConfig = {
10
+ '9.6' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
11
+ '10' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
12
+ '11' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
13
+ '12' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
14
+ '13' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
15
+ '14' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
16
+ '15' : [ '0.4.2' , '0.4.1' , '0.3.0' ] ,
17
+ '16' : [ '0.4.2' , '0.4.1' ] ,
18
+ }
8
19
9
20
export type FormValuesKey = keyof FormValues
10
21
22
+ interface DockerImage {
23
+ package_group : string
24
+ pg_major_version : string
25
+ tag : string
26
+ location : string
27
+ }
28
+
29
+ type DockerImagesConfig = Record < string , string [ ] >
30
+
11
31
export const uniqueChipValue = ( values : string ) => {
12
32
const splitChipArray = values . split ( / [ , ( \s ) ( \n ) ( \r ) ( \t ) ( \r \n ) ] / )
13
33
let databaseArray = [ ]
@@ -39,106 +59,32 @@ export const postUniqueDatabases = (values: string) => {
39
59
return values . length !== 0 ? nonEmptyDatabase : null
40
60
}
41
61
62
+ const createDockerImages = (
63
+ dockerImagesConfig : DockerImagesConfig ,
64
+ ) : DockerImage [ ] => {
65
+ const dockerImages : DockerImage [ ] = [ ]
66
+
67
+ for ( const pg_major_version in dockerImagesConfig ) {
68
+ if ( dockerImagesConfig . hasOwnProperty ( pg_major_version ) ) {
69
+ const customTags = dockerImagesConfig [ pg_major_version ]
70
+
71
+ customTags . forEach ( ( tag ) => {
72
+ const image : DockerImage = {
73
+ package_group : 'postgresai' ,
74
+ pg_major_version,
75
+ tag : `${ pg_major_version } -${ tag } ` ,
76
+ location : `${ genericImagePrefix } :${ pg_major_version } -${ tag } ` ,
77
+ }
78
+
79
+ dockerImages . push ( image )
80
+ } )
81
+ }
82
+ }
83
+
84
+ return dockerImages
85
+ }
42
86
43
- // using the same json data structue as se-images
44
- export const genericDockerImages = [
45
- {
46
- package_group : 'postgresai' ,
47
- pg_major_version : '9.6' ,
48
- tag : '9.6-0.4.1' ,
49
- location : `${ genericImagePrefix } :9.6-0.4.1` ,
50
- } ,
51
- {
52
- package_group : 'postgresai' ,
53
- pg_major_version : '9.6' ,
54
- tag : '9.6-0.3.0' ,
55
- location : `${ genericImagePrefix } :9.6-0.3.0` ,
56
- } ,
57
- {
58
- package_group : 'postgresai' ,
59
- pg_major_version : '10' ,
60
- tag : '10-0.4.1' ,
61
- location : `${ genericImagePrefix } :10-0.4.1` ,
62
- } ,
63
- {
64
- package_group : 'postgresai' ,
65
- pg_major_version : '10' ,
66
- tag : '10-0.3.0' ,
67
- location : `${ genericImagePrefix } :10-0.3.0` ,
68
- } ,
69
- {
70
- package_group : 'postgresai' ,
71
- pg_major_version : '11' ,
72
- tag : '11-0.4.1' ,
73
- location : `${ genericImagePrefix } :11-0.4.1` ,
74
- } ,
75
- {
76
- package_group : 'postgresai' ,
77
- pg_major_version : '11' ,
78
- tag : '11-0.3.0' ,
79
- location : `${ genericImagePrefix } :11-0.3.0` ,
80
- } ,
81
- {
82
- package_group : 'postgresai' ,
83
- pg_major_version : '12' ,
84
- tag : '12-0.4.1' ,
85
- location : `${ genericImagePrefix } :12-0.4.1` ,
86
- } ,
87
- {
88
- package_group : 'postgresai' ,
89
- pg_major_version : '12' ,
90
- tag : '12-0.3.0' ,
91
- location : `${ genericImagePrefix } :12-0.3.0` ,
92
- } ,
93
- {
94
- package_group : 'postgresai' ,
95
- pg_major_version : '13' ,
96
- tag : '13-0.4.1' ,
97
- location : `${ genericImagePrefix } :13-0.4.1` ,
98
- } ,
99
- {
100
- package_group : 'postgresai' ,
101
- pg_major_version : '13' ,
102
- tag : '13-0.3.0' ,
103
- location : `${ genericImagePrefix } :13-0.3.0` ,
104
- } ,
105
- {
106
- package_group : 'postgresai' ,
107
- pg_major_version : '14' ,
108
- tag : '14-0.4.1' ,
109
- location : `${ genericImagePrefix } :14-0.4.1` ,
110
- } ,
111
- {
112
- package_group : 'postgresai' ,
113
- pg_major_version : '14' ,
114
- tag : '14-0.3.0' ,
115
- location : `${ genericImagePrefix } :14-0.3.0` ,
116
- } ,
117
- {
118
- package_group : 'postgresai' ,
119
- pg_major_version : '15' ,
120
- tag : '15-0.4.1' ,
121
- location : `${ genericImagePrefix } :15-0.4.1` ,
122
- } ,
123
- {
124
- package_group : 'postgresai' ,
125
- pg_major_version : '15' ,
126
- tag : '15-0.3.0' ,
127
- location : `${ genericImagePrefix } :15-0.3.0` ,
128
- } ,
129
- {
130
- package_group : 'postgresai' ,
131
- pg_major_version : '16' ,
132
- tag : '16rc1-0.4.1' ,
133
- location : `${ genericImagePrefix } :16rc1-0.4.1` ,
134
- } ,
135
- {
136
- package_group : 'postgresai' ,
137
- pg_major_version : '16' ,
138
- tag : '16-0.3.0' ,
139
- location : `${ genericImagePrefix } :16-0.3.0` ,
140
- } ,
141
- ]
87
+ export const genericDockerImages = createDockerImages ( dockerImagesConfig )
142
88
143
89
export const isSeDockerImage = ( dockerImage : string | undefined ) => {
144
90
const dockerImageType =
0 commit comments