Skip to content

Allow pie install to run non-interactively #308

@Neirda24

Description

@Neirda24

Hi.

I am trying to setup pie for dagger so that anyone creating a new dagger module using the PHP sdk will be able to specify which extensions they need. Relying on pie is the obvious choice.

Using PIE (1.1.0 (yes it displays -rc1 see issue #307)) & the following composer.json :

  "require": {
    "php": "^8.1",
    "ext-pcntl": "*",
    "dagger/dagger": "*@dev"
  },

and running only pie install does not work (based on docker image php:8.4-cli-alpine@sha256:fada271bbcae269b0b5f93212432a70ffb0aa51de0fa9c925455e8a1afae65ca).

It outputs the following :

$ pie install 
🥧 PHP Installer for Extensions (PIE) 1.1.0-rc.1, from The PHP Foundation
You are running PHP 8.4.11
Target PHP installation: 8.4.11 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)
Checking extensions for your project daggermodule/gotenbergbundle (path: /src/.dagger)
requires: ext-ctype:* ✅ Already installed
requires: ext-iconv:* ✅ Already installed
requires: ext-json:* ✅ Already installed
requires: ext-pcntl:* 🚫 Missing

The following packages may be suitable, which would you like to install: 
  [0] None
  [1] php/pcntl: no description available
 > 

But as this is not an interactive bash, devs can't select 1. I'd like a way to automatically require pie to select php/* with a custom option like --prefer-native or something like this.

Running pie install -n does not change anything at the moment.

Now let's say I manually or automatically select 1.

It gives the following output :

The following packages may be suitable, which would you like to install: 
  [0] None
  [1] php/pcntl: no description available
 > 1
   > 🥧 PHP Installer for Extensions (PIE) 1.1.0-rc.1, from The PHP Foundation
   > You are running PHP 8.4.11
   > Target PHP installation: 8.4.11 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)
   > Note: You should probably use "docker-php-ext-install pcntl" instead
   > 
   > Bundled PHP extension php/pcntl should be installed by your distribution, not by PIE.

Combining installation methods of bundled PHP extensions can lead to confusing and unintended consequences.

If you are really sure, you want to install php/pcntl using PIE, re-run the command with the --force flag.
The command "'/usr/bin/pie' 'install' 'php/pcntl'" failed.
                                                                                                                                                                                                                 
Exit Code: 2(Misuse of shell builtins)                                                                                                                                                                           
                                                                                                                                                                                                                 
Working directory: /src/.dagger                                                                                                                                                                                  
                                                                                                                                                                                                                 
Output:                                                                                                                                                                                                          
================                                                                                                                                                                                                 
🥧 PHP Installer for Extensions (PIE) 1.1.0-rc.1, from The PHP Foundation                                                                                                                                        
You are running PHP 8.4.11                                                                                                                                                                                       
Target PHP installation: 8.4.11 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)                                                                                                                           
Note: You should probably use "docker-php-ext-install pcntl" instead                                                                                                                                             
                                                                                                                                                                                                                 
Bundled PHP extension php/pcntl should be installed by your distribution, not by PIE.                                                                                                                            
                                                                                                                                                                                                                 
Combining installation methods of bundled PHP extensions can lead to confusing and unintended consequences.                                                                                                      
                                                                                                                                                                                                                 
If you are really sure, you want to install php/pcntl using PIE, re-run the command with the --force flag.                                                                                                       
                                                                                                                                                                                                                 
                                                                                                                                                                                                                 
Error Output:                                                                                                                                                                                                    
================                                                                                                                                                                                                 
                                                                                                                                                                                                                 
requires: ext-tokenizer:* ✅ Already installed

Finished checking extensions.

So I tried with the --force but it doesn't change a thing.

WDYT and how can I help ?

Thank you for reading this far 💖


Note : using dagger, developper cannot provide their own php image to run the php sdk. So we cannot build an image with all required extension and then ask dagger to use it for the module.

Metadata

Metadata

Assignees

Labels

maintainer investigatingThis ticket is being investigated by maintainers. Please check with us before contributing PRs etc!

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions