jfrog rt dl --symlinks=true generic-local/latest.tgz
Getting "Incorrect Usage".
jfrog cli version 1.18.0.
Is it possible to download a symlink data from jfrog CLI?
In jfrog cli, --symlink is a parameter used for preserving the soft links structure in Artifactory during the upload.
So for downloading you can use the following command
jfrog rt dl generic-local/latest.tgz
In addition, when downloading symlinks stored in Artifactory, the CLI can verify that the file to which the symlink points actually exists and that it has the correct SHA1 checksum. To add this validation, you should use the --validate-symlinks option with the download command.
Related
(I am newbee with respect to Artifactory) I use the JFrog CLI for promoting builds (docker images) from dev repo to prod. When I build I create three tags, one VERSION, one latest and one with a build ID. When I promote using "jfrog rt bpr" command I don't want the build-id tag to be promoted, only VERSION and latest.
I build Docker images using Gitlab and use the JFrog CLI for pushing images, scanning with x-ray and publishing build info to Artifactory.
My process is that in a Gitlab pipeline I build the docker image with three tags.
Then I deploy it to a dev repository in Artifactory with "jfrog rt docker-push..." for all three tags and then publish the build info to Artifactory.
Then I test the Docker image in a test stage in the Gitlab pipline, followed by a xray scan of the build using JFrog cli.
When everything works I want to promote the Docker image to my prod repository in Artifactory using JFrog cli. This however promotes all three tags but I would like to only promote the VERSION and latest tag and not the third tag which is only used as a "snapshot" tag..
Is this possible using jfrog cli promote command? Or is there a better way of thinking about the whole process of naming, tagging and promoting images from dev to prod using Artifactory?
This is the build stage:
# Build docker images
- >
docker build
-t $DOCKER_REGISTRY/$CI_PROJECT_NAME:latest
-t $DOCKER_REGISTRY/$CI_PROJECT_NAME:$VERSION
-t $DOCKER_REGISTRY/$CI_PROJECT_NAME:$CI_PIPELINE_ID
.
# Push to Artifactory's dev repo via the virtual repo
- jfrog rt docker-push $DOCKER_REGISTRY/$CI_PROJECT_NAME:latest docker-virtual --build-name=$CI_PROJECT_NAME --build-number=$CI_PIPELINE_ID
- jfrog rt docker-push $DOCKER_REGISTRY/$CI_PROJECT_NAME:$VERSION docker-virtual --build-name=$CI_PROJECT_NAME --build-number=$CI_PIPELINE_ID
# Collect environment variables
- jfrog rt build-collect-env $CI_PROJECT_NAME $CI_PIPELINE_ID
# Push build info to Artifactory, but exclude sensitive information such as passwords
- jfrog rt build-publish --build-url=$CI_PIPELINE_URL --env-exclude="*DOCKER_AUTH_CONFIG*;*PASSWORD*;*KEY*" $CI_PROJECT_NAME $CI_PIPELINE_ID
This is the promote stage:
- jfrog rt bpr --status=STABLE --copy=true $CI_PROJECT_NAME $CI_PIPELINE_ID docker-prod-local
I am trying to download the entire folder (as it is with all files and subfolders) from an Artifactory repo to my local folder.
Note - I am using Artifactory Pro cloud version
This how my Artifactory local repo (generic) looks like -
I run the following command in jfrog CLI (used this article as refrence) -
jfrog rt download --include-dirs=true --flat=true --user=XXX --password=XXX --url=https://XXXX.jfrog.io/XXXX --recursive '/support-pack/aem-dispatcher/files/(*)' '{1}'
The files get downloaded however it results in a weird folder structure -
Below is a screenshot of the logs
Notice the additional resume folder under the resume folder. Why is this happening?
I want the exact structure under files folder in Artifactory to be replicated in my local folder.
Please help!
The answer turned out to be much simpler than expected. All I had to do was get rid of --include-dirs=true in my command.
Read this article for more info.
I need to delete old snapshots from the Artifactory. For cleanup we recently configured Max Unique Snapshots to 5, but the garbage collector only deletes the old snapshots when a new snapshot is deployed.
How do I deploy a single file to the Artifactory using the JFrog-cli? I am unsure of which command to use from their documentation. https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory
You can deploy a single file to Artifactory using the CLI with the upload command, for example:
jfrog rt u froggy.tgz my-local-repo
For additional documentation about the upload command take a look at the JFrog CLI documentation
I am trying to search for all files that are in my repo on Artifactory. I have Go installed, and am using Jfrog to query the search using:
jfrog rt s https://URL/artifactory/generic-sgca/
Which returns:
[Info] Searching artifacts...
[Info] Found 0 artifacts.
[]
Why is it not returning all folders in this repo? I believe my config is setup correctly too.
You are not supposed to be specifying the https://url/artifactory when using search function in the CLI.
you can check the CLI's search help using jfrog rt s -h and you'll see that the usage is:
jfrog rt s [command options] <search pattern>
where search pattern should:
Specifies the search path in Artifactory, in the following format: <repository name>/<repository path>
The URL is actually a command option --url=http://myurl:myport/artifactory which you can leave out if you use jfrog rt config to set the Artifactory server details before you run the search command.
You can read more and find some snippet example here
Is there any way to sort and limit the number of artifacts while downloading artifacts using CLI for Jfrog Artifactory?
Example: if we have 100 artifacts in a single repo and I want to download only top 5 artifacts.
Thanks!
Jfrog CLI currently does not support SORT and LIMIT.
This is actually a roadmap item currently evaluated for Q4 17.
You can follow this Github issue to stay up-to-date with the implementation efforts.
for the meantime, you can use AQL with SORT and LIMIT over the JFrog REST API.
For example, the below AQL query Sorts by Descending creation dates and Limits the returned number of items to 5.
it can be used as the body of a simple POST method:
items.find(
{
"repo":"my-repo-local"
}
).sort({"$desc" : ["created"]}).limit(5)
HTH,
Or
You can not limit the download to X number of artifacts using Jfrog Cli but there are 3 ways to "limit" your artifact donwload using Jfrog Cli.
These options are:
If you need only a specift artifact:
jfrog rt dl your-artifactory-local-repo/YOUR-ARTIFACT-NAME.EXTENSION
This example download the artifact named YOUR-ARTIFACT-NAME.EXTENSION from "your-artifactory-local-repo" to your local folder.
If you need all the artifact in a folder:
jfrog rt dl your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/ YOUR-LOCAL-FOLDER/
This example download all the artifacts from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
Using a regular expresion (best way):
Example 3.1:
jfrog rt dl "your-artifactory-local-repo/*" YOUR-LOCAL-FOLDER/
This command also download all the artifacts from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
Example 3.2:
jfrog rt dl "your-artifactory-local-repo/*.EXTENSION" YOUR-LOCAL-FOLDER/
This command also download all the .EXTENSION from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
Example 3.3:
jfrog rt dl "your-artifactory-local-repo/*SUBNAME.*" YOUR-LOCAL-FOLDER/
This command also download all the artifacts that ends with "SUBANME.*" from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
The best way is using regular expressions.