platformsh / platformsh-client-php

Platform.sh API client for PHP
https://platform.sh
MIT License
25 stars 27 forks source link

No way to use sessions on platform.sh readonly FS #31

Closed Nebel54 closed 5 years ago

Nebel54 commented 5 years ago

Hello there,

I want to fetch the current commit details during the post_deploy hook and mark the commit via API in New Relic, my code looks like this:

$platform = new PlatformClient();
$platform->getConnector()->logOut();
$platform->getConnector()->setApiToken($platform_vars['php:platformsh.apikey'], 'exchange');
$project = $platform->getProject($env['project']);
$platform_env = $project->getEnvironment($env['app_branch']);
$commit = $platform_env->getHeadCommit();

This works like a charm locally, but raises problems on production:

PHP Warning:  mkdir(): Read-only file system in /app/vendor/platformsh/client/src/Session/Storage/File.php on line 91
PHP Warning:  chmod(): No such file or directory in /app/vendor/platformsh/client/src/Session/Storage/File.php on line 92
Warning: mkdir(): Read-only file system in /app/vendor/platformsh/client/src/Session/Storage/File.php on line 91
Warning: chmod(): No such file or directory in /app/vendor/platformsh/client/src/Session/Storage/File.php on line 92

Could you add a posibility to not use sessions, or to define the session path via (environment) variable?

Thanks a lot!

pjcdawkins commented 5 years ago

The dev-master and 0.22.3 versions include this change.

Nebel54 commented 5 years ago

Thanks again @pjcdawkins!