Closed paulhocker closed 3 years ago
Unfortunately in my research I have been unable to figure out how to use the project URL to pull down the archive in the same way that the asset lib provides today.
The web interface lets you pull the archive manually still from a particular commit (or tag) but the URL is formed as an example
I did an experiment where I changed my project URL to be
https://gitlab.com/api/v4/projects/7994768
along with the same SHA reference, which produces the URL
Unfortunately, this appears to be malformed and instead ends up pulling from master, I believe this is because the URL is still using the ?ref= parameter on the API, when it should instead use the ?sha= parameter instead.
this url points to the correct commit archive.
Of course, all of this could be solved by letting us put our own URL in. That way we could actually use the release/tag urls from gitlab instead.
I discovered another way for this to work.
https://gitlab.com/godot-stuff/gs-logger/-/archive/ae6094ef581dc9162fca26ba690bb99de5189b2d.zip
this uses the accessible tree structure that is used for browsing commits and other objects in the repo. It functions like the GitHub URL, except you need the /-/
between the Repo URL and the archive object. Then you can simply use the SHA reference name with a .zip
on the end.
I have tried this with a few other SHA refs in a couple of my repos with success.
https://gitlab.com/godot-stuff/gs-ecs/-/archive/875123f0b29c4222d4ce97322a98405f1124212c.zip https://gitlab.com/godot-stuff/gs-logger/-/archive/a1082c75bdf186c92cca0af588d3f59671c875a8.zip
So I think the only thing left to decide, is which method is the best.
Using the official API to pull that archive down? Or, use the Project Tree structure to pull the archive down?
Is there ANY chance we could just provide an open URL so that the developer can decide what to provide the end user? That would be my preference because then we could give direct links to artifacts that have been built instead of using the unreliable archive method, which means you need the .gitattributes file.
Is there ANY chance we could just provide an open URL so that the developer can decide what to provide the end user?
Not before the new asset library is deployed (and even then, this will likely be restricted to an extent). The current asset library allows specifying custom URLs, but this feature is only usable by moderators. I don't have an ETA for deploying the new asset library, since it depends on moving to new hosting.
These restrictions are in place for security reasons.
I understand. So what do you think short term, option A or B?
Personally, I think option B because all we will need to do is replace line 43 in Utils.php from this
return "$repo_url/repository/archive.zip?ref=$commit";
to this
return "$repo_url/-/archive/$commit.zip";
I think?!? I am not a PHP guy though.
created a pull request #238 to correct this problem using the method mentioned above. please consider. thank you.
I believe that the API for GITLAB has changed and none of my downloads are working any longer?
https://godotengine.org/asset-library/asset?user=paulhocker
Here are the docs for the repositories api
https://docs.gitlab.com/ee/api/repositories.html#get-file-archive
This is a HUGE issue for anyone using GITLAB
Here is an example that cannot be downloaded
https://gitlab.com/godot-stuff/gs-logger/repository/archive.zip?ref=427d37e48e8e07439d2452226d132d265466a7bf https://gitlab.com/godot-stuff/gs-logger/repository/archive.zip?ref=a5ad2c72720bc821cde549fc41c16593dc3f6629