Skip to content

Resync magento #804

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ on:
pull_request:
branches:
- master
- main
env:
# @todo I dont think this is needed anymore
GITHUB_TOKEN: ${{ secrets.TEMPLATES_GITHUB_TOKEN }}
jobs:
test-pr-env:
name: TestPrEnvironment
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'platformsh-templates' }}
steps:
- name: 'Wait for psh and get target url'
- name: 'Get Project ID'
id: 'get-proj-id'
uses: platformsh/gha-retrieve-projectid@main
with:
github_token: ${{ secrets.TEMPLATES_GITHUB_TOKEN }}

- name: 'Get Production URL'
id: 'get-prod-url'
uses: platformsh/gha-retrieve-production-url@main
with:
platformsh_token: ${{ secrets.TEMPLATES_CLI_TOKEN }}
project_id: ${{ steps.get-proj-id.outputs.project_id }}

- name: 'Run Pull Request Tests'
id: get-target-url
uses: platformsh/gha-retrieve-psh-prenv-url@main
uses: platformsh/gha-template-pr-tests@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Does Our App Work?'
id: test-environment
run: |
target_url=${{ steps.get-target-url.outputs.target_url }}
echo "::notice::The target url returned from our github action: ${target_url}"
#ok, so for whatever strange reason, our integration returns the http version of the PR environment, not https
#hence to parameter expansion replacement.
#we dont need the whole response (yet), just see if we get a 200
response=$(curl -s -o /dev/null -I -w "%{http_code}" "${target_url//http:/https:}");
if [[ "200" == "${response}" ]]; then
echo "::notice::Environment responded with http header 200"
else
echo "::error::Response from environment was something other than 200. Response returned was ${response}"
exit 1;
fi

baseline-url: ${{ steps.get-prod-url.outputs.production_url }}
193 changes: 96 additions & 97 deletions project/magento.py
Original file line number Diff line number Diff line change
@@ -1,121 +1,120 @@
import os
from . import BaseProject

# from .remote import RemoteProject

# "repositories": {
# "Magento Repo Auth Required": {
# "type": "composer",
# "url": "https://repo.magento.com"
# },
# "ECE-Tools": {
# "type": "git",
# "url": "https://github.com/magento/ece-tools.git"
# },
# "Magento Cloud Components": {
# "type": "git",
# "url": "https://github.com/magento/magento-cloud-components.git"
# },
# "Magento Cloud Patches": {
# "type": "git",
# "url": "https://github.com/magento/magento-cloud-patches.git"
# },
# "Magento Quality Patches": {
# "type": "git",
# "url": "https://github.com/magento/quality-patches.git"
# }
# },
# "extra": {
# "magento-force": "override"
# }
# from .remote import RemoteProject

# "config": {
# "preferred-install": "dist",
# "sort-packages": true,
# "allow-plugins": {
# "composer/installers": true,
# "laminas/laminas-dependency-plugin": true,
# "magento/composer-dependency-version-audit-plugin": true,
# "magento/inventory-composer-installer": true,
# "magento/magento-composer-installer": true
# }
# },
# "require": {
# "magento/ece-tools": "^2002.1.6",
# "magento/magento-cloud-components": "^1.0.7",
# "magento/magento-cloud-patches": "^1.0.10",
# "magento/product-community-edition": "^2.4",
# "magento/quality-patches": "^1.0.22",
# "wolfsellers/module-enabledisabletfa": "^1.0"
# },
# "repositories": {
# "Magento Repo Auth Required": {
# "type": "composer",
# "url": "https://repo.magento.com"
# },
# "ECE-Tools": {
# "type": "git",
# "url": "https://github.com/magento/ece-tools.git"
# },
# "Magento Cloud Components": {
# "type": "git",
# "url": "https://github.com/magento/magento-cloud-components.git"
# },
# "Magento Cloud Patches": {
# "type": "git",
# "url": "https://github.com/magento/magento-cloud-patches.git"
# },
# "Magento Quality Patches": {
# "type": "git",
# "url": "https://github.com/magento/quality-patches.git"
# }
# },
# "extra": {
# "magento-force": "override"
# }

# "config": {
# "preferred-install": "dist",
# "sort-packages": true,
# "allow-plugins": {
# "composer/installers": true,
# "laminas/laminas-dependency-plugin": true,
# "magento/composer-dependency-version-audit-plugin": true,
# "magento/inventory-composer-installer": true,
# "magento/magento-composer-installer": true
# }
# },
# "require": {
# "magento/ece-tools": "^2002.1.6",
# "magento/magento-cloud-components": "^1.0.7",
# "magento/magento-cloud-patches": "^1.0.10",
# "magento/product-community-edition": "^2.4",
# "magento/quality-patches": "^1.0.22",
# "wolfsellers/module-enabledisabletfa": "^1.0"
# },

class Magento2ce(BaseProject):
# updateCommands = {
# 'composer.json': 'composer update -W --ignore-platform-req=ext-apcu --ignore-platform-req=ext-imagick',
# }

def package_update_actions(self):
actions = super(Magento2ce, self).package_update_actions()
return [
'cd {0} && composer config -g allow-plugins.composer/installers true --no-plugins'.format(
self.builddir),
'cd {0} && composer config allow-plugins.composer/installers true --no-plugins'.format(
self.builddir),
] + actions
# def package_update_actions(self):
# actions = super(Magento2ce, self).package_update_actions()
# return [
# 'cd {0} && composer config -g allow-plugins.composer/installers true --no-plugins'.format(
# self.builddir),
# 'cd {0} && composer config allow-plugins.composer/installers true --no-plugins'.format(
# self.builddir),
# ] + actions

@property
def update(self):

def magento_modify_composer(composer):
"""
This change makes the template loadable via Composer.
"""

composer['name']= "platformsh/{0}".format(projectName)
composer['description']= "Magento 2 CE(Community Edition) for Platform.sh"

composer['repositories'] = {
"Magento Repo Auth Required": {
"type": "composer",
"url": "https://repo.magento.com"
},
"ECE-Tools": {
"type": "git",
"url": "https://github.com/magento/ece-tools.git"
},
"Magento Cloud Components": {
"type": "git",
"url": "https://github.com/magento/magento-cloud-components.git"
},
"Magento Cloud Patches": {
"type": "git",
"url": "https://github.com/magento/magento-cloud-patches.git"
},
"Magento Quality Patches": {
"type": "git",
"url": "https://github.com/magento/quality-patches.git"
}
}
composer['name'] = "platformsh/{0}".format(projectName)
composer['description'] = "Magento 2 CE(Community Edition) for Platform.sh"

# composer['repositories'] = {
# "Magento Repo Auth Required": {
# "type": "composer",
# "url": "https://repo.magento.com"
# },
# "ECE-Tools": {
# "type": "git",
# "url": "https://github.com/magento/ece-tools.git"
# },
# "Magento Cloud Components": {
# "type": "git",
# "url": "https://github.com/magento/magento-cloud-components.git"
# },
# "Magento Cloud Patches": {
# "type": "git",
# "url": "https://github.com/magento/magento-cloud-patches.git"
# },
# "Magento Quality Patches": {
# "type": "git",
# "url": "https://github.com/magento/quality-patches.git"
# }
# }

return composer


ROOTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATEDIR = os.path.join(ROOTDIR, 'templates/magento2ce')

# Quickstart project package name, used in the block below.
# ROOTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# TEMPLATEDIR = os.path.join(ROOTDIR, 'templates/magento2ce')
#
# # Quickstart project package name, used in the block below.
projectName = "magento2ce"

return super(Magento2ce, self).update + [
'cd {0} && composer create-project --repository-url=https://repo.magento.com/ '
'magento/project-community-edition {1} --ignore-platform-req=ext-iconv --ignore-platform-req=ext-soap '
'--ignore-platform-req=ext-pdo_mysql {2}'.format(TEMPLATEDIR, projectName, self.composer_defaults()),

'rm -rf {0}/*'.format(self.builddir),
'cd {0} && git add . && git commit -m "Clear previous template."'.format(self.builddir),

'cd {0} && cp -r {1}/{2}/* .'.format(self.builddir, TEMPLATEDIR, projectName),
'rm -rf {0}/{1}'.format(TEMPLATEDIR, projectName),
# 'cd {0} && composer create-project --repository-url=https://repo.magento.com/ '
# 'magento/project-community-edition {1} --ignore-platform-req=ext-iconv --ignore-platform-req=ext-soap '
# '--ignore-platform-req=ext-pdo_mysql {2}'.format(TEMPLATEDIR, projectName, self.composer_defaults()),
#
# 'rm -rf {0}/*'.format(self.builddir),
# 'cd {0} && git add . && git commit -m "Clear previous template."'.format(self.builddir),
#
# 'cd {0} && cp -r {1}/{2}/* .'.format(self.builddir, TEMPLATEDIR, projectName),
# 'rm -rf {0}/{1}'.format(TEMPLATEDIR, projectName),
(self.modify_composer, [magento_modify_composer])
]

Expand All @@ -125,7 +124,7 @@ def platformify(self):
'--ignore-platform-req=ext-pdo_mysql '

return super(Magento2ce, self).platformify + [
'cd {0} && composer require magento/ece-tools magento/magento-cloud-components '
'magento/quality-patches -W '.format(self.builddir) + self.composer_defaults() + extraIgnores,
'cd {0} && composer update -W {1}'.format(self.builddir, self.composer_defaults() + extraIgnores),
]
# 'cd {0} && composer require magento/ece-tools magento/magento-cloud-components '
# 'magento/quality-patches -W '.format(self.builddir) + self.composer_defaults() + extraIgnores,
'cd {0} && composer update -W {1}'.format(self.builddir, self.composer_defaults() + extraIgnores),
]
48 changes: 0 additions & 48 deletions templates/magento2ce/files/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ atlassian*
/package.json
/.php_cs
/.php_cs.cache
/.php-cs-fixer.php
/.php-cs-fixer.cache
/grunt-config.json
/pub/media/*.*
!/pub/media/.htaccess
Expand All @@ -60,8 +58,6 @@ atlassian*
/pub/media/tmp/*
!/pub/media/tmp/.htaccess
/pub/media/captcha/*
/pub/media/sitemap/*
!/pub/media/sitemap/.htaccess
/pub/static/*
!/pub/static/.htaccess

Expand All @@ -72,47 +68,3 @@ atlassian*
/generated/*
!/generated/.htaccess
.DS_Store

# Platform.sh
app/*
!app/.htaccess
!app/etc/vendor_path.php
bin/*
!bin/.htaccess
dev
!dev/.htaccess
generated/*
!generated/.htaccess
lib/*
!lib/.htaccess
phpserver/*
!phpserver/.htaccess
!phpserver/README.md

pub/*
!pub/.htaccess
!pub/errors/.htaccess
!pub/static/.htaccess
setup/*
!setup/.htaccess
!setup/config/.htaccess
!setup/performance-toolkit/.htaccess
!setup/pub/.htaccess
!setup/src/.htaccess
!setup/view/.htaccess

.php-cs-fixer.dist.php
.user.ini
Gruntfile.js.sample
auth.json.sample
grunt-config.json.sample
nginx.conf.sample
package.json.sample
.htaccess.sample

docker-sync.yml
mutagen.sh
php.dev.ini
.php_cs.dist
.travic.yml.simple
.user.ini
Loading