Create Github mirror in Artifactory

后端 未结 1 1985
情歌与酒
情歌与酒 2021-02-14 11:25

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 b

相关标签:
1条回答
  • 2021-02-14 12:10

    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:

    1. Create a custom layout for GitHub releases:

      [orgPath]/releases/download/[baseRev]/[module].[ext]
      
    2. Create a new remote repository with the "generic" type.

    3. Set the URL of the new repository to https://github.com/
    4. Set the repository layout and remote repository layout to the custom layout created for GitHub
    5. Uncheck "List Remote Folder Items"
    6. On the "Advanced" tab, under the "Others" section, check "Bypass HEAD Requests"

    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.

    0 讨论(0)
提交回复
热议问题