Skip to content

Commit 3f8b05c

Browse files
committed
chore(docker): Handle classic image generation and generate for beta 1
1 parent 52b92f6 commit 3f8b05c

File tree

12 files changed

+154
-25
lines changed

12 files changed

+154
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.1-apache
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.1-fpm
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.2-apache
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.2-fpm
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.3-apache
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.3-fpm
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.4-apache
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM prestashop/base:8.4-fpm
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
ENV PS_VERSION 9.0.0-beta.1-classic
5+
6+
# Get PrestaShop
7+
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip
8+
9+
# Extract
10+
RUN mkdir -p /tmp/data-ps \
11+
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
12+
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
13+
&& rm /tmp/prestashop.zip

prestashop_docker/generator.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self, directory_path, template, nightly_template, branch_template):
2424
self.download_url = 'https://www.prestashop.com/download/old/' \
2525
'prestashop_{}.zip'
2626
self.download_url_github = 'https://github.com/PrestaShop/PrestaShop/releases/download/{}/prestashop_{}.zip'
27+
self.download_url_github_classic = 'https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/{}/prestashop_{}.zip'
2728
self.directory_path = directory_path
2829
self.template = Template(template)
2930
self.nightly_template = Template(nightly_template)
@@ -92,7 +93,10 @@ def generate_image(self, ps_version, container_version):
9293
use_github_url = False
9394

9495
if use_github_url:
95-
ps_url = self.download_url_github.format(ps_version, ps_version)
96+
if parsed_version['flavor_versions'] == 'classic':
97+
ps_url = self.download_url_github_classic.format(ps_version, ps_version)
98+
else:
99+
ps_url = self.download_url_github.format(ps_version, ps_version)
96100
else:
97101
ps_url = self.download_url.format(ps_version)
98102
f.write(

prestashop_docker/version_manager.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,21 @@ def get_version_from_string(self, version):
9595
9696
@param version: The version you want
9797
@type version: str
98-
@return: A tuple containing ('PS_VERSION', 'BRANCH_VERSION', (PHP_VERSIONS), 'CONTAINER_TYPE')
99-
or ('PS_VERSION', 'BRANCH_VERSION', 'PHP_VERSION', 'CONTAINER_TYPE')
98+
@return: A tuple containing ('PS_VERSION', 'BRANCH_VERSION', (PHP_VERSIONS), 'CONTAINER_TYPE', 'FLAVOR_VERSION')
99+
or ('PS_VERSION', 'BRANCH_VERSION', 'PHP_VERSION', 'CONTAINER_TYPE', 'FLAVOR_VERSION')
100100
@rtype: tuple
101101
'''
102102
matches = self.parse_version_from_string(version)
103103
if not matches:
104104
return None
105105

106106
ps_version = matches.group('version')
107+
108+
flavor_versions = None
109+
if matches.group('flavor'):
110+
flavor_versions = matches.group('flavor')
111+
ps_version = ps_version + '-' + flavor_versions
112+
107113
if matches.group('php'):
108114
php_versions = (matches.group('php'),)
109115
else:
@@ -140,7 +146,8 @@ def get_version_from_string(self, version):
140146
'ps_version': ps_version,
141147
'branch_version': branch_version,
142148
'php_versions': php_versions,
143-
'container_version': container_version
149+
'container_version': container_version,
150+
'flavor_versions': flavor_versions
144151
}
145152

146153
def get_last_patch_from_version(self, version):
@@ -201,7 +208,7 @@ def parse_version_from_string(self, version):
201208
@return: Return None if no position in the string matches the pattern otherwise a Match object.
202209
@rtpe: None|Match
203210
'''
204-
regex = r"^(?P<version>(?:[0-9]+\.){0,3}(?:[0-9]+|nightly|x)(?:-(?:alpha|beta|rc)(?:\.\d+)?(?:\+\d+)?)?)(?:-(?P<php>\d+\.\d+))?(?:-(?P<container>fpm|apache))?$"
211+
regex = r"^(?P<version>(?:[0-9]+\.){0,3}(?:[0-9]+|nightly|x)(?:-(?:alpha|beta|rc)(?:\.\d+)?(?:\+\d+)?)?)(?:-(?P<flavor>classic))?(?:-(?P<php>\d+\.\d+))?(?:-(?P<container>fpm|apache))?$"
205212
return re.search(regex, version)
206213

207214
def get_aliases(self):

tests/prestashop_docker/test_version_manager.py

+28-20
Original file line numberDiff line numberDiff line change
@@ -141,35 +141,35 @@ def test_get_version_from_string_with_ps_version(self):
141141
# Existing patch versions deduce the branch version with a finishing x
142142
result = self.version_manager.get_version_from_string('1.7.6.8')
143143
self.assertEqual(
144-
{'ps_version': '1.7.6.8', 'branch_version': '1.7.6.x', 'php_versions': ('5.6', '7.1', '7.2'), 'container_version': None},
144+
{'ps_version': '1.7.6.8', 'branch_version': '1.7.6.x', 'php_versions': ('5.6', '7.1', '7.2'), 'container_version': None, 'flavor_versions': None},
145145
result
146146
)
147147
result = self.version_manager.get_version_from_string('8.0.0')
148148
self.assertEqual(
149-
{'ps_version': '8.0.0', 'branch_version': '8.0.x', 'php_versions': ('7.2', '7.3', '7.4', '8.0', '8.1'), 'container_version': None},
149+
{'ps_version': '8.0.0', 'branch_version': '8.0.x', 'php_versions': ('7.2', '7.3', '7.4', '8.0', '8.1'), 'container_version': None, 'flavor_versions': None},
150150
result
151151
)
152152
# Branch input return target version patch + 1
153153
result = self.version_manager.get_version_from_string('8.1.x')
154154
self.assertEqual(
155-
{'ps_version': '8.1.4', 'branch_version': '8.1.x', 'php_versions': ('7.2', '7.3', '7.4', '8.0', '8.1'), 'container_version': None},
155+
{'ps_version': '8.1.4', 'branch_version': '8.1.x', 'php_versions': ('7.2', '7.3', '7.4', '8.0', '8.1'), 'container_version': None, 'flavor_versions': None},
156156
result
157157
)
158158
result = self.version_manager.get_version_from_string('1.7.6.x')
159159
self.assertEqual(
160-
{'ps_version': '1.7.6.25', 'branch_version': '1.7.6.x', 'php_versions': ('5.6', '7.1', '7.2'), 'container_version': None},
160+
{'ps_version': '1.7.6.25', 'branch_version': '1.7.6.x', 'php_versions': ('5.6', '7.1', '7.2'), 'container_version': None, 'flavor_versions': None},
161161
result
162162
)
163163
# Branch input with no other patch versions returns patch 0
164164
result = self.version_manager.get_version_from_string('9.0.x')
165165
self.assertEqual(
166-
{'ps_version': '9.0.0', 'branch_version': '9.0.x', 'php_versions': ('8.1', '8.2', '8.3'), 'container_version': None},
166+
{'ps_version': '9.0.0', 'branch_version': '9.0.x', 'php_versions': ('8.1', '8.2', '8.3'), 'container_version': None, 'flavor_versions': None},
167167
result
168168
)
169169
# Nightly version uses develop as the branch
170170
result = self.version_manager.get_version_from_string('nightly')
171171
self.assertEqual(
172-
{'ps_version': 'nightly', 'branch_version': 'develop', 'php_versions': ('7.1', '7.2', '7.3'), 'container_version': None},
172+
{'ps_version': 'nightly', 'branch_version': 'develop', 'php_versions': ('7.1', '7.2', '7.3'), 'container_version': None, 'flavor_versions': None},
173173
result
174174
)
175175

@@ -184,84 +184,92 @@ def test_get_version_from_string_with_invalid_version(self):
184184
def test_get_version_from_string_with_container_version(self):
185185
result = self.version_manager.get_version_from_string('1.7.6.8-5.6')
186186
self.assertEqual(
187-
{'ps_version': '1.7.6.8', 'branch_version': '1.7.6.x', 'php_versions': ('5.6',), 'container_version': None},
187+
{'ps_version': '1.7.6.8', 'branch_version': '1.7.6.x', 'php_versions': ('5.6',), 'container_version': None, 'flavor_versions': None},
188188
result
189189
)
190190
result = self.version_manager.get_version_from_string('8.0.0-7.2')
191191
self.assertEqual(
192-
{'ps_version': '8.0.0', 'branch_version': '8.0.x', 'php_versions': ('7.2',), 'container_version': None},
192+
{'ps_version': '8.0.0', 'branch_version': '8.0.x', 'php_versions': ('7.2',), 'container_version': None, 'flavor_versions': None},
193193
result
194194
)
195195
result = self.version_manager.get_version_from_string('9.0.x-8.2')
196196
self.assertEqual(
197-
{'ps_version': '9.0.0', 'branch_version': '9.0.x', 'php_versions': ('8.2',), 'container_version': None},
197+
{'ps_version': '9.0.0', 'branch_version': '9.0.x', 'php_versions': ('8.2',), 'container_version': None, 'flavor_versions': None},
198198
result
199199
)
200200
result = self.version_manager.get_version_from_string('nightly-7.2')
201201
self.assertEqual(
202-
{'ps_version': 'nightly', 'branch_version': 'develop', 'php_versions': ('7.2',), 'container_version': None},
202+
{'ps_version': 'nightly', 'branch_version': 'develop', 'php_versions': ('7.2',), 'container_version': None, 'flavor_versions': None},
203203
result
204204
)
205205

206206
@patch('prestashop_docker.version_manager.VERSIONS', all_versions)
207207
def test_get_version_from_string_with_container_version_and_type(self):
208208
result = self.version_manager.get_version_from_string('1.7.6.8-5.6-fpm')
209209
self.assertEqual(
210-
{'ps_version': '1.7.6.8', 'branch_version': '1.7.6.x', 'php_versions': ('5.6',), 'container_version': 'fpm'},
210+
{'ps_version': '1.7.6.8', 'branch_version': '1.7.6.x', 'php_versions': ('5.6',), 'container_version': 'fpm', 'flavor_versions': None},
211211
result
212212
)
213213
result = self.version_manager.get_version_from_string('8.0.0-7.2-fpm')
214214
self.assertEqual(
215-
{'ps_version': '8.0.0', 'branch_version': '8.0.x', 'php_versions': ('7.2',), 'container_version': 'fpm'},
215+
{'ps_version': '8.0.0', 'branch_version': '8.0.x', 'php_versions': ('7.2',), 'container_version': 'fpm', 'flavor_versions': None},
216216
result
217217
)
218218
result = self.version_manager.get_version_from_string('9.0.x-8.2-fpm')
219219
self.assertEqual(
220-
{'ps_version': '9.0.0', 'branch_version': '9.0.x', 'php_versions': ('8.2',), 'container_version': 'fpm'},
220+
{'ps_version': '9.0.0', 'branch_version': '9.0.x', 'php_versions': ('8.2',), 'container_version': 'fpm', 'flavor_versions': None},
221221
result
222222
)
223223
result = self.version_manager.get_version_from_string('nightly-7.2-fpm')
224224
self.assertEqual(
225-
{'ps_version': 'nightly', 'branch_version': 'develop', 'php_versions': ('7.2',), 'container_version': 'fpm'},
225+
{'ps_version': 'nightly', 'branch_version': 'develop', 'php_versions': ('7.2',), 'container_version': 'fpm', 'flavor_versions': None},
226226
result
227227
)
228228

229229
@patch('prestashop_docker.version_manager.VERSIONS', all_versions)
230230
def test_get_version_from_string_with_pre_release_and_without_container_version_and_type(self):
231231
result = self.version_manager.get_version_from_string('1.7.7.0-rc.1')
232232
self.assertEqual(
233-
{'ps_version': '1.7.7.0-rc.1', 'branch_version': '1.7.7.x', 'php_versions': ('7.1', '7.2', '7.3'), 'container_version': None},
233+
{'ps_version': '1.7.7.0-rc.1', 'branch_version': '1.7.7.x', 'php_versions': ('7.1', '7.2', '7.3'), 'container_version': None, 'flavor_versions': None},
234234
result
235235
)
236236
result = self.version_manager.get_version_from_string('8.0.0-rc.1')
237237
self.assertEqual(
238-
{'ps_version': '8.0.0-rc.1', 'branch_version': '8.0.x', 'php_versions': ('7.2', '7.3', '7.4', '8.0', '8.1'), 'container_version': None},
238+
{'ps_version': '8.0.0-rc.1', 'branch_version': '8.0.x', 'php_versions': ('7.2', '7.3', '7.4', '8.0', '8.1'), 'container_version': None, 'flavor_versions': None},
239239
result
240240
)
241241

242242
@patch('prestashop_docker.version_manager.VERSIONS', all_versions)
243243
def test_get_version_from_string_with_pre_release_and_php_version_and_without_container_version(self):
244244
result = self.version_manager.get_version_from_string('1.7.7.0-rc.1-7.3')
245245
self.assertEqual(
246-
{'ps_version': '1.7.7.0-rc.1', 'branch_version': '1.7.7.x', 'php_versions': ('7.3',), 'container_version': None},
246+
{'ps_version': '1.7.7.0-rc.1', 'branch_version': '1.7.7.x', 'php_versions': ('7.3',), 'container_version': None, 'flavor_versions': None},
247247
result
248248
)
249249
result = self.version_manager.get_version_from_string('8.0.0-rc.1-7.3')
250250
self.assertEqual(
251-
{'ps_version': '8.0.0-rc.1', 'branch_version': '8.0.x', 'php_versions': ('7.3',), 'container_version': None},
251+
{'ps_version': '8.0.0-rc.1', 'branch_version': '8.0.x', 'php_versions': ('7.3',), 'container_version': None, 'flavor_versions': None},
252252
result
253253
)
254254

255255
@patch('prestashop_docker.version_manager.VERSIONS', all_versions)
256256
def test_get_version_from_string_with_pre_release_and_php_version_and_with_container_version(self):
257257
result = self.version_manager.get_version_from_string('1.7.7.0-rc.1-7.3-apache')
258258
self.assertEqual(
259-
{'ps_version': '1.7.7.0-rc.1', 'branch_version': '1.7.7.x', 'php_versions': ('7.3',), 'container_version': 'apache'},
259+
{'ps_version': '1.7.7.0-rc.1', 'branch_version': '1.7.7.x', 'php_versions': ('7.3',), 'container_version': 'apache', 'flavor_versions': None},
260260
result
261261
)
262262
result = self.version_manager.get_version_from_string('8.0.0-rc.1-7.3-apache')
263263
self.assertEqual(
264-
{'ps_version': '8.0.0-rc.1', 'branch_version': '8.0.x', 'php_versions': ('7.3',), 'container_version': 'apache'},
264+
{'ps_version': '8.0.0-rc.1', 'branch_version': '8.0.x', 'php_versions': ('7.3',), 'container_version': 'apache', 'flavor_versions': None},
265+
result
266+
)
267+
268+
@patch('prestashop_docker.version_manager.VERSIONS', all_versions)
269+
def test_get_version_from_string_with_flavor_versions(self):
270+
result = self.version_manager.get_version_from_string('9.0.0-beta.1-classic')
271+
self.assertEqual(
272+
{'ps_version': '9.0.0-beta.1', 'branch_version': '9.0.x', 'php_versions': ('8.1','8.2','8.3','8.4',), 'container_version': None, 'flavor_versions': 'classic'},
265273
result
266274
)
267275

versions.py

+6
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@
294294
'8.3',
295295
'8.4',
296296
),
297+
'9.0.0-beta.1-classic': (
298+
'8.1',
299+
'8.2',
300+
'8.3',
301+
'8.4',
302+
),
297303
'nightly': (
298304
'8.1',
299305
'8.2',

0 commit comments

Comments
 (0)