naveen
naveen

Reputation: 134

Unable to download debian file immediately after uploading to Artifactory via curl

I have uploaded a debian file using the following command:

curl -H -u$ARTIFACTORY_USER:$ARTIFACTORY_TOKEN -XPUT "http://artifactory-url/artifactory/debian/pool/$package;deb.distribution=trusty;deb.component=main;deb.architecture=all" -T $package

I am unable to download the file even after 10 mins via apt-get update && apt-get download $package. Getting 'unable to locate package'.

When I upload the file via the UI, it becomes available after a minute. Also when I click re-index, it becomes available after a minute.

I am doing this in our CI pipeline, after uploading to Artifactory I need the artifact to be available in a minute for next step. What should I do in this case? why uploading via curl not indexing the package?

Upvotes: 2

Views: 914

Answers (1)

Dror Bereznitsky
Dror Bereznitsky

Reputation: 20376

For the Debian package to be available to download by apt-get, The repository index must be updated.
When a Debian package is deployed into a local repository, an event to index the relevant sub path of that repository is being added to a queue.
The queue is constantly being worked on by dedicated Debian metadata workers (8 by default, configurable).
This means, once a Debian package has been uploaded, if the queue is empty and a worker is available, it will start handling the event and index the metadata.
The indexing works by creating a lock for an entire distribution path including the repository (debian-local/dists/xenial). Once a worker has started to index a specific combination of repository & distribution, another worker won’t start indexing another event for the same path while the lock exists.
10 minutes is considered a long time for the indexing to be completed (should take about 1m). This can happen in a loaded system or when many Debian packages are deployed to the same distribution path.

You can tune the number of workers using the following system property in artifactory.system.properties:

artifactory.debian.metadata.calculation.workers = 8

You can also force a synchronous calculation of metadata for the entire repository by calling the Calculate Debian Repository Metadata REST API method.
For more information about Artifactory Debian index calculation tuning and debugging please consult the following knowledge base article.

Upvotes: 2

Related Questions