Skip to content

Commit

Permalink
Support Spryker 202009 release (#398)
Browse files Browse the repository at this point in the history
* Change spryker version in config

* Fix dependency issues
Removed outdated behat extensions and fix symfony/browser-kit version

* Update behat config

* Remove db_engine config

* Change spryker version in config

* Fix dependency issues
Removed outdated behat extensions and fix symfony/browser-kit version

* Update behat config

* Remove db_engine config

* Update installation recipe as per spryker cli command changes

* Ignore .idea dir

* Run development command only in development mode

* Config changes
Keep using Pyz namespace as project namespace, as there is some code expecting some templates to be in project namespace and we don't want to copy them over to Inviqa namespace

* Add fix values for oauth credentials

* Spryker demoshop is not compatible with phpstan level 5

* Add baseline for phpstan to run it with level 5

* Use latest php/redis/es versions supported by latest Spryker release

* Remove fixed secrets and add helper command to generate them

* Switch to development mode before after creating images in CI

* Revert "Switch to development mode before after creating images in CI"

This reverts commit 9db64b7.

* Allow injecting spryker oauth secrets from Jenkins CI env

* Use encrypted value for CI env
  • Loading branch information
Hardik Gajjar authored Oct 13, 2020
1 parent b086cea commit d11b291
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/github-changelog-http-cache/
/tests/
/tmp-test/
.idea
19 changes: 19 additions & 0 deletions src/_base/harness/config/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,22 @@ command('harness update fresh'):
ws disable || true
rm -rf .my127ws
ws install
command('generate token <length>'):
env:
LENGTH: = input.argument('length')
exec: |
#!php
$ascii_codes = range(48, 57) + range(97, 122) + range(65, 90);
$codes_length = (count($ascii_codes)-1);
shuffle($ascii_codes);
$string = '';
for($i = 1; $i <= $env['LENGTH']; $i++) {
$previous_char = $char ?? '';
$char = chr($ascii_codes[random_int(0, $codes_length)]);
while($char == $previous_char){
$char = chr($ascii_codes[random_int(0, $codes_length)]);
}
$string .= $char;
}
echo $string;
3 changes: 3 additions & 0 deletions src/spryker/.ci/sample-static/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ attribute('aws.bucket'): null
attribute('app.repository'): null
attribute('aws.id'): null
attribute('aws.key'): null

attribute('spryker.oauth_client_secret'): '= decrypt("YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoi/ZxjAtTonBTdHCfPRmh3rlDOOTPZ8oaVIjtpOjI7czo2NDoiXHkN92FXiuuj/PVZKwzJEKtsQzRtAEvdPSYT/6mEA2GVtk+98N4ch+y+MVbg6REiwTAFXOZSb7lEyqZOJMEY+iI7fQ==")'
attribute('spryker.zed_request_token'): '= decrypt("YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoi5TNpTpnAi3Yjlstw46A63Pvn1nnGoE1VIjtpOjI7czo5NjoiFHj6M4K5I2pUBD5t2nnjzhR6jixzGOtQl/HSBWWyrD9TFmg+Qw82CLZlqBYgQXaCDiOB1GV9tVKAuvvr9ntHZ0KWeZLu5spfhdaqcVsJVm2kxNX6A1YKb5mw/g4V4NvAIjt9")'
3 changes: 3 additions & 0 deletions src/spryker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ attribute('app.services'):
- jenkins-runner
```
To generate and encrypt secrets for pipeline environments:
https://github.com/inviqa/k8s-project-cluster/blob/0.1.x-dev/docs/cluster-management/sealed-secrets/README.md
[Workspace]: https://github.com/my127/workspace
51 changes: 51 additions & 0 deletions src/spryker/application/overlay/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$value of method Elastica\\\\Query\\\\Term\\:\\:setTerm\\(\\) expects array|string, int given\\.$#"
count: 1
path: src/Pyz/Client/ExampleProductSalePage/Plugin/Elasticsearch/Query/SaleSearchQueryPlugin.php

-
message: "#^Parameter \\#2 \\$default of method Symfony\\\\Component\\\\HttpFoundation\\\\InputBag\\:\\:get\\(\\) expects string|null, array given\\.$#"
count: 1
path: src/Pyz/Yves/ProductSetWidget/Widget/ProductSetIdsWidget.php

-
message: "#^Parameter \\#1 \\$input of function array_filter expects array, string given\\.$#"
count: 1
path: src/Pyz/Yves/ProductSetWidget/Widget/ProductSetIdsWidget.php

-
message: "#^Parameter \\#1 \\$exampleStateMachineItems of method Pyz\\\\Zed\\\\ExampleStateMachine\\\\Business\\\\Model\\\\ExampleStateMachineItemReader\\:\\:hydrateTransferFromPersistence\\(\\) expects#"
count: 2
path: src/Pyz/Zed/ExampleStateMachine/Business/Model/ExampleStateMachineItemReader.php

-
message: "#^Parameter \\#1 \\$command of class Symfony\\\\Component\\\\Process\\\\Process constructor expects array, string given\\.$#"
count: 2
path: src/Pyz/Zed/Log/Communication/Plugin/FilebeatLogListenerPlugin.php

-
message: "#^Parameter \\#1 \\$productFacade of class Pyz\\\\Zed\\\\ProductUrlCartConnector\\\\Business\\\\Expander\\\\ProductUrlExpander constructor expects Spryker\\\\Zed\\\\Product\\\\Business\\\\ProductFacadeInterface, Spryker\\\\Zed\\\\ProductRelation\\\\Business\\\\ProductRelationFacadeInterface given\\.$#"
count: 1
path: src/Pyz/Zed/ProductUrlCartConnector/Business/ProductUrlCartConnectorBusinessFactory.php

-
message: "#^Parameter \\#2 \\$serverUniqueId of method Spryker\\\\Zed\\\\Queue\\\\Business\\\\Process\\\\ProcessManager\\:\\:__construct\\(\\) expects string, int given\\.$#"
count: 1
path: src/Pyz/Zed/Queue/Business/Process/ProcessManager.php

-
message: "#^Parameter \\#2 \\$serverUniqueId of class Pyz\\\\Zed\\\\Queue\\\\Business\\\\Process\\\\ProcessManager constructor expects int, string given\\.$#"
count: 1
path: src/Pyz/Zed/Queue/Business/QueueBusinessFactory.php

-
message: "#^Parameter \\#3 \\$queueConfig of class Pyz\\\\Zed\\\\Queue\\\\Business\\\\Process\\\\ProcessManager constructor expects Pyz\\\\Zed\\\\Queue\\\\QueueConfig, Spryker\\\\Zed\\\\Queue\\\\QueueConfig given\\.$#"
count: 1
path: src/Pyz/Zed/Queue/Business/QueueBusinessFactory.php

-
message: "#^Parameter \\#2 \\$entityId of method Spryker\\\\Zed\\\\DataImport\\\\Business\\\\Model\\\\DataImportStep\\\\PublishAwareStep\\:\\:addPublishEvents\\(\\) expects int, Orm\\\\Zed\\\\Product\\\\Persistence\\\\SpyProductAbstract given\\.$#"
count: 1
path: src/Pyz/Zed/DataImport/Business/Model/ProductOption/ProductOptionWriterStep.php
3 changes: 1 addition & 2 deletions src/spryker/application/overlay/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
includes:
- phpstan-baseline.neon
- vendor/spryker-sdk/phpstan-spryker/extension.neon

parameters:
excludes_analyse:
- %rootDir%/../../../src/Generated/*
- %rootDir%/../../../src/Orm/*
# ignoring following dir temporarily due to errors in core
- %rootDir%/../../../src/Pyz/Zed/DataImport/Business/Model/*

bootstrap: %rootDir%/../../../phpstan-bootstrap.php

Expand Down
8 changes: 2 additions & 6 deletions src/spryker/application/skeleton/behat.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
default:
suites:
sample:
contexts_services:
- yves.plp.context
contexts:
- Acceptance\Context\Yves\ProductListPageContext
extensions:
Behat\MinkExtension:
default_session: goutte
Expand All @@ -23,10 +23,6 @@ default:
namespaces:
page: [Acceptance\Page]
element: [Acceptance\Element]
FriendsOfBehat\ContextServiceExtension:
imports:
- 'features/bootstrap/_config/contexts.yml'
FriendsOfBehat\CrossContainerExtension: ~
Cjm\Behat\StepThroughExtension: ~
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
local: # (google-chrome-stable --remote-debugging-port=9221 &) && socat tcp-l:9222,fork TCP4:127.0.0.1:9221
Expand Down
7 changes: 3 additions & 4 deletions src/spryker/application/skeleton/composer-harness.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
"require": {
},
"require-dev": {
"codeception/codeception": "~2.5.6",
"behat/behat": "^3.5",
"behat/mink": "^1.7",
"behat/mink-extension": "^2.3",
"behat/mink-goutte-driver": "^1.2",
"ciaranmcnulty/behat-stepthroughextension": "^1.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.6",
"friends-of-behat/context-service-extension": "^1.2",
"friends-of-behat/cross-container-extension": "^1.1",
"phpcompatibility/php-compatibility": "dev-master",
"sensiolabs/behat-page-object-extension": "^2.3"
"sensiolabs/behat-page-object-extension": "^2.3",
"guzzlehttp/guzzle": "^6.3.0",
"symfony/browser-kit": "^4.4"
},
"autoload-dev": {
"psr-4": {
Expand Down
13 changes: 4 additions & 9 deletions src/spryker/application/skeleton/config/Shared/config_local.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Spryker\Shared\Newsletter\NewsletterConstants;
use Spryker\Shared\ProductManagement\ProductManagementConstants;
use Spryker\Shared\Propel\PropelConstants;
use Spryker\Shared\PropelQueryBuilder\PropelQueryBuilderConstants;
use Spryker\Shared\RabbitMq\RabbitMqEnv;
use Spryker\Shared\Router\RouterConstants;
use Spryker\Shared\Scheduler\SchedulerConstants;
Expand All @@ -34,12 +33,12 @@
$config[ApplicationConstants::BASE_URL_YVES] = sprintf(
'http://%s%s',
$config[ApplicationConstants::HOST_YVES],
$config[ApplicationConstants::PORT_YVES]
''
);
$config[ApplicationConstants::BASE_URL_SSL_YVES] = sprintf(
'https://%s%s',
$config[ApplicationConstants::HOST_YVES],
$config[ApplicationConstants::PORT_SSL_YVES]
''
);
$config[ProductManagementConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
$config[NewsletterConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
Expand All @@ -61,12 +60,12 @@
$config[ApplicationConstants::BASE_URL_ZED] = sprintf(
'http://%s%s',
$config[ApplicationConstants::HOST_ZED],
$config[ApplicationConstants::PORT_ZED]
''
);
$config[ApplicationConstants::BASE_URL_SSL_ZED] = sprintf(
'https://%s%s',
$config[ApplicationConstants::HOST_ZED],
$config[ApplicationConstants::PORT_SSL_ZED]
''
);
$config[ZedRequestConstants::HOST_ZED_API] = $config[ApplicationConstants::HOST_ZED];
$config[ZedRequestConstants::BASE_URL_ZED_API] = $config[ApplicationConstants::BASE_URL_ZED];
Expand Down Expand Up @@ -104,9 +103,6 @@
$config[PropelConstants::ZED_DB_DATABASE] = getenv('DB_NAME');
$config[PropelConstants::ZED_DB_HOST] = getenv('DB_HOST');
$config[PropelConstants::ZED_DB_PORT] = 5432;
$config[PropelConstants::ZED_DB_ENGINE]
= $config[PropelQueryBuilderConstants::ZED_DB_ENGINE]
= $config[PropelConstants::ZED_DB_ENGINE_PGSQL];
$config[PropelConstants::USE_SUDO_TO_MANAGE_DATABASE] = false;

// ---------- Elasticsearch
Expand Down Expand Up @@ -201,7 +197,6 @@
$config[KernelConstants::DOMAIN_WHITELIST] = [];

// ---------- Namespaces
$config[KernelConstants::PROJECT_NAMESPACE] = 'Inviqa';
$config[KernelConstants::PROJECT_NAMESPACES] = [
'Inviqa',
'Pyz',
Expand Down
35 changes: 29 additions & 6 deletions src/spryker/application/skeleton/config/install/docker.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,31 @@ sections:
remove-cache:
command: "vendor/bin/console cache:empty-all"

remove-generated-files:
command: "vendor/bin/console setup:empty-generated-directory"
remove-auto-completion:
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console dev:ide-auto-completion:remove; fi"

remove-request-validation-cache:
command: "vendor/bin/console rest-api:remove-validation-cache"
stores: true

remove-navigation-cache:
command: "vendor/bin/console navigation:cache:remove"

remove-source-map:
command: "vendor/bin/console search:source-map:remove"

remove-databuilder:
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console transfer:databuilder:remove; fi"

remove-entity-transfer:
command: "vendor/bin/console transfer:entity:remove"

remove-transfer:
command: "vendor/bin/console transfer:remove"

generate:
prepare-propel:
command: "vendor/bin/console setup:deploy:prepare-propel"
command: "vendor/bin/console propel:deploy:prepare"

generate-transfers:
command: "vendor/bin/console transfer:generate"
Expand All @@ -68,7 +87,7 @@ sections:
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console transfer:databuilder:generate; fi"

generate-ide-auto-completion:
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console dev:ide:generate-auto-completion; fi"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console dev:ide-auto-completion:generate; fi"

scheduler-down:
scheduler-stop:
Expand All @@ -89,7 +108,11 @@ sections:
command: "vendor/bin/console navigation:build-cache"

rest-request-validation-cache-warmup:
command: "vendor/bin/console glue:rest:build-request-validation-cache"
command: "vendor/bin/console rest-api:build-request-validation-cache"
stores: true

class-resolver-build:
command: "vendor/bin/console cache:class-resolver:build"

queue-flush:
set-permissions:
Expand Down Expand Up @@ -209,7 +232,7 @@ sections:

demodata:
import:
command: "vendor/bin/console data:import"
command: "vendor/bin/console data:import --config=data/import/local/full_EU.yml"
stores:
- DE

Expand Down

This file was deleted.

8 changes: 5 additions & 3 deletions src/spryker/harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ attributes:
spryker:
salt: 2tkqCCRKy5rT4wMVz8KTCh8r3sJGkL5v
demoshop-url: https://github.com/spryker-shop/b2c-demo-shop.git
demoshop-version: 202001.0-p1
demoshop-version: "202009.0"
mode: development
oauth_client_secret: ~
zed_request_token: ~
php:
fpm:
ini:
max_execution_time: 600
version: 7.2
version: 7.4
ini:
opcache.max_accelerated_files: 65407
database:
Expand Down Expand Up @@ -80,7 +82,7 @@ attributes:
php-fpm: "= 'my127/spryker:' ~ @('php.version') ~ '-fpm-' ~ (@('php.version') >= 7.4 ? 'buster' : 'stretch')"
elasticsearch:
image: elasticsearch
tag: 5.6
tag: 6.8.12
redis:
protocol: redis
rabbitmq:
Expand Down
7 changes: 7 additions & 0 deletions src/spryker/harness/attributes/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ attributes:
JENKINS_EXTERNAL_HOST: = @('jenkins.external_host')
environment_secrets:
SPRYKER_SALT: = @('spryker.salt')
SPRYKER_OAUTH_CLIENT_IDENTIFIER: "frontend"
# not required for development env, must be set for remote (recommended size: 48)
SPRYKER_OAUTH_CLIENT_SECRET: = @('spryker.oauth_client_secret')
# not required for development env, must be set for remote (recommended size: 80)
SPRYKER_ZED_REQUEST_TOKEN: = @('spryker.zed_request_token')
jenkins:
enabled: "= 'jenkins' in @('app.services')"
image: jenkins:alpine
Expand All @@ -25,6 +30,8 @@ attributes:
RABBITMQ_DEFAULT_USER: spryker
environment_secrets:
RABBITMQ_DEFAULT_PASS: spryker
redis:
image: redis:5-alpine

pipeline:
base:
Expand Down

0 comments on commit d11b291

Please sign in to comment.