How I can search for empty folders in my repo using Jfrog CLI + AQL query ?
Found your question looking for the same answer. Lower in my google result was this JFrog KB posting created recently (since you posted the question). https://jfrog.com/knowledge-base/empty-folder-clean-up/
Related
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.
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 am trying to retrieve the latest version of an artifact with the following query
http://artifactory_domain/artifactory/api/search/latestVersion?g=groupId&a=artifactId&v=0.101.1&repos=repository_on_artifactory
Where :
artifactory_domain - domain name of your artifactory.
groupId - you can find it Artifact Repository Browser, please, look into a screen shot.
artifactId -you can find it Artifact Repository Browser, please, look into a screenshot.
Repo name where artifact persists.
which is assembled in accordance with the following documentation https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-ArtifactLatestVersionSearchBasedonLayout
However, it returns lastest in accordance with the alphabetical order.
For example:
0.101.1
0.101.11
0.101.2
The query returns 0.101.2 despite the fact that there is version 0.101.11 already.
Is there any flag/option to retrieve the latest version based on the created date?
I found answer by myself in documentation:
To change the retrieve latest behavior to retrieve the latest version based on the created date you can add the following flag to
$ARTIFACTORY_HOME/etc/artifactory.system.properties
and add the following flag
artifactory.request.searchLatestReleaseByDateCreated=true
and restart Artifactory service
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.