In JFrog Artifactory, I need to delete the artifacts which are not downloaded for a period of 6 months. I have gone through the JFrog repository. It is mentioned to run via REST API, but I am not pretty sure how to use it.
How can we implement this? or if there is some other way?
I would recommend to refer to this user plugin, artifactCleanUp plugin can be used to delete artifacts which are not downloaded for certain days/months.
The easiest way would be to use the delete command of the JFrog CLI.
The command accepts a file spec.
Write an AQL query with Relative Time Operators, and pass it in the aql field of the file spec.
Related
I have a product for which I store software builds in Artifactory.
I name the software artifacts like this, so it is possible to se what a downloaded file contains: system-pcm33-base-v0.0.0.0_65_ga03970a.raucb
Thus it is also possible to download directly via an URL, not using jfrog
https://artifactory.deif.com/ui/native/amc-sw/pcm33/master/system-pcm33-base-v0.0.0.0_65_ga03970a.raucb
Now I would like to make a quick way to download the latest master build. To do this I have in my build made a symlink
system-pcm33-base.raucb -> system-pcm33-base-v0.0.0.0_65_ga03970a.raucb
I can also push this symlink to artifactory, but it only works from the GUI and via jfrog. I do not get this symlink as I had hoped:
https://artifactory.deif.com/ui/native/amc-sw/pcm33/master/system-pcm33-base.raucb
Is there a way to do this?
It is of course possible to upload the file twice under two different names, and thus update system-pcm33-base.raucb on every build. But that is a bit more heavy.
Artifactory doesn't handle symbolic links as in the Linux file system.
Based on the described use case, you can upload the file twice (as suggested) - first with the actual version, second as the latest. The important part is - when you upload for the 2nd time, as the latest, use Checksum Deploy.
Artifactory has a checksum based storage, which means that every file is actually stored once, even if it is uploaded to different target paths. In order to tell Artifactory to create/update a path without actually sending the binary, you can send the checksum of the binary, and Artifactory will link the path to the binary with that checksum. This operation is quite cheap.
Another possible approach is to define and use a custom Repository Layout. This way, in order to download the latest version of the file, you can use the [RELEASE] placeholder. The actual latest version ill be automatically resolved by the extracted version value based on the layout.
See also:
How to create simple versioning custom layout in Artifactory
How to find the latest artifact version based on layout?
Thanks to yinon explaining that the checksum is used, I found this simple solution
jf rt copy --flat amc-sw/pcm33/master/system-pcm33-base-v0.0.0.0_65_ga03970a.raucb amc-sw/pcm33/master/system-pcm33-base.raucb
This copies ALL the properties, but then a download query will return two files, so a property has to be changed
jf rt sp amc-sw/pcm33/master/system-pcm33-base.raucb artifact=last_bsp
I know JFrog provides APIs to fetch the artifacts info like latest build etc.
Can some one help by telling if JFrog provides an API to fetch the artifacts created/promoted in last 24 hr / last month etc.
Would like to pull all the artifacts updated in last one month for audit purpose.
You can achieve this functionality using AQL (Artifactory Query Language) and JFrog CLI.
Build an AQL query using RelativeTimeOperators ({"$last" : "30d"} for example).
Create a file spec with the "aql" field.
Use the download command of the CLI and provide the file spec you created with the --spec flag to download the files.
If you'd like to just get a list of artifacts, you can use the search command.
I'm trying to copy the latest artifact from one path to another using Artifactory API.
POST /api/copy/{srcRepoKey}/{srcFilePath}?to=/{targetRepoKey}/{targetFilePath}[&dry=1][&suppressLayouts=0/1(default)][&failFast=0/1]
Let's say I have a few RPMs named: artifact-1.0-1.rpm, artifact-1.0-2.rpm and artifact-1.0-3.rpm.
How to automatically copy the third artifact ?
With the next release of Jfrog's CLI, planned in a couple of weeks, you'll be able to use SORT and LIMIT in the COPY command.
This will allow you to fetch only the latest item\artifact by SORTing by date and LIMITing to the result set to 1.
For now, you can use 2 sequential CURL commands to try and accomplish what you're after:
First use an AQL SEARCH with you're SORT and LIMIT to retrieve the relevant item's path, and then use your COPY command with that path.
Note: the CLI's SORT and LIMIT feature has already been checked in to the CLI's dev branch, so if you wish to use a snapshot you can "download and build" the dev branch from github, and then test if the solution suites you.
I doubt that you can automatically copy all these artifacts in one statement. You can copy the folder but no regex or pattern can defined in copy command.
I have to fetch the list of builds present here : https://openmrs.jfrog.io/openmrs/public/org/openmrs/api/openmrs-api/
I am new to artifactory and its api. I need to know the curl command for fetching all the version numbers mentioned there please? How do I go about it? It's worthwhile to know that the repo doesn't belong to me and hence I do not have the username and password for it(Incase that's needed).
In the artifactory rest API documentation they use localhost for this purpose and do not have such a link. I haven't set this repo up so I do not know how it's done. Basically I am new to this and hence any help would be appreciated.
Thanks
Assuming you would like to get the list of versions available in this folder, there are 2 possible options:
1) Use the folder info REST API method to get a list of all the sub-folders
curl https://openmrs.jfrog.io/openmrs/api/storage/public/org/openmrs/api/openmrs-api/
2) Download and parse the maven-metadata.xml file inside this folder. This file contains information about available versions.
I am looking for a solution that would allow me to have a network share where people can access (read-only) the artifacts from an Artifactory repository.
Why? We use Artifactory to also keep track of big binaries like installation kits, ISO images and so on and it takes a lot of time to download all of them (sometimes as zips), unpack and run them. If these would be exported to a NFS/SMB share people would be able to only mount them in order to use them.
How can we achieve this? Please keep in mind that we also want to automate this, so the files would be updated by Artifactory when needed.
Artifactory supports WebDAV out of the box.
It seems that's not possible at this moment and there is a feature request for enabling it:
https://www.jfrog.com/jira/browse/RTFACT-8302
Feel free to vote and to comment on it, allowing jFrog to realise how important is this use case.
I guess they should be able to provide a script that does mirror/sync a repository to a NFS share but that would almost double the storage space needed.
Instead if they would use hardlinks or symlinks to create a browsable tree of the repository inside the storage directory, this would be solved and no sync will be needed.