在Artifactory中创建Github镜像 [英] Create Github mirror in Artifactory

查看:192
本文介绍了在Artifactory中创建Github镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Artifactory中创建github镜像. 我们需要安装node-sass.我们有一个远程npm存储库,该存储库下载node-sass,但最后它需要一些来自github的binding.node文件.这里由于代理而导致构建失败.

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.

我们为 https://npm.taobao.org/mirrors/node-创建了一个远程存储库sass ,并告诉我们的版本检查远程回购中是否存在node-sass:

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/

这很好.但是现在我们正在镜像一面镜子.我们想立即镜像github版本,但这不起作用: 我们尝试了 https://github.com/sass/node-sass/releases/ https://github.com/sass/node-sass/releases/download/,但两者均无效.

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.

我读到有关VCS回购的信息,但恐怕这确实是我们的解决方案.

I read about the VCS repo but this seems to really our solution I'm afraid.

推荐答案

我整个上午都在努力解决这个问题,终于使它工作了.根本原因是,默认情况下,Artifactory尝试在工件上执行HTTP HEAD请求,该请求在GitHub CDN S3存储桶上不起作用:请参见以下问题:

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

从Artifactory 5.5.2开始,通用"存储库的高级配置中现在有一个选项可以忽略HTTP HEAD请求.如果选中此选项,则通用存储库可以镜像GitHub版本.

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:

  1. 为GitHub版本创建自定义布局:

  1. Create a custom layout for GitHub releases:

[orgPath]/releases/download/[baseRev]/[module].[ext]

  • 使用通用"类型创建一个新的远程存储库.

  • Create a new remote repository with the "generic" type.

    保存存储库后,请尝试以下操作:

    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

    应下载该工件并将其缓存以备将来使用.然后,您可以将SASS_BINARY_SITE设置为" http://artifactory.local/artifactory/github-releases/sass/node-sass/releases/download ",这将强制npm install使用Artifactory中的缓存/代理版本.

    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.

    从理论上讲,这可以在GitHub上缓存所有版本,但是我还没有尝试过其他任何用途.

    In theory this will work to cache any releases on GitHub, but I've not tried it for anything else yet.

    这篇关于在Artifactory中创建Github镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆