How to create a github mirror in Artifactory.
We need to install node-sass
. We have a remote npm repository which downloads node-sass but at the end it needs some binding.node file which comes from github. Here the build fails due to proxy.
We created a remote repository to https://npm.taobao.org/mirrors/node-sass and told our build to check our remote repo for node-sass:
SASS_BINARY_SITE=https://xx/artifactory/node-sass/
This works fine. But now we are mirroring a mirror. We want to mirror the github releases immediatly but this does not work: We tried https://github.com/sass/node-sass/releases/ and https://github.com/sass/node-sass/releases/download/ but both did not work.
I read about the VCS repo but this seems to really our solution I'm afraid.
No. Artifactory uses controlled caches of remote repositories, not mirroring.
Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.
To configure a remote repository, in the Administrator module, go to Repositories | Repositories select the Remote tab, click Add Repository and select Remote Repository.
While integrations for GitHub are abundant, integrations for GitHub Packages are limited. Artifactory has a rich catalog of integrations for use with the most widely-used CI/CD servers, IDEs, issue trackers, and other DevOps tools and platforms, Even more integrations are available from our many technology partners.
I spent all morning fighting this and I finally got it working. The root cause is that, by default, Artifactory tries to do an HTTP HEAD request on an artifact, which does not work on GitHub CDN S3 buckets: see this issue: RTFACT-11923
As of Artifactory 5.5.2, there is now an option in the advanced configuration of "generic" repos to ignore HTTP HEAD requests. If this is checked, a generic repo can mirror GitHub releases.
I've successfully set up a mirror with the following configuration:
Create a custom layout for GitHub releases:
[orgPath]/releases/download/[baseRev]/[module].[ext]
Create a new remote repository with the "generic" type.
https://github.com/
Once you save the repository, try something like:
http://artifactory.local/artifactory/github-releases/sass/node-sass/releases/download/v4.9.0/win32-ia32-11_binding.node
Which should download that artifact and cache it for future use. You can then set SASS_BINARY_SITE to "http://artifactory.local/artifactory/github-releases/sass/node-sass/releases/download" and that should force npm install to use the cached/proxied version in Artifactory.
In theory this will work to cache any releases on GitHub, but I've not tried it for anything else yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With