Oryx icon indicating copy to clipboard operation
Oryx copied to clipboard

Unable to deploy when composer.json references another repo

Open edgreenberg opened this issue 3 years ago • 0 comments

Bug Report

  • At what date and time did you most recently experience the problem? 2021-11-23@13:00 EST

  • Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use. Azure Web Apps

  • If your repo is publicly available please share its URL: it's a github enterprise repo

  • What happened? After the repo is pulled, Oryx tries to run composer install. The composer.json contains a reference to a package in one of our git repositories. Oryx (I believe) doesn't look at /root/.ssh/config to resolve the hostname 'gitfilestore' If it did, I'm not sure which private key it would present. I can't add the private key I got from kudu to both the main repo and this small package repo.

  • What did you expect or want to happen? I wanted it to execute the command:

git clone --mirror 'git@gitfilestore:HappySoftware/FileStore' '/home/.cache/composer/vcs/git-gitfilestore-HappySoftware-FileStore/'

so that the hostname is resolved in the the config directory and the specified private key in the /root/.ssh directories is used.

  • How can we reproduce it? You need a repo containing a composer style package and to reference it in the composer.json

  • Do you have log output? Please include between the backticks:

Command: oryx build /home/site/repository -o /home/site/wwwroot --platform php --platform-version 7.4 -i /tmp/8d9aea7a355385d --log-file /tmp/build-debug.log 
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20210826.1, Commit: f8651349d0c78259bb199593b526450568c2f94a, ReleaseTagName: 20210826.1

Build Operation ID: |K5nNajFMXTs=.ee220370_
Repository Commit : ae66db9ac4562d234799936e96f8aa2874080f63

Detecting platforms...
Detected following platforms:
  nodejs: 10.22.0
  php: 7.4.24

Using intermediate directory '/tmp/8d9aea7a355385d'.

Copying files to the intermediate directory...
Done in 7 sec(s).

Source directory     : /tmp/8d9aea7a355385d
Destination directory: /home/site/wwwroot

PHP executable: /tmp/oryx/platforms/php/7.4.24/bin/php
Composer archive: /opt/php-composer/2.0.8/composer.phar
Running 'composer install --ignore-platform-reqs --no-interaction'...

Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 148 installs, 0 updates, 0 removals
  - Syncing mrisoftware/filestore (0.0.13) into cache

                                                                                                                                                         
  [RuntimeException]                                                                                                                                     
  Failed to execute git clone --mirror 'git@gitfilestore:HappySoftware/FileStore' '/home/.cache/composer/vcs/git-gitfilestore-HappySoftware-FileStore/'  
                                                                                                                                                         
  Cloning into bare repository '/home/.cache/composer/vcs/git-gitfilestore-HappySoftware-FileStore'...                                                   
  ssh.original: Could not resolve hostname gitfilestore: Name or service not known                                                                       
  fatal: Could not read from remote repository.                                                                                                          
                                                                                                                                                         
  Please make sure you have the correct access rights                                                                                                    
  and the repository exists.                                                                                                                             
                                                                                                                                                         

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>]...

Installing dependencies from lock file (including require-dev)\nVerifying lock file contents can be installed on current platform.\nPackage operations: 148 installs, 0 updates, 0 removals\n  - Syncing mrisoftware/filestore (0.0.13) into cache\n\n                                                                                                                                                         \n  [RuntimeException]                                                                                                                                     \n  Failed to execute git clone --mirror 'git@gitfilestore:HappySoftware/FileStore' '/home/.cache/composer/vcs/git-gitfilestore-HappySoftware-FileStore/'  \n                                                                                                                                                         \n  Cloning into bare repository '/home/.cache/composer/vcs/git-gitfilestore-HappySoftware-FileStore'...                                                   \n  ssh.original: Could not resolve hostname gitfilestore: Name or service not known                                                                       \n  fatal: Could not read from remote repository.                                                                                                          \n                                                                                                                                                         \n  Please make sure you have the correct access rights                                                                                                    \n  and the repository exists.                                                                                                                             \n                                                                                                                                                         \n\ninstall [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>]...\n/opt/Kudu/Scripts/starter.sh oryx build /home/site/repository -o /home/site/wwwroot --platform php --platform-version 7.4 -i /tmp/8d9aea7a355385d --log-file /tmp/build-debug.log 

This is what my section of composer.json looks like:

    "repositories": [
        {
            "type": "git",
            "url": "git@gitfilestore:HappySoftware/FileStore"
        }
    ],

And this is what the section of the config file is:

Host gitfilestore
    Hostname github.happysoftware.com
    IdentityFile /home/git/.ssh/id_rsa_filestore
    IdentitiesOnly yes

edgreenberg avatar Nov 23 '21 18:11 edgreenberg