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

Support Spryker 202009 release #398

Merged
merged 23 commits into from
Oct 13, 2020
Merged

Conversation

hgajjar
Copy link

@hgajjar hgajjar commented Sep 11, 2020

Fixes #397 and #446

Work done:

  • Add support for latest Spryker release
  • Add phpstan baseline for Spryker demoshop files which does not support phpstan level 5
  • Use latest versions of PHP, Redis and Elasticsearch, which is supported by latest Spryker release

Hardik Gajjar added 3 commits September 11, 2020 18:37
Removed outdated behat extensions and fix symfony/browser-kit version
@hgajjar hgajjar added the wip Good for newcomers label Sep 11, 2020
@kierenevans kierenevans added this to the 0.11.0 milestone Sep 22, 2020
@kierenevans kierenevans force-pushed the feature/update-spryker-version branch from d1fe5e4 to 82abe52 Compare September 22, 2020 12:57
@kierenevans
Copy link
Contributor

I've rebased this on latest 0.10.x where the spryker build is now passing.

Tried ./build && ./test spryker static but got:

■ > vendor/bin/install -r docker -s generate
================================================================================
Install docker environment
================================================================================


 Section generate


Command prepare-propel [vendor/bin/console setup:deploy:prepare-propel] (In progress...)

In CommandLineExecutable.php line 107:

  Aborted install...


install [-r|--recipe RECIPE] [-d|--dry-run] [-s|--sections SECTIONS] [-g|--groups GROUPS] [-x|--exclude EXCLUDE] [-e|--include-excluded INCLUDE-EXCLUDED] [-i|--interactive] [-b|--breakpoint] [-a|--ask-before-continue] [-l|--log] [--] [<store>]

Store: DE | Environment: production
[2020-09-22T12:54:29.090185+00:00] Zed.ERROR: CLI command "setup:deploy:prepare-propel" exception, message "There are no commands defined in the "setup:deploy" namespace.

Did you mean one of these?
    propel:deploy
    setup" {"exception":"[object] (Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException(code: 0): There are no commands defined in the \"setup:deploy\" namespace.

Did you mean one of these?
    propel:deploy
    setup at /app/vendor/symfony/console/Application.php:597)
[stacktrace]
#0 /app/vendor/symfony/console/Application.php(650): Symfony\\Component\\Console\\Application->findNamespace('setup:deploy')
#1 /app/vendor/symfony/console/Application.php(235): Symfony\\Component\\Console\\Application->find('setup:deploy:pr...')
#2 /app/vendor/spryker/console/src/Spryker/Zed/Console/Communication/Bootstrap/ConsoleBootstrap.php(110): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#3 /app/vendor/symfony/console/Application.php(147): Spryker\\Zed\\Console\\Communication\\Bootstrap\\ConsoleBootstrap->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#4 /app/vendor/spryker/console/bin/console(27): Symfony\\Component\\Console\\Application->run()
#5 {main}
"} {"environment":{"application":"ZED","environment":"production","store":"DE","codeBucket":"DE","locale":"en_US"},"server":{"url":"http://:/","is_https":false,"hostname":"","user_agent":null,"user_ip":null,"request_method":"cli","referer":null},"request":{"requestId":"83b66632","type":"CLI","request_params":[]}}
[2020-09-22T12:54:29.116182+00:00] Zed.CRITICAL: Symfony\Component\Console\Exception\NamespaceNotFoundException - There are no commands defined in the "setup:deploy" namespace.

Did you mean one of these?
    propel:deploy
    setup in "/app/vendor/symfony/console/Application.php::597" {"exception":"[object] (Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException(code: 0): There are no commands defined in the \"setup:deploy\" namespace.

Did you mean one of these?
    propel:deploy
    setup at /app/vendor/symfony/console/Application.php:597)
[stacktrace]
#0 /app/vendor/symfony/console/Application.php(650): Symfony\\Component\\Console\\Application->findNamespace('setup:deploy')
#1 /app/vendor/symfony/console/Application.php(235): Symfony\\Component\\Console\\Application->find('setup:deploy:pr...')
#2 /app/vendor/spryker/console/src/Spryker/Zed/Console/Communication/Bootstrap/ConsoleBootstrap.php(110): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#3 /app/vendor/symfony/console/Application.php(147): Spryker\\Zed\\Console\\Communication\\Bootstrap\\ConsoleBootstrap->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#4 /app/vendor/spryker/console/bin/console(27): Symfony\\Component\\Console\\Application->run()
#5 {main}
"} {"environment":{"application":"ZED","environment":"production","store":"DE","codeBucket":"DE","locale":"en_US"},"server":{"url":"http://:/","is_https":false,"hostname":"","user_agent":null,"user_ip":null,"request_method":"cli","referer":null},"request":{"requestId":"83b66632","type":"CLI","request_params":[]}}
Symfony\Component\Console\Exception\NamespaceNotFoundException - Exception: There are no commands defined in the "setup:deploy" namespace.

Did you mean one of these?
    propel:deploy
    setup
in /app/vendor/symfony/console/Application.php (597)

Command: vendor/bin/console setup:deploy:prepare-propel

Trace:
#0 /app/vendor/symfony/console/Application.php(650): Symfony\Component\Console\Application->findNamespace('setup:deploy')
#1 /app/vendor/symfony/console/Application.php(235): Symfony\Component\Console\Application->find('setup:deploy:pr...')
#2 /app/vendor/spryker/console/src/Spryker/Zed/Console/Communication/Bootstrap/ConsoleBootstrap.php(110): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /app/vendor/symfony/console/Application.php(147): Spryker\Zed\Console\Communication\Bootstrap\ConsoleBootstrap->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /app/vendor/spryker/console/bin/console(27): Symfony\Component\Console\Application->run()
#5 {main}{"@timestamp":"2020-09-22T12:54:29.090185+00:00","@version":1,"host":"1695f00b5c35","message":"CLI command \"setup:deploy:prepare-propel\" exception, message \"There are no commands defined in the \"setup:deploy\" namespace.\n\nDid you mean one of these?\n    propel:deploy\n    setup\"","type":"ZED","channel":"Zed","level":"ERROR","monolog_level":400,"extra":{"environment":{"application":"ZED","environment":"production","store":"DE","codeBucket":"DE","locale":"en_US"},"server":{"url":"http://:/","is_https":false,"hostname":"","user_agent":null,"user_ip":null,"request_method":"cli","referer":null},"request":{"requestId":"83b66632","type":"CLI","request_params":[]}},"context":{"exception":{"class":"Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException","message":"There are no commands defined in the \"setup:deploy\" namespace.\n\nDid you mean one of these?\n    propel:deploy\n    setup","code":0,"file":"/app/vendor/symfony/console/Application.php:597","trace":["/app/vendor/symfony/console/Application.php:650","/app/vendor/symfony/console/Application.php:235","/app/vendor/spryker/console/src/Spryker/Zed/Console/Communication/Bootstrap/ConsoleBootstrap.php:110","/app/vendor/symfony/console/Application.php:147","/app/vendor/spryker/console/bin/console:27"]}}}
{"@timestamp":"2020-09-22T12:54:29.116182+00:00","@version":1,"host":"1695f00b5c35","message":"Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException - There are no commands defined in the \"setup:deploy\" namespace.\n\nDid you mean one of these?\n    propel:deploy\n    setup in \"/app/vendor/symfony/console/Application.php::597\"","type":"ZED","channel":"Zed","level":"CRITICAL","monolog_level":500,"extra":{"environment":{"application":"ZED","environment":"production","store":"DE","codeBucket":"DE","locale":"en_US"},"server":{"url":"http://:/","is_https":false,"hostname":"","user_agent":null,"user_ip":null,"request_method":"cli","referer":null},"request":{"requestId":"83b66632","type":"CLI","request_params":[]}},"context":{"exception":{"class":"Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException","message":"There are no commands defined in the \"setup:deploy\" namespace.\n\nDid you mean one of these?\n    propel:deploy\n    setup","code":0,"file":"/app/vendor/symfony/console/Application.php:597","trace":["/app/vendor/symfony/console/Application.php:650","/app/vendor/symfony/console/Application.php:235","/app/vendor/spryker/console/src/Spryker/Zed/Console/Communication/Bootstrap/ConsoleBootstrap.php:110","/app/vendor/symfony/console/Application.php:147","/app/vendor/spryker/console/bin/console:27"]}}}
ERROR: Service 'console' failed to build : The command '/bin/sh -c app build' returned a non-zero code: 1

Hardik Gajjar added 5 commits September 30, 2020 11:46
…rness-base-php into feature/update-spryker-version
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
@hgajjar hgajjar force-pushed the feature/update-spryker-version branch from f2073e0 to f3edcbe Compare September 30, 2020 09:58
@kierenevans kierenevans changed the base branch from 0.10.x to 0.11.x September 30, 2020 10:30
@hgajjar
Copy link
Author

hgajjar commented Sep 30, 2020

Let's go with max and ship a phpstan-baseline.neon, like we do for akeneo

yes, just desperate to make it green first 😄

Also found a funny thing, in composer.json of demoshop, they have level 5, but in travis etc. they don't use composer script and run the phpstan directly with level 4 🤦

kierenevans
kierenevans previously approved these changes Oct 1, 2020
Copy link
Contributor

@kierenevans kierenevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍

@hgajjar hgajjar added enhancement New feature or request and removed wip Good for newcomers labels Oct 5, 2020
@hgajjar hgajjar added the harness-spryker Spryker harness label Oct 5, 2020
Comment on lines 210 to 214
$config[OauthConstants::PRIVATE_KEY_PATH] = 'file://' . APPLICATION_ROOT_DIR . '/config/Zed/dev_only_private.key';
$config[OauthConstants::PUBLIC_KEY_PATH] = 'file://' . APPLICATION_ROOT_DIR . '/config/Zed/dev_only_public.key';
$config[OauthConstants::ENCRYPTION_KEY] = '6Go9YRlbogOQyHpGDkydw8ejC0Z36FboKkFL7mybT0mxB3Oz';
$config[OauthConstants::OAUTH_CLIENT_SECRET] = 'xN7uUeDzDpYtlp6oTrtC6aHGdA9Cy0gjF6hDaatiRkNyHEoc';
$config[AuthConstants::AUTH_DEFAULT_CREDENTIALS]['yves_system']['token'] = 'VEOJWp1gsANquUEiGT7pUJdmmS0cnLLCZZKZoiRUAGRyZtUUhNVuTUSeJ8Zz1i5N7ddwv9shJXGTwVmB';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #446 to convert these values to secrets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, we can't release this PR as a harness version without that though

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true. I'm happy to work on that ticket and create a child PR of this one, but need help to understand how to do it.

I think I can convert these values to workspace encrypted attributes for development env, but not sure how we would generate them during project setup using some twig function, also no idea how to generate sealed secrets for them at run time.

It would be nice if we can pair on it @andytson-inviqa or @kierenevans 😄

@hgajjar
Copy link
Author

hgajjar commented Oct 8, 2020

@kierenevans the missing configuration secrets are set to null by default (they would be set only for pipeline env). Spryker provides some fix values for those configurations, but only for development env.

So this works ok for local development env. But, we are running the CI env in production mode (I guess because we want to use those same images to push for creating pipeline env, instead of recreating them afterwards), so there it can't find values for these configuration secrets and fails.

Shouldn't we run the CI env in development mode anyway? as we are installing the development deps into it and running tests too.

@kierenevans
Copy link
Contributor

kierenevans commented Oct 8, 2020

Two purposes of the build: a shippable artifact (docker images, helm charts) and testing if the code is correct and conforms to code quality standards.

We build the docker image in production mode so it can be sent as-is to pipeline and production.

To provide development tooling for code correctness and quality checks, we run the composer install again in the running "pipeline mode" environment and generate the transfer classes, etc.

I feel we should still be testing the installation steps for production still, as it's something the developers will not be testing locally.

We can provide some fixed oauth secrets if running in Jenkins, via environment variables in the Jenkinsfile, passing them through in docker-compose.yml from the parent environment (set to "= env('OAUTH_CONSUMER_SECRET') ? env('OAUTH_CONSUMER_SECRET') : @('services.php-base.environment_secrets.OAUTH_CONSUMER_SECRET')" or similar

@andytson-inviqa
Copy link
Contributor

andytson-inviqa commented Oct 8, 2020

pipeline.php-base.environment_secrets is expected to be using sealed-secrets so it can't be used in CI
services.php-base.environment_secrets will be fine

= env('OAUTH_CONSUMER_SECRET') isn't relevant in attributes/twig templates as it's only an env var once it's in the docker container

@kierenevans
Copy link
Contributor

Sorry, meant services. instead of pipeline.

@andytson-inviqa
Copy link
Contributor

= @('spryker.mode') == 'production' ? something : null

I'm guessing is more along the lines you're thinking?

@hgajjar
Copy link
Author

hgajjar commented Oct 12, 2020

@kierenevans It's ready for review now.

Copy link
Contributor

@kierenevans kierenevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@hgajjar hgajjar merged commit d11b291 into 0.11.x Oct 13, 2020
@hgajjar hgajjar deleted the feature/update-spryker-version branch October 13, 2020 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request harness-spryker Spryker harness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Spryker version to 202009.0 and php version to 7.4
3 participants