Skip to content

MAGECLOUD-4004: Move Docker-related functionality to separate package #33

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

Merged
merged 27 commits into from
Aug 14, 2019

Conversation

shiftedreality
Copy link
Member

@shiftedreality shiftedreality commented Jul 31, 2019

Description

Fixed Issues (if relevant)

  1. https://magento2.atlassian.net/browse/MAGECLOUD-4004

Manual testing scenarios

!!! Use branch https://github.com/magento/ece-tools/tree/MAGECLOUD-4004
!!! ./vendor/bin/ece-docker build:compose is equivalent to ./vendor/bin/ece-tools docker:build

  1. https://jira.corp.magento.com/browse/MAGECLOUD-126
  2. https://jira.corp.magento.com/browse/MAGECLOUD-27
  3. https://jira.corp.magento.com/browse/MAGECLOUD-66

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages

@magento-cicd2
Copy link

magento-cicd2 commented Jul 31, 2019

CLA assistant check
All committers have signed the CLA.

define('ECE_BP', BP);
}

foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it will look better

foreach ([ '/../../autoload.php', '/vendor/autoload.php'] as $file) {
    if (file_exists(__DIR__.$file)) {
        return require $file;
    }

Copy link
Member Author

Choose a reason for hiding this comment

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

You won't be able to navigate to those files from IDE

dist/bin/docker Outdated
@@ -0,0 +1,63 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

I think will be better if you change the name of this file to docker.sh or mc-docker
Because the current name can be confused with docker command

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be BC change, as we already released this file

Copy link
Member

Choose a reason for hiding this comment

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

I'd actually submitted a Jira ticket about this as well. This file creates some really frustrating conflicts if you add your project's bin directory to $PATH. It's not just confusing; it actually breaks things.

@@ -0,0 +1,149 @@
FROM php:7.3-fpm-stretch
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the image php:7.3-cli-stretch has problems with libsodium too

$  docker run -it php:7.3-cli-stretch bash
root@92cc980b6e64:/# php -v
PHP 7.3.7 (cli) (built: Jul 17 2019 22:25:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
root@92cc980b6e64:/# php -i | grep libsodium
libsodium headers version => 1.0.11
libsodium library version => 1.0.11
root@92cc980b6e64:/# php -r 'echo SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13;'
Warning: Use of undefined constant SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13 - assumed 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13' (this will throw an Error in a future version of PHP) in Command line code on line 1
SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed

pecl install -o -f libsodium
BASH
],
'~7.2.0' => [
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to change the value of constraint because the image php:7.3-cli-stretch also has an outdated library libsodium.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

[ComposeFactory::COMPOSE_DEVELOPER, ComposeFactory::COMPOSE_PRODUCTION],
false
)) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete empty line, please

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

/**
* Extensions which can be installed or uninstalled
*/
const AVAILABLE_PHP_EXTENSIONS = [
Copy link
Contributor

Choose a reason for hiding this comment

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

this constant can be deleted since this information is contained in the file 'images/php/php-extensions.php'

Copy link
Member Author

Choose a reason for hiding this comment

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

It's used in this class. It seems like separate task

@mveeramneni mveeramneni requested a review from bbatsche August 6, 2019 14:47
'soap' => '>=7.0',
'sockets' => '>=7.0',
'sodium' => '>=7.0',
'ssh2' => '>=7.0',
Copy link
Contributor

Choose a reason for hiding this comment

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

It must be indicated that the package is not available for PHP 7.3

https://github.com/magento/magento-cloud-docker/pull/33/files#diff-9f51bf098cc0ff04fa9850efeefe1780R170

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

* See COPYING.txt for license details.
*/
error_reporting(E_ALL);
date_default_timezone_set('UTC');
Copy link
Member

Choose a reason for hiding this comment

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

Why are we setting a timezone?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's always good to set timezone in the beginning of php script to not depend on user settings.


[ "$DEBUG" = "true" ] && set -x

MAGENTO_COMMAND="magento-command"
Copy link
Member

Choose a reason for hiding this comment

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

I could be missing something, but I can't see how this variable is used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, removed


use Composer\Semver\Constraint\Constraint;
use Composer\Semver\Semver;
use Composer\Semver\VersionParser;
Copy link
Member

Choose a reason for hiding this comment

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

No longer used

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

namespace Mcd\Command\Generate;
declare(strict_types=1);

namespace Magento\CloudDocker\Command\Image;

use Composer\Semver\Constraint\Constraint;
Copy link
Member

Choose a reason for hiding this comment

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

No longer used

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -87,26 +94,33 @@ class Php extends Command
/**
* @var VersionParser
Copy link
Member

Choose a reason for hiding this comment

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

should be Semver

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

"ext-json": "*",
"composer/semver": "^1.0",
"illuminate/config": "^5.5",
"illuminate/filesystem": "^5.5",
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should consider using symfony/filesystem since it's already included with ECE tools, and would thus cut down on the number of extra dependencies

Copy link
Member Author

Choose a reason for hiding this comment

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

It lacks a bunch of methods that the previous implementation was relying on

@shiftedreality shiftedreality changed the base branch from develop to master August 9, 2019 14:16
@andriyShevtsov
Copy link
Contributor

QA approved

@shiftedreality shiftedreality merged commit 14a8859 into master Aug 14, 2019
@shiftedreality shiftedreality deleted the MAGECLOUD-4004 branch August 14, 2019 18:45
@YPyltiai YPyltiai added the Release: 1.0.0 Magento-Cloud-Docker Release label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Progress: accept PR/issue status Release: 1.0.0 Magento-Cloud-Docker Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants