repman icon indicating copy to clipboard operation
repman copied to clipboard

Artifact cannot be downloaded because presumably "reference" is missing in the download url

Open benn0r opened this issue 3 years ago • 14 comments

When i try for example to install a package with composer require PACKAGE_NAME:1.0.0 composer tries to download https://HOST/dists/PACKAGE_NAME/1.0.0.0/.zip I assume there should be something before ".zip". In the composer.lock i can see the definition: https://HOST/dists/%package%/%version%/%reference%.%type%

So for me it looks like %reference% is missing in the URL that composer tries to download. Is there certain attributes i have to add to the composer.json of my artifacts for artifacts to work properly? Or something else that i have to configure specifially for artifacts? When i add a package with repository type "Gitlab" everything works great.

benn0r avatar May 08 '21 23:05 benn0r

Hi @benn0r, sorry for late response. I'll need a little more information.

  • what type of package are you using
  • what the configuration of composer.json looks like
  • standalone Repman or our public instance

akondas avatar May 14 '21 08:05 akondas

Hi @akondas, thank you for your reply.

I am using standalone Repman Docker Container. With "type of package" you mean "library" or "composer-plugin" as defined in the composer.json or what do you mean?

The minimal composer.json that is included in the ZIP File in the artifacts folder and that leads to the described issue, looks like this:

{
  "name": "PACKAGE_NAME",
  "type": "library",
  "version": "1.3",
  "autoload": {
    "psr-4": {
      "NAMESPACE\\": "src/"
    }
  }
}

benn0r avatar May 17 '21 11:05 benn0r

@akondas could you perhaps provide me with an example artifact zip file which works correctly in your environment? I could then see how its done and hopefully fix my artifacts.

benn0r avatar Jul 26 '21 07:07 benn0r

We usually use Github integration, but I can prepare such a package and share it in this issue.

akondas avatar Jul 26 '21 08:07 akondas

any news on this? i would really like to work with this project

benn0r avatar Aug 26 '21 17:08 benn0r

Actually by combing through the repo i found this: https://github.com/repman-io/repman/tree/master/tests/Resources/artifacts If i upload this artifacts to my repman server and add it as an artifact it also doesnt work. Here the complete error:

root@777793e4ec17:/var/www/api/foo# composer require buddy-works/alpha:1.0.0
./composer.json has been updated
Running composer update buddy-works/alpha
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking buddy-works/alpha (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading buddy-works/alpha (1.0.0)
    Failed downloading buddy-works/alpha, trying the next URL (404: The "https://buddy-works.repo.HOST/dists/buddy-works/alpha/1.0.0.0/.zip" file could not be downloaded (HTTP/2 404 ))
  - Downloading buddy-works/alpha (1.0.0)
  - Downloading buddy-works/alpha (1.0.0)
  - Downloading buddy-works/alpha (1.0.0)
  - Downloading buddy-works/alpha (1.0.0)

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

                                                                                                                                    
  [Composer\Downloader\TransportException]                                                                                          
  The "/artifacts/test/buddy-works-alpha-1.0.0.zip" file could not be downloaded: failed to open stream: No such file or directory  
                                                                                                                                    

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...

benn0r avatar Aug 26 '21 17:08 benn0r

Hi @akondas, do you think this problem can be fixed ? Because, I'd like to use artifacts too on a standalone Repman but I have the same problem. When I try to install it with Composer I get this error message :

[Composer\Downloader\TransportException]
The "/path/to/artifacts/example_1.1.1.zip" file could not be downloaded: Failed to open stream: No such file or directory

And in my composer.lock, the artifact has no reference :

            "name": "artifacts/example",
            "version": "1.1.1",
            "dist": {
                "type": "zip",
                "url": "/path/to/artifacts/example_1.1.1.zip",
                "shasum": "c3a723bdb07fae5d22afb6856d8800df62ebf5ad",
                "mirrors": [
                    {
                        "url": "https://my_repman.local.dev/dists/%package%/%version%/%reference%.%type%",
                        "preferred": true
                    }
                ]
            }

@benn0r, did you find a workaround ?

jeanfrauc avatar Nov 08 '22 13:11 jeanfrauc

@benn0r, did you find a workaround ?

I did not, i eventually stopped looking and I switched to Gitlab Package Registry

benn0r avatar Nov 08 '22 13:11 benn0r

Thank you @benn0r for your very quick reply, I will try Gitlab Package Registry

jeanfrauc avatar Nov 08 '22 14:11 jeanfrauc

sorry :disappointed: , at this point I don't have much time to look at this problem more, and it is difficult for me to determine when I will find, but I will be happy to help with code review and merging if someone would like to help ... :shrug:

akondas avatar Nov 08 '22 14:11 akondas

No problem @akondas, I even don't know if Repman could answer to my need. In fact, I want to be able to push several times the same version of an artifact on somekind of Composer Packages Repository and Satis that I am currently using can't do it. That's why I'm looking for another solution. Thanks anyway.

jeanfrauc avatar Nov 08 '22 15:11 jeanfrauc

Hi, I have the same problem when use Artifact.

image

The workaround I used to get the package downloaded was to manually add the reference property to the .lock file.

image

After run composer install, that works fine.

image

mateusrovedaa avatar Sep 07 '23 18:09 mateusrovedaa

I made a PR (#670) for this issue.

edpittol avatar Jan 02 '24 22:01 edpittol

We're having the same problem. @akondas are you considering reviewing the solution suggested by @edpittol? It will be a huge help for us, deploying a version with this fixed.

srtab avatar Apr 11 '24 15:04 srtab