Skip to content

Conversation

@js-murph
Copy link
Collaborator

@js-murph js-murph commented Jan 15, 2026

What?

Implements a strategy for caching packages stored in Artifactory. This caching strategy supports both path based and host based URL's.

Why?

Artifactory is a commonly used package store that requires first class support.

Tests

Implemented unit testing. Additionally the following manual testing has been performed with various Build tools.

Added a test configuration...

memory{}

disk {
  root = "./cache"
}

artifactory "https://gems.example.jfrog.io" {
  hosts = [
    "gems.local"
  ]
}

artifactory "https://example.jfrog.io" {
  hosts = [
    "test.local"
  ]
}

Add an entry to /etc/hosts...

127.0.0.1 test.local
127.0.0.1 gems.local

NPM

Result from second-run post-caching:

npm_config_registry=http://test.local:8080/artifactory/api/npm/npmjs/ npm install express

added 65 packages in 320ms

22 packages are looking for funding
  run `npm fund` for details

Gems

time gem install rack --clear-sources     --source http://gems.local:8080/     --install-dir ./vendor     --no-document --version 2.2.3
Fetching rack-2.2.3.gem
Successfully installed rack-2.2.3
1 gem installed

real	0m25.421s
user	0m14.404s
sys	0m0.229s

PyPi

python3 -m venv venv
source venv/bin/activate

time pip install --index-url http://test.local:8080/artifactory/api/pypi/block-pypi/simple requests==2.28.1 --verbose --trusted-host test.local
Using pip 25.0 from /private/tmp/npm-test-1/venv/lib/python3.13/site-packages/pip (python 3.13)
Looking in indexes: http://test.local:8080/artifactory/api/pypi/block-pypi/simple
Collecting requests==2.28.1
  Downloading http://test.local:8080/artifactory/api/pypi/block-pypi/packages/packages/ca/91/6d9b8ccacd0412c08820f72cebaa4f0c0441b5cda699c90f618b6f8a1b42/requests-2.28.1-py3-none-any.whl (62 kB)
Requirement already satisfied: charset-normalizer<3,>=2 in ./venv/lib/python3.13/site-packages (from requests==2.28.1) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.13/site-packages (from requests==2.28.1) (3.11)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.13/site-packages (from requests==2.28.1) (1.26.20)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.13/site-packages (from requests==2.28.1) (2026.1.4)
Installing collected packages: requests
Successfully installed requests-2.28.1

[notice] A new release of pip is available: 25.0 -> 25.3
[notice] To update, run: pip install --upgrade pip

real	0m2.500s
user	0m0.216s
sys	0m0.085s

Maven

Add a settings.xml...

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
          http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <mirrors>
        <mirror>
            <id>cachew-proxy</id>
            <name>Cachew Artifactory Proxy</name>
            <url>http://test.local:8080/artifactory/common</url>
            <mirrorOf>*</mirrorOf>
        </mirror>
    </mirrors>
</settings>
mvn dependtiee mncy:get -s settings.xml -DgroupId=commons-lang -DartifactId=commons-lang -Dversion=2.6 -Dtransitive=false
[INFO] Scanning for projects...
Downloading from cachew-proxy: http://test.local:8080/artifactory/common/org/codehaus/mojo/maven-metadata.xml
Downloading from cachew-proxy: http://test.local:8080/artifactory/common/org/apache/maven/plugins/maven-metadata.xml
Downloaded from cachew-proxy: http://test.local:8080/artifactory/common/org/codehaus/mojo/maven-metadata.xml (21 kB at 4.1 kB/s)
Downloaded from cachew-proxy: http://test.local:8080/artifactory/common/org/apache/maven/plugins/maven-metadata.xml (10 kB at 2.1 kB/s)
Downloading from cachew-proxy: http://test.local:8080/artifactory/common/org/apache/maven/plugins/maven-dependency-plugin/3.7.0/maven-dependency-plugin-3.7.0.pom
Downloaded from cachew-proxy: http://test.local:8080/artifactory/common/org/apache/maven/plugins/maven-dependency-plugin/3.7.0/maven-dependency-plugin-3.7.0.pom (19 kB at 3.7 MB/s)
... SNIP ...
Downloaded from cachew-proxy: http://test.local:8080/artifactory/common/commons-lang/commons-lang/2.6/commons-lang-2.6.jar (284 kB at 271 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.070 s
[INFO] Finished at: 2026-01-16T13:31:31+11:00
[INFO] ------------------------------------------------------------------------

real	0m7.828s
user	0m3.924s
sys	0m0.790s

@js-murph js-murph requested a review from alecthomas as a code owner January 15, 2026 01:54
@js-murph js-murph added the enhancement New feature or request label Jan 15, 2026
@js-murph js-murph self-assigned this Jan 15, 2026
@js-murph js-murph marked this pull request as draft January 15, 2026 04:16
@js-murph js-murph marked this pull request as ready for review January 16, 2026 03:09
@js-murph js-murph changed the title [WIP] feat: Add strategy for artifactory feat: Add strategy for artifactory Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants