-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
"Creating directory failed" in GitLab CI #421
Comments
I'm leaning to the conclusion of considering that a bug. In general, I'd say the idea of updating the
It depends on your workflow and dev process - and the type of project at hand: Quiqqer is an application. As such it is likely to have a bunch of dependencies, for runtime as well as development time needs. How are these updated? If that's an explicit decision made by devs, there is no reason to repeat the installation of these dependencies at CI and/or deployment times. Rather, these dependencies should be checked in along with the project into its repository. Making it self-contained. That moves all dep solving issues as well as availability of upstream sources into the development time - where a potential unavailability of say github is not a serious problem. It may be considered differently for libraries or other types of components meant to be reused by others. One option here would be to use It may also be considered differently, if you need different versions of things for a CI matrix run. Then, reinstalling things might actually be the only way to make that work. But then, you're not exactly testing the same software but many slightly different variants.. So, long story short: Yes, PHIVE should work without issues in CI. I so far never had permission problems in CI with PHIVE but that might be just luck.
The |
Thank you for your answer, @theseer! Using tl;dr: PHIVE home directory has to be placed in project folder and requires a "complicated" command. Is there a simpler way to do this?
QUIQQER is somewhat of a hybrid. It's an application (CMS) but also some kind of a framework. Putting those dependencies into the repository would definetly work and simplify the workflow for developers and in CI. Thus we'd prefer to use PHIVE, to just have a For example we're now using the following <?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^10.5.5" installed="10.5.5" location="./tools/phpunit" copy="false"/>
<phar name="phpstan" version="^1.10.54" installed="1.10.54" location="./tools/phpstan" copy="false"/>
</phive> In CI, we're now using the following command: phive --no-progress install --temporary --copy --trust-gpg-keys 4AA394086372C20A,51C67305FFC2E5C0 This works great and puts the specified PHARs into the The only issue we've got now is caching the PHARs between CI runs: I assume this happens because PHIVE does not remember which PHARs are installed because it's home directory is not cached? As a workaround I tried putting the PHIVE home directory into the project directory to cache it as well: phive --no-progress --temporary --home .phive-home install --trust-gpg-keys 4AA394086372C20A,51C67305FFC2E5C0,033E5F8D801A2F8D This does indeed work, but makes the command fairly long and "complicated" (compared to an Maybe with the feature you mentioned to be available in the future?
|
Glad it helped.
You can set an environment variable
If you set
Given you all files copied and cached, the CI command to install tools only needs to be run when the I'm not convinced that is something phive should be doing by itself.
Partially. This foremost is a philosophical decision: As we do not technically control the Instead of spending a lot of (development) effort on figuring out, whether or not that is the case, we decided to simply enforce the installation as defined by the
This is "just" symlinking - given you had
As written above the main point of potentially doing a redundant install is that we want to ensure the correct files to be in place no matter what has happend to the local "copy". We could of course enhance that by trying to understand the state of the files. But that, for instance, would require us to do a sha-something on the file content to catch modifed phars, resolv symlinks to see if they point to the correct location.. Can be done, but hasn't been on my agenda to be honest. |
Thanks again, for that extensive answer, @theseer!
That's a good idea! I'll try that out and see if this makes our CI simpler. Should this issue stay open to fix the permission bug without the Thank you for your help and suggestions! |
I'll keep it open for now :) |
When executing
phive install
in GitLab CI as a non-root user, a "creating directory failed" error occurs.You can see an example here: https://dev.quiqqer.com/quiqqer/quiqqer/-/jobs/6108
I tried to debug this and came to the following conclusion:
root
user as the owner andchmod 666
(see example)phive install
iswww-data
(see example)phive.xml
already exists, the methodPharIo\FileSystem\Directory->ensureExists()
tries tochmod
the project directory (see code)www-data
and thus does not own the project directory, thechmod
fails due to lack of permissionAm I doing something wrong or is this a bug?
Is PHIVE even meant to be used in CI to install tooling?
Is it correct to use the
phive.xml
file or should I use a different file for that?The text was updated successfully, but these errors were encountered: