Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
benn0r opened this issue May 8, 2021 · 14 comments
Labels
question Further information is requested

Comments

@benn0r
Copy link

benn0r commented May 8, 2021

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.

@akondas
Copy link
Member

akondas commented May 14, 2021

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 akondas added the question Further information is requested label May 14, 2021
@benn0r
Copy link
Author

benn0r commented May 17, 2021

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
Copy link
Author

benn0r commented Jul 26, 2021

@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.

@akondas
Copy link
Member

akondas commented Jul 26, 2021

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

@benn0r
Copy link
Author

benn0r commented Aug 26, 2021

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

@benn0r
Copy link
Author

benn0r commented Aug 26, 2021

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>]...

@jeanfrauc
Copy link

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 ?

@benn0r
Copy link
Author

benn0r commented Nov 8, 2022

@benn0r, did you find a workaround ?

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

@jeanfrauc
Copy link

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

@akondas
Copy link
Member

akondas commented Nov 8, 2022

sorry 😞 , 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 ... 🤷

@jeanfrauc
Copy link

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.

@mateusrovedaa
Copy link

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

@edpittol
Copy link

edpittol commented Jan 2, 2024

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

@srtab
Copy link

srtab commented Apr 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants