Add Sodium extension

Created on 23 January 2022, almost 3 years ago
Updated 23 August 2024, 4 months ago

Problem/Motivation

Would love to have the Sodium PHP extension in the build, for contrib modules that can use it (or require it).

✨ Feature request
Status

Closed: works as designed

Component

PHP Containers

Created by

πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States yas California πŸ‡ΊπŸ‡Έ

    FYI, I tried to put a drupalci.yml file at the top directory on my project ( drupal/cloud β†’ ) for πŸ’¬ Drupal 10 compatibility: Support drupal/simple_oauth:5.2 (by trying to add ext-sodium PHP library) Fixed because our dependent module drupal/simple_oauth requires a ext-sodium PHP library. They looked trying to switch GitLabCI instead at πŸ“Œ Switch GitLab CI configuration to the template developed by the DA Fixed , however it means still we cannot use DrupalCI.

    In my trial, drupalci.yml looks not solving the problem w/ the following error:

    00:02:48.851 ----------------   Starting container_command   ----------------
    00:02:48.856 Directory created at /var/lib/drupalci/workspace/jenkins-drupal8_contrib_patches-152186/ancillary/container_command
    00:02:48.856 Container command.
    00:02:48.856 sudo -u www-data docker-php-ext-install sodium
    00:02:48.856 sudo -u www-data composer config platform.ext-sodium $PHP_VERSION --file=composer.json
    00:02:48.856 
    00:02:48.877 + cd sodium
    00:02:48.877 + phpize
    00:02:48.882 Configuring for:
    00:02:48.882 PHP Api Version:         20210902
    00:02:48.882 Zend Module Api No:      20210902
    00:02:48.882 Zend Extension Api No:   420210902
    00:02:48.883 mkdir: cannot create directory 'build': Permission denied
    00:02:48.883 cp: target '/usr/src/php/ext/sodium/build' is not a directory
    00:02:48.884 cp: cannot create regular file '/usr/src/php/ext/sodium/run-tests.php': Permission denied
    00:02:48.884 /usr/local/bin/phpize: 154: cannot create configure.ac: Permission denied
    00:02:48.885 chmod: cannot access '/usr/src/php/ext/sodium/build/shtool': No such file or directory
    00:02:48.885 shtool at '/usr/src/php/ext/sodium/build/shtool' does not exist or is not executable.
    00:02:48.885 Make sure that the file exists and is executable and then rerun this script.
    00:02:48.885 
    00:02:49.099 ---------------- Finished container_command in 0.248 seconds ----------------
    

    We cannot install ext-sodium onto Docker container running on DrupalCI (?) Moreover, I found that we could insert our custom command as follows after PHP composer analyzes the dependencies and downloads the library. We want to run the following command before starting PHP composer:

          container_command:
            commands: |
              sudo -u www-data docker-php-ext-install sodium
              sudo -u www-data composer config platform.ext-sodium $PHP_VERSION --file=composer.json

    Thanks

  • πŸ‡ΊπŸ‡ΈUnited States yas California πŸ‡ΊπŸ‡Έ

    UPDATE:

    I wrote:

    We cannot install ext-sodium onto Docker container running on DrupalCI (?)

    I was wrong, it was successful to install ext-sodium by the following configuration of drupalci.yml:

          container_command:
            commands: |
              apt-get update && apt-get install -y libsodium-dev
              docker-php-ext-install sodium
              composer config platform.ext-sodium $PHP_VERSION --file=composer.json
    

    In this case, I want to use --ignore-platform-ext=sodium option for PHP composer, but it didn't work even when I specify as follows:

      codebase:
        assemble_codebase:
          composer.install:
            options: 'install --ignore-platform-req=ext-sodium --prefer-dist --no-suggest --no-interaction --no-progress'
    
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    To get composer to ignore the lack of the extension put this in the .gitlab-ci.yml file

    variables:
      # Remove this once the base image includes the sodium PHP extension
      COMPOSER_EXTRA: '--ignore-platform-req=ext-sodium'
  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Sodium is supposed to be part of newer versions of PHP, especially Debian. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911135
    I know for certain it is installed by default in all supported versions of Ubuntu.

  • Status changed to Closed: works as designed 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    I just realized this is an issue for drupalci, not gitlabci. Closing.

Production build 0.71.5 2024