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

Fix docker env variable for version 8 #673

Merged
merged 3 commits into from
Feb 26, 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
5 changes: 2 additions & 3 deletions .github/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ runs:
- name: Build docker compose stack
env:
VERSION: ${{ matrix.from }}
BASE_VERSION: ${{ startsWith(matrix.from, '1.6') && '7.1-apache' || startsWith(matrix.from, '8.1') && '8.1-apache' || startsWith(matrix.from, '8.0') && '8.1-apache' || '7.2-apache' }}
shell: bash
run: |
bash -c 'if [[ "${VERSION}" == 1.6* ]]; then export BASE_VERSION=7.1-apache; \
elif [[ "${VERSION}" == 8.* ]]; then export BASE_VERSION=8.1-apache; \
else export BASE_VERSION=7.2-apache; fi && docker compose up -d'
docker compose up -d
bash -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost:8001/index.php)" != "200" ]]; do sleep 5; done'
- name: Copy autoupgrade module
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: PHP tests
on: [push, pull_request]
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Check there is no syntax errors in the project
php-linter:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Upgrades
on: [push, pull_request]
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
upgrade:
strategy:
matrix:
from: ['1.7.6.9', '1.7.6.1', '1.7.7.0', '8.0.0']
from: ['1.7.6.9', '1.7.6.1', '1.7.7.0', '8.0.0', '8.1.0']
ps-versions:
- channel: minor
- channel: major
Expand Down
5 changes: 4 additions & 1 deletion AdminSelfUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
use PrestaShop\Module\AutoUpgrade\UpgradeSelfCheck;
use PrestaShop\Module\AutoUpgrade\UpgradeTools\FilesystemAdapter;

require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/vendor/autoload.php';
$autoloadPath = __DIR__ . '/vendor/autoload.php';
if (file_exists($autoloadPath)) {
require_once $autoloadPath;
}

class AdminSelfUpgrade extends AdminController
{
Expand Down
10 changes: 9 additions & 1 deletion autoupgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ public function uninstall()
*/
public function registerHookAndSetToTop($hookName)
{
return $this->registerHook($hookName) && $this->updatePosition((int) Hook::getIdByName($hookName), false);
if (!$this->registerHook($hookName)) {
return false;
}

// Updating position is not blocking for installation esepcially since this method returns false when no other
// module is hooked, which doesn't mean the module can't work as expected.
$this->updatePosition((int) Hook::getIdByName($hookName), false);

return true;
}

public function hookDashboardZoneOne($params)
Expand Down
21 changes: 14 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
version: '2'
version: '2.1'

volumes:
db-data:
vendor:
var:
temp-ps:

services:
mysql:
image: mysql:5.7
ports:
- '3306'
- "3306"
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: psreference

restart: always
reference-release:
container_name: prestashop_autoupgrade
build:
Expand All @@ -21,21 +29,20 @@ services:
- ./:/var/www/html/modules/autoupgrade
- temp-ps:/var/www/html # Used for another container which needs PrestaShop content
environment:
DISABLE_MAKE: 0
PS_INSTALL_AUTO: 1
DB_SERVER: mysql
DB_PASSWD: root
DB_NAME: psreference
PS_DOMAIN: localhost:8001
PS_INSTALL_AUTO: 1
PS_INSTALL_DB: 1
PS_ERASE_DB: 1
PS_FOLDER_ADMIN: admin-dev
PS_FOLDER_INSTALL: install-dev
PS_LANGUAGE: en
PS_COUNTRY: fr
PS_DEV_MODE: 0
depends_on:
- mysql
ports:
- '8001:80'

volumes:
temp-ps:
Loading