Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2018-11-13 17:02:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Tue Nov 13 17:02:39 2018 rev:58 rq:648623 version:3.36.0 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2018-10-15 09:43:37.763359041 +0200 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes 2018-11-13 17:35:48.948770944 +0100 @@ -1,0 +2,19 @@ +Mon Nov 12 21:48:13 UTC 2018 - [email protected] + +- Update to version 3.36.0: + * Release v3.36.0 + * Fix dev version [skip changelog] + * Use heredoc for command help + * Deprecate the --type option in integration:update + * Consistent formatting for validation errors from other integration commands + * Add integration:validate command + * Fix further source of 'Not logged in' errors immediately after login + * Do not cache commit API metadata + * Fix alpha UI URLs for environments in web command + * Release v3.35.4 + * Fix occasional LoginRequiredException at the end of login + * Fix logout check for other sessions + * Support forcing color off via PLATFORMSH_CLI_NO_COLOR=1 or NO_COLOR=1 + * [self:release]: remove release confirmation step [skip changelog] + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.35.3.tar.xz New: ---- platformsh-cli-3.36.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.tZGECd/_old 2018-11-13 17:35:49.500770183 +0100 +++ /var/tmp/diff_new_pack.tZGECd/_new 2018-11-13 17:35:49.500770183 +0100 @@ -12,12 +12,12 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: platformsh-cli -Version: 3.35.3 +Version: 3.36.0 Release: 0 Summary: Tool for managing Platform.sh services from the command line # See licenses.txt for dependency licenses. ++++++ _service ++++++ --- /var/tmp/diff_new_pack.tZGECd/_old 2018-11-13 17:35:49.524770149 +0100 +++ /var/tmp/diff_new_pack.tZGECd/_new 2018-11-13 17:35:49.528770144 +0100 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">refs/tags/v3.35.3</param> + <param name="revision">refs/tags/v3.36.0</param> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.tZGECd/_old 2018-11-13 17:35:49.540770128 +0100 +++ /var/tmp/diff_new_pack.tZGECd/_new 2018-11-13 17:35:49.540770128 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">83849efa1ad6d69c845e84c233785913bb1938bb</param> + <param name="changesrevision">b1527de03ff889b8dbff21f90cb4c4993e2e0e66</param> </service> </servicedata> ++++++ licenses.txt ++++++ --- /var/tmp/diff_new_pack.tZGECd/_old 2018-11-13 17:35:49.576770078 +0100 +++ /var/tmp/diff_new_pack.tZGECd/_new 2018-11-13 17:35:49.576770078 +0100 @@ -17,7 +17,7 @@ padraic/humbug_get_contents 1.1.2 BSD-3-Clause padraic/phar-updater v1.0.5 BSD-3-Clause paragonie/random_compat v2.0.11 MIT -platformsh/client v0.20.2 MIT +platformsh/client v0.22.1 MIT platformsh/console-form v0.0.23 MIT psr/container 1.0.0 MIT psr/log 1.0.2 MIT ++++++ platformsh-cli-3.35.3.tar.xz -> platformsh-cli-3.36.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/README.md new/platformsh-cli-3.36.0/README.md --- old/platformsh-cli-3.35.3/README.md 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/README.md 2018-10-24 17:43:24.000000000 +0200 @@ -261,6 +261,7 @@ * `PLATFORMSH_CLI_DEBUG`: set to 1 to enable cURL debugging. _Warning_: this will print all request information in the terminal, including sensitive access tokens. * `PLATFORMSH_CLI_DISABLE_CACHE`: set to 1 to disable caching +* `PLATFORMSH_CLI_NO_COLOR`: enable (set to 1) to force colorized output off * `PLATFORMSH_CLI_SESSION_ID`: change user session (default 'default') * `PLATFORMSH_CLI_SHELL_CONFIG_FILE`: specify the shell configuration file that the installer should write to (as an absolute path). If not set, a file such as `~/.bashrc` will be chosen automatically. Set this to an empty string to disable writing to a shell config file. * `PLATFORMSH_CLI_TOKEN`: an API token. _Warning_: storing a secret in an environment variable can be insecure. It may be better to use `config.yaml` as above, depending on your system. The environment variable is preferable on CI systems like Jenkins and GitLab. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/composer.json new/platformsh-cli-3.36.0/composer.json --- old/platformsh-cli-3.35.3/composer.json 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/composer.json 2018-10-24 17:43:24.000000000 +0200 @@ -8,7 +8,7 @@ "guzzlehttp/guzzle": "^5.3", "guzzlehttp/ringphp": "^1.1", "platformsh/console-form": ">=0.0.22 <2.0", - "platformsh/client": ">=0.20.2 <2.0", + "platformsh/client": ">=0.22.1 <2.0", "symfony/console": "^3.0 >=3.2", "symfony/yaml": "^3.0 || ^2.6", "symfony/finder": "^3.0", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/composer.lock new/platformsh-cli-3.36.0/composer.lock --- old/platformsh-cli-3.35.3/composer.lock 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/composer.lock 2018-10-24 17:43:24.000000000 +0200 @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "683a401d37c922ba8fd60e6a691587f7", + "content-hash": "3f6608131c957d3fd6b9a6e2caeffa8d", "packages": [ { "name": "cocur/slugify", @@ -711,16 +711,16 @@ }, { "name": "platformsh/client", - "version": "v0.20.2", + "version": "v0.22.1", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "220947685624464455d8ae3022c418ae832ce85e" + "reference": "2ef2052bb1a7a3c4e840548607c45a31988f28bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/220947685624464455d8ae3022c418ae832ce85e", - "reference": "220947685624464455d8ae3022c418ae832ce85e", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/2ef2052bb1a7a3c4e840548607c45a31988f28bd", + "reference": "2ef2052bb1a7a3c4e840548607c45a31988f28bd", "shasum": "" }, "require": { @@ -756,7 +756,7 @@ } ], "description": "Platform.sh API client", - "time": "2018-10-12T16:21:31+00:00" + "time": "2018-10-24T13:03:12+00:00" }, { "name": "platformsh/console-form", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/config.yaml new/platformsh-cli-3.36.0/config.yaml --- old/platformsh-cli-3.35.3/config.yaml 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/config.yaml 2018-10-24 17:43:24.000000000 +0200 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.35.3' + version: '3.36.0' executable: 'platform' package_name: 'platformsh/cli' installer_url: 'https://platform.sh/cli/installer' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/dist/manifest.json new/platformsh-cli-3.36.0/dist/manifest.json --- old/platformsh-cli-3.35.3/dist/manifest.json 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/dist/manifest.json 2018-10-24 17:43:24.000000000 +0200 @@ -1,10 +1,10 @@ [ { "name": "platform.phar", - "sha1": "5d6b774f6123893f2f6bf39c43ab3575bcac1048", - "sha256": "c8df4ae595fa0311a36ebbbb795d559a8524fe61e1a711702877899abf18dfec", - "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.35.3/platform.phar", - "version": "3.35.3", + "sha1": "c7badfe42069dc937eed95f67ff95741d1e50707", + "sha256": "ee3352a1cb799eee5cd727f5c880bf951110109d9ded2c64ffff0ef11de1c0e2", + "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.36.0/platform.phar", + "version": "3.36.0", "php": { "min": "5.5.9" }, @@ -142,6 +142,11 @@ "notes": "New features:\n\n* Add commit:list (commits) and commit:get commands for viewing commits via the\n API.\n* Add --commit (-c) option to repo:cat and repo:ls commands.\n* Add Bitbucket integration support.\n\nBug fixes:\n\n* Fix drush alias group name prepending bug. Custom aliases were having the\n alias group name prepended every time they were recreated, e.g. \"@foo.bar\"\n would become \"@foo.foo.bar\".\n* Allow changing the value of a project-level sensitive variable.\n\nOther changes:\n\n* Add explanations for \"Operation not available\" on environment actions.\n* Add additional help for the mount:size command.\n* Clean up --pipe output in the user:get command.\n* Show hidden service commands.", "show from": "3.34.0", "hide from": "3.35.0" + }, + { + "notes": "* Fix a further source of 'Not logged in' errors immediately after login.\n* Add `integration:validate` command, and improve error reporting in other\n integration commands.\n* Deprecate the --type option in the `integration:update` command.\n* Fix alpha UI URLs for environments in the `web` command.", + "show from": "3.35.0", + "hide from": "3.36.0" } ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Application.php new/platformsh-cli-3.36.0/src/Application.php --- old/platformsh-cli-3.35.3/src/Application.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Application.php 2018-10-24 17:43:24.000000000 +0200 @@ -140,6 +140,7 @@ $commands[] = new Command\Integration\IntegrationGetCommand(); $commands[] = new Command\Integration\IntegrationListCommand(); $commands[] = new Command\Integration\IntegrationUpdateCommand(); + $commands[] = new Command\Integration\IntegrationValidateCommand(); $commands[] = new Command\Local\LocalBuildCommand(); $commands[] = new Command\Local\LocalCleanCommand(); $commands[] = new Command\Local\LocalDrushAliasesCommand(); @@ -242,13 +243,18 @@ $input->setInteractive(false); } - // Allow the CLICOLOR_FORCE environment variable to override whether - // colors are used in the output. + // Allow the NO_COLOR, CLICOLOR_FORCE, and TERM environment variables to + // override whether colors are used in the output. + // See: https://no-color.org + // See: https://en.wikipedia.org/wiki/Computer_terminal#Dumb_terminals /* @see StreamOutput::hasColorSupport() */ - if (getenv('CLICOLOR_FORCE') === '0') { - $output->setDecorated(false); - } elseif (getenv('CLICOLOR_FORCE') === '1') { + if (getenv('CLICOLOR_FORCE') === '1') { $output->setDecorated(true); + } elseif (getenv('NO_COLOR') + || getenv('CLICOLOR_FORCE') === '0' + || getenv('TERM') === 'dumb' + || getenv($this->cliConfig->get('application.env_prefix') . 'NO_COLOR')) { + $output->setDecorated(false); } parent::configureIO($input, $output); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Auth/BrowserLoginCommand.php new/platformsh-cli-3.36.0/src/Command/Auth/BrowserLoginCommand.php --- old/platformsh-cli-3.35.3/src/Command/Auth/BrowserLoginCommand.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/Auth/BrowserLoginCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -213,9 +213,11 @@ $cache = $this->getService('cache'); $cache->flushAll(); + // Save the new tokens to the persistent session. + $this->saveAccessToken($token, $this->api()->getClient(false)->getConnector()->getSession()); + // Reset the API client so that it will use the new tokens. $client = $this->api()->getClient(false, true); - $this->saveAccessToken($token, $client->getConnector()->getSession()); $this->stdErr->writeln('You are logged in.'); // Show user account info. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Auth/LogoutCommand.php new/platformsh-cli-3.36.0/src/Command/Auth/LogoutCommand.php --- old/platformsh-cli-3.35.3/src/Command/Auth/LogoutCommand.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/Auth/LogoutCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -62,7 +62,7 @@ $fs->remove($sessionsDir); $this->stdErr->writeln('All session files have been deleted.'); } - } elseif (is_dir($sessionsDir) && glob($sessionsDir . '/sess-cli-*', GLOB_NOSORT)) { + } elseif (is_dir($sessionsDir) && glob($sessionsDir . '/sess-cli-*/*', GLOB_NOSORT)) { $this->stdErr->writeln(sprintf( 'Other session files exist. Delete them with: <comment>%s logout --all</comment>', $config->get('application.executable') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/CommandBase.php new/platformsh-cli-3.36.0/src/Command/CommandBase.php --- old/platformsh-cli-3.35.3/src/Command/CommandBase.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/CommandBase.php 2018-10-24 17:43:24.000000000 +0200 @@ -1157,21 +1157,25 @@ } /** - * Print a warning about an deprecated option. + * Print a warning about deprecated option(s). * - * @param string[] $options + * @param string[] $options A list of option names (without "--"). + * @param string|null $template The warning message template. "%s" is + * replaced by the option name. */ - protected function warnAboutDeprecatedOptions(array $options) + protected function warnAboutDeprecatedOptions(array $options, $template = null) { if (!isset($this->input)) { return; } + if ($template === null) { + $template = 'The option --%s is deprecated and no longer used. It will be removed in a future version.'; + } foreach ($options as $option) { if ($this->input->hasOption($option) && $this->input->getOption($option)) { $this->labeledMessage( 'DEPRECATED', - 'The option --' . $option . ' is deprecated and no longer used. It will be removed in a future version.', - OutputInterface::VERBOSITY_VERBOSE + sprintf($template, $option) ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationAddCommand.php new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationAddCommand.php --- old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationAddCommand.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationAddCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -1,6 +1,7 @@ <?php namespace Platformsh\Cli\Command\Integration; +use GuzzleHttp\Exception\BadResponseException; use Platformsh\Client\Model\Integration; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -53,8 +54,21 @@ } } - $result = $this->getSelectedProject() - ->addIntegration($values['type'], $values); + + try { + $result = $this->getSelectedProject() + ->addIntegration($values['type'], $values); + } catch (BadResponseException $e) { + if ($errors = Integration::listValidationErrors($e)) { + $this->stdErr->writeln('<error>The integration is invalid.</error>'); + $this->stdErr->writeln(''); + $this->listValidationErrors($errors, $output); + + return 4; + } + + throw $e; + } /** @var Integration $integration */ $integration = $result->getEntity(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationCommandBase.php new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationCommandBase.php --- old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationCommandBase.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationCommandBase.php 2018-10-24 17:43:24.000000000 +0200 @@ -12,6 +12,7 @@ use Platformsh\ConsoleForm\Field\OptionsField; use Platformsh\ConsoleForm\Field\UrlField; use Platformsh\ConsoleForm\Form; +use Symfony\Component\Console\Output\OutputInterface; abstract class IntegrationCommandBase extends CommandBase { @@ -575,4 +576,30 @@ return TRUE; } + + /** + * Lists validation errors found in an integration. + * + * @param array $errors + * @param \Symfony\Component\Console\Output\OutputInterface $output + */ + protected function listValidationErrors(array $errors, OutputInterface $output) + { + if (count($errors) === 1) { + $this->stdErr->writeln('The following error was found:'); + } else { + $this->stdErr->writeln(sprintf( + 'The following %d errors were found:', + count($errors) + )); + } + + foreach ($errors as $key => $error) { + if (is_string($key) && strlen($key)) { + $output->writeln("$key: $error"); + } else { + $output->writeln($error); + } + } + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationUpdateCommand.php new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationUpdateCommand.php --- old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationUpdateCommand.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationUpdateCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -1,6 +1,7 @@ <?php namespace Platformsh\Cli\Command\Integration; +use GuzzleHttp\Exception\BadResponseException; use Platformsh\Cli\Util\NestedArrayUtil; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -27,6 +28,11 @@ protected function execute(InputInterface $input, OutputInterface $output) { + $this->warnAboutDeprecatedOptions( + ['type'], + 'The option --%s is deprecated and will be removed in a future version.' + ); + $this->validateInput($input); $id = $input->getArgument('id'); @@ -76,7 +82,25 @@ return 1; } - $result = $integration->update($newValues); + try { + $result = $integration->update($newValues); + } catch (BadResponseException $e) { + $errors = $integration->listValidationErrors($e); + if ($errors) { + $this->stdErr->writeln(sprintf( + 'The integration <error>%s</error> (type: %s) is invalid.', + $integration->id, + $integration->type + )); + $this->stdErr->writeln(''); + $this->listValidationErrors($errors, $output); + + return 4; + } + + throw $e; + } + $this->stdErr->writeln("Integration <info>{$integration->id}</info> (<info>{$integration->type}</info>) updated"); $this->ensureHooks($integration); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationValidateCommand.php new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationValidateCommand.php --- old/platformsh-cli-3.35.3/src/Command/Integration/IntegrationValidateCommand.php 1970-01-01 01:00:00.000000000 +0100 +++ new/platformsh-cli-3.36.0/src/Command/Integration/IntegrationValidateCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -0,0 +1,98 @@ +<?php +namespace Platformsh\Cli\Command\Integration; + +use Platformsh\Client\Exception\OperationUnavailableException; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class IntegrationValidateCommand extends IntegrationCommandBase +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('integration:validate') + ->addArgument('id', InputArgument::OPTIONAL, 'An integration ID. Leave blank to choose from a list.') + ->setDescription('Validate an existing integration'); + $this->addProjectOption(); + $this->setHelp(<<<EOF +This command allows you to check whether an integration is valid. + +An exit code of 0 means the integration is valid, while 4 means it is invalid. +Any other exit code indicates an unexpected error. + +Integrations are validated automatically on creation and on update. However, +because they involve external resources, it is possible for a valid integration +to become invalid. For example, an access token may be revoked, or an external +repository may be deleted. +EOF + ); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->validateInput($input); + + $project = $this->getSelectedProject(); + + $id = $input->getArgument('id'); + if (!$id && !$input->isInteractive()) { + $this->stdErr->writeln('An integration ID is required.'); + + return 1; + } elseif (!$id) { + $integrations = $project->getIntegrations(); + if (empty($integrations)) { + $this->stdErr->writeln('No integrations found.'); + + return 1; + } + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + $choices = []; + foreach ($integrations as $integration) { + $choices[$integration->id] = sprintf('%s (%s)', $integration->id, $integration->type); + } + $id = $questionHelper->choose($choices, 'Enter a number to choose an integration:'); + } + + $integration = $project->getIntegration($id); + if (!$integration) { + try { + $integration = $this->api()->matchPartialId($id, $project->getIntegrations(), 'Integration'); + } catch (\InvalidArgumentException $e) { + $this->stdErr->writeln($e->getMessage()); + return 1; + } + } + + $this->stdErr->writeln(sprintf( + 'Validating the integration <info>%s</info> (type: %s)...', + $integration->id, + $integration->type + )); + + try { + $errors = $integration->validate(); + } catch (OperationUnavailableException $e) { + $this->stdErr->writeln('This integration does not support validation.'); + + return 1; + } + if (empty($errors)) { + $this->stdErr->writeln('The integration is valid.'); + + return 0; + } + + $this->stdErr->writeln(''); + + $this->listValidationErrors($errors, $output); + + // The exit code for an invalid integration (see the command help). + return 4; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/Self/SelfReleaseCommand.php new/platformsh-cli-3.36.0/src/Command/Self/SelfReleaseCommand.php --- old/platformsh-cli-3.35.3/src/Command/Self/SelfReleaseCommand.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/Self/SelfReleaseCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -306,9 +306,6 @@ $this->stdErr->writeln('Release description:'); $this->stdErr->writeln(preg_replace('/^/m', ' ', $releaseDescription)); $this->stdErr->writeln(''); - if (!$questionHelper->confirm('Is this OK?')) { - return 1; - } $http = new Client(); $response = $http->post($repoApiUrl . '/releases', [ 'headers' => [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Command/WebCommand.php new/platformsh-cli-3.36.0/src/Command/WebCommand.php --- old/platformsh-cli-3.35.3/src/Command/WebCommand.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Command/WebCommand.php 2018-10-24 17:43:24.000000000 +0200 @@ -40,7 +40,12 @@ if ($this->hasSelectedProject()) { $url = $this->getSelectedProject()->getLink('#ui'); if (!empty($environmentId)) { - $url .= '/environments/' . rawurlencode($environmentId); + // New (alpha) UI links lack the /environments path component. + if (strpos($url, 'https://ui.') === 0) { + $url .= '/' . rawurlencode($environmentId); + } else { + $url .= '/environments/' . rawurlencode($environmentId); + } } } else { $url = $this->config()->get('service.accounts_url'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Service/Api.php new/platformsh-cli-3.36.0/src/Service/Api.php --- old/platformsh-cli-3.35.3/src/Service/Api.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Service/Api.php 2018-10-24 17:43:24.000000000 +0200 @@ -215,6 +215,12 @@ : new File($this->config->getWritableUserDir() . '/.session'); $session->setStorage($this->sessionStorage); + // Ensure session data is (re-)loaded every time. + // @todo move this to the Session + if (!$session->getData()) { + $session->load(true); + } + self::$client = new PlatformClient($connector); if ($autoLogin && !$connector->isLoggedIn()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.35.3/src/Service/GitDataApi.php new/platformsh-cli-3.36.0/src/Service/GitDataApi.php --- old/platformsh-cli-3.35.3/src/Service/GitDataApi.php 2018-10-12 18:32:40.000000000 +0200 +++ new/platformsh-cli-3.36.0/src/Service/GitDataApi.php 2018-10-24 17:43:24.000000000 +0200 @@ -120,8 +120,13 @@ } throw $e; } + $data = $commit->getData(); + // No need to cache API metadata. + if (isset($data['_links']['self']['meta'])) { + unset($data['_links']['self']['meta']); + } $this->cache->save($cacheKey, [ - 'data' => $commit->getData(), + 'data' => $data, 'uri' => $baseUrl, ], 0); ++++++ platformsh-cli-vendor.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/autoload.php new/vendor/autoload.php --- old/vendor/autoload.php 2018-10-12 21:17:55.123509060 +0200 +++ new/vendor/autoload.php 2018-11-12 22:48:16.488182355 +0100 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitc45f5bdff98953bc26396bfd59ba098e::getLoader(); +return ComposerAutoloaderInit8453dfe4c31470175502491353838bfd::getLoader(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/ClassLoader.php new/vendor/composer/ClassLoader.php --- old/vendor/composer/ClassLoader.php 2018-10-12 21:17:55.123509060 +0200 +++ new/vendor/composer/ClassLoader.php 2018-11-12 22:48:16.488182355 +0100 @@ -377,7 +377,7 @@ $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_real.php new/vendor/composer/autoload_real.php --- old/vendor/composer/autoload_real.php 2018-10-12 21:17:55.123509060 +0200 +++ new/vendor/composer/autoload_real.php 2018-11-12 22:48:16.488182355 +0100 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitc45f5bdff98953bc26396bfd59ba098e +class ComposerAutoloaderInit8453dfe4c31470175502491353838bfd { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitc45f5bdff98953bc26396bfd59ba098e', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8453dfe4c31470175502491353838bfd', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitc45f5bdff98953bc26396bfd59ba098e', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8453dfe4c31470175502491353838bfd', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitc45f5bdff98953bc26396bfd59ba098e::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8453dfe4c31470175502491353838bfd::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitc45f5bdff98953bc26396bfd59ba098e::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit8453dfe4c31470175502491353838bfd::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirec45f5bdff98953bc26396bfd59ba098e($fileIdentifier, $file); + composerRequire8453dfe4c31470175502491353838bfd($fileIdentifier, $file); } return $loader; } } -function composerRequirec45f5bdff98953bc26396bfd59ba098e($fileIdentifier, $file) +function composerRequire8453dfe4c31470175502491353838bfd($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_static.php new/vendor/composer/autoload_static.php --- old/vendor/composer/autoload_static.php 2018-10-12 21:17:55.123509060 +0200 +++ new/vendor/composer/autoload_static.php 2018-11-12 22:48:16.488182355 +0100 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitc45f5bdff98953bc26396bfd59ba098e +class ComposerStaticInit8453dfe4c31470175502491353838bfd { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', @@ -195,9 +195,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitc45f5bdff98953bc26396bfd59ba098e::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitc45f5bdff98953bc26396bfd59ba098e::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitc45f5bdff98953bc26396bfd59ba098e::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit8453dfe4c31470175502491353838bfd::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8453dfe4c31470175502491353838bfd::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8453dfe4c31470175502491353838bfd::$classMap; }, null, ClassLoader::class); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/installed.json new/vendor/composer/installed.json --- old/vendor/composer/installed.json 2018-10-12 21:17:54.571504046 +0200 +++ new/vendor/composer/installed.json 2018-11-12 22:48:15.980177871 +0100 @@ -730,17 +730,17 @@ }, { "name": "platformsh/client", - "version": "v0.20.2", - "version_normalized": "0.20.2.0", + "version": "v0.22.1", + "version_normalized": "0.22.1.0", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "220947685624464455d8ae3022c418ae832ce85e" + "reference": "2ef2052bb1a7a3c4e840548607c45a31988f28bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/220947685624464455d8ae3022c418ae832ce85e", - "reference": "220947685624464455d8ae3022c418ae832ce85e", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/2ef2052bb1a7a3c4e840548607c45a31988f28bd", + "reference": "2ef2052bb1a7a3c4e840548607c45a31988f28bd", "shasum": "" }, "require": { @@ -753,7 +753,7 @@ "require-dev": { "phpunit/phpunit": "~4.5" }, - "time": "2018-10-12T16:21:31+00:00", + "time": "2018-10-24T13:03:12+00:00", "type": "library", "extra": { "patches": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Connection/Connector.php new/vendor/platformsh/client/src/Connection/Connector.php --- old/vendor/platformsh/client/src/Connection/Connector.php 2018-10-12 18:21:31.000000000 +0200 +++ new/vendor/platformsh/client/src/Connection/Connector.php 2018-10-24 15:03:12.000000000 +0200 @@ -16,6 +16,7 @@ use Platformsh\Client\OAuth2\PasswordCredentialsWithTfa; use Platformsh\Client\Session\Session; use Platformsh\Client\Session\SessionInterface; +use Platformsh\Client\Session\Storage\File; class Connector implements ConnectorInterface { @@ -55,16 +56,13 @@ */ public function __construct(array $config = [], SessionInterface $session = null) { - $version = '0.1.x'; - $url = 'https://github.com/platformsh/platformsh-client-php'; - $defaults = [ 'accounts' => 'https://accounts.platform.sh/api/v1/', 'client_id' => 'platformsh-client-php', 'client_secret' => '', 'debug' => false, 'verify' => true, - 'user_agent' => "Platform.sh-Client-PHP/$version (+$url)", + 'user_agent' => null, 'cache' => false, 'revoke_url' => '/oauth2/revoke', 'token_url' => '/oauth2/token', @@ -74,7 +72,34 @@ ]; $this->config = Collection::fromConfig($config, $defaults); - $this->session = $session ?: new Session(); + if (!isset($this->config['user_agent'])) { + $this->config['user_agent'] = $this->defaultUserAgent(); + } + + if (isset($session)) { + $this->session = $session; + } else { + // Assign file storage to the session by default. + $this->session = new Session(); + $this->session->setStorage(new File()); + } + } + + /** + * @return string + */ + private function defaultUserAgent() + { + $version = trim(file_get_contents(__DIR__ . '/../../version.txt')) ?: '0.x.x'; + + return sprintf( + '%s/%s (%s; %s; PHP %s)', + 'Platform.sh-Client-PHP', + $version, + php_uname('s'), + php_uname('r'), + PHP_VERSION + ); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Model/Integration.php new/vendor/platformsh/client/src/Model/Integration.php --- old/vendor/platformsh/client/src/Model/Integration.php 2018-10-12 18:21:31.000000000 +0200 +++ new/vendor/platformsh/client/src/Model/Integration.php 2018-10-24 15:03:12.000000000 +0200 @@ -2,6 +2,8 @@ namespace Platformsh\Client\Model; +use GuzzleHttp\Exception\BadResponseException; + /** * A project integration. * @@ -58,4 +60,54 @@ $this->sendRequest($hookUrl, 'post', $options); } + + /** + * Validate the integration via the API. + * + * @throws \Platformsh\Client\Exception\OperationUnavailableException + * If the integration does not support validation. + * @throws \RuntimeException If an unexpected error occurs. + * + * @return string[] + * An array of errors, as returned by the API. An empty array indicates + * the integration is valid. + */ + public function validate() + { + try { + $this->runOperation('validate', 'post'); + } catch (BadResponseException $e) { + return self::listValidationErrors($e); + } + + return []; + } + + /** + * Process an API exception to list integration validation errors. + * + * @param \GuzzleHttp\Exception\BadResponseException $exception + * An exception received during integration create, update, or validate. + * + * @see \Platformsh\Client\Model\Integration::validate() + * + * @throws \GuzzleHttp\Exception\BadResponseException + * The original exception is re-thrown if specific validation errors + * cannot be found. + * + * @return string[] A list of errors. + */ + public static function listValidationErrors(BadResponseException $exception) + { + $response = $exception->getResponse(); + if ($response && $response->getStatusCode() === 400) { + $response->getBody()->seek(0); + $data = $response->json(); + if (isset($data['detail']) && is_array($data['detail'])) { + return $data['detail']; + } + } + + throw $exception; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/version.txt new/vendor/platformsh/client/version.txt --- old/vendor/platformsh/client/version.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/platformsh/client/version.txt 2018-10-24 15:03:12.000000000 +0200 @@ -0,0 +1 @@ +0.21.x \ No newline at end of file
