6
votes

I have created my own artifactory in docker:

$ docker run --name artifactory -d -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest

I can access my artifactory on http://192.168.140.xx:8081/artifactory I have some free trial license for 30 days (after doing some registration). I've skipped the proxy part

I've created a remote repository which configuration looks like this:

enter image description here

Now I try to visit:

http://192.168.140.xxx:8081/artifactory/yarn-test/v0.23.4/yarn-v0.23.4.tar.gz

In which I want to access:

https://github.com/yarnpkg/yarn/releases/download/v0.23.4/yarn-v0.23.4.tar.gz

(So accessing my artifactory and go to my yarn-test repo and I provide the path to the release I want to download: But I receive: enter image description here

What is the reason? What am I doing wrong? I know I can use VCS to get a GitHub repo and use the API to access a release but I really need the v0.23.4/yarn-v0.23.4.tar.gz at the end of my URL .

1
I don't think this is how Artifactory works by default... The repository layout is simple-layout which means the upstream request will be in format [orgPath]/[module]/[module]-[baseRev].[ext]. That format doesn't match the original request you are making. Even if it did, it means that the upstream request would be something like https://github.com/yarnpkg/yarn/releases/download/yarnpkg.yarn/yarn/yarn-v0.23.4.tar.gz. You might be able to get this to work with a custom layout and then making the upstream just https://github.com. But I can't really spend the time to try that out, sorry. - Andy Shinn
@AndyShinn Thanks Andy, I was still searching and I was thinking in this direction. I'll try some custom layout tomorrow but it seems pretty complex to create a right custom layout. - DenCowboy
The resolution is not related to the layout of the repository definition in Artifactory. You can look at the repository configuration, under the advance section if by any chance you have credentials set in the user and passwords fields. It can happen that chrome browser will auto fill those fields. If not, try to just curl this url and see if by bypassing Artifactory if this url works and the file is being downloaded. - Ariel
More and more people are using yarn and Artifacatory isn't even offering a little bit of support to make this work? I don't understand that - DenCowboy
@Ariel We're facing the same issue I think. At the moment we have a remote repo to npm.taobao.org/mirrors/yarn which works fine, but we want to get the releases without using an additional mirror, from: github.com/yarnpkg/yarn/releases or github.com/yarnpkg/yarn/releases/download and here we also get a 404 Forbidden? We're not using credentials - lvthillo

1 Answers

2
votes

This comment helped me to get it working.

The problem causing this is documented here

The Repository configuration should look like this:

Generic Repository Basic configuration

Basic Configuration:

Repository Type: Remote
Packages Type: Generic
URL: https://github.com/
Repository Layout: simple-default
List remote folder items: false (unchecked)

Note: there is no remote layout mapping needed

Generic Repository Advanced configuration

Advanced configuration:

Bypass HEAD Requests: true (checked)

Note that you need artifyctory version 5.5.2 or higher.