book
  • README
  • cheatsheet
    • bash
      • builtin
      • syntactic sugar
      • cmd
      • havefun
    • text-processing
      • awk
      • sed
      • html
      • json
      • regex
      • unicode
    • osx
    • curl
    • tricky
    • widget
    • proxy
    • colors
    • math
    • media
    • ssl
      • keystore
      • verification
      • server
      • client
      • tricky
    • windows
      • powershell
      • choco
      • wsl
      • wt
      • shortcut
      • clsid
      • env
      • shell:folder
  • vim
    • nvim
    • install
    • color
    • plugins
      • usage
      • other plugins
      • deprecated
    • tricky
    • viml
    • windows
    • troubleshooting
  • devops
    • admin tools
    • ssh
    • git
      • config
      • alias
      • submodule
      • eol
      • example
      • gerrit
        • gerrit API
      • github
      • troubleshooting
      • tricky
      • statistics
    • pre-commit
    • release-tools
    • tmux
      • cheatsheet
    • ansible
    • vault
    • artifactory
      • api
      • cli
      • aql
      • nginx cert
    • klocwork
      • kwadmin
      • kwserver
      • api
      • q&a
    • elk
    • mongodb
    • android
    • mobile
  • jenkins
    • config
      • windows
    • appearance
    • troubleshooting
    • jenkinsfile
      • utility
      • parallel
      • build
      • envvar
      • properties
      • trigger
      • node
    • script
      • job
      • build
      • stage
      • agent
      • security & authorization
      • exception
      • monitor
      • tricky
    • api
      • blueocean
    • cli
    • plugins
      • kubernetes
      • docker
      • shared-libs
      • lockable-resource
      • ansicolor
      • badge
      • groovy-postbuild
      • simple-theme
      • customizable-header
      • artifactory
      • jira-steps
      • job-dsl
      • build-timeline
      • crumbIssuer
      • coverage
      • uno-choice
      • tricky
  • virtualization
    • kubernetes
      • init
        • kubespray
        • kubeadm
          • environment
          • crio v1.30.4
          • docker v1.15.3
          • HA
        • addons
        • etcd
      • kubectl
        • pod
        • deploy
        • replicasets
        • namespace
        • secrets
      • node
      • certificates
      • events
      • kubeconfig
      • kubelet
      • troubleshooting
      • cheatsheet
      • auth
      • api
      • tools
        • monitor
        • helm
        • network
        • minikube
    • docker
      • run & exec
      • voume
      • remove
      • show info
      • dockerfile
      • dockerd
      • tricky
      • troubleshooting
      • windows
    • crio
    • podman
  • ai
    • prompt
  • osx
    • apps
      • init
      • brew
    • defaults
    • system
    • network
    • script
    • tricky
  • linux
    • devenv
    • util
      • time & date
      • output formatting
      • params
      • tricky
    • nutshell
    • disk
    • network
    • troubleshooting
    • system
      • apt/yum/snap
      • authorization
      • apps
      • x11
    • ubuntu
      • systemctl
      • x
    • rpi
  • programming
    • groovy
    • python
      • config
      • basic
      • list
      • pip
      • q&a
    • others
    • archive
      • angular
      • maven
      • mysql
        • installation
        • logs
      • ruby
        • rubyInstallationQ&A
  • tools
    • fonts
    • html & css
    • Jira & Confluence
    • node & npm
      • gitbook
      • hexo
      • github.page
      • code themes
    • app
      • microsoft office
      • vscode
      • virtualbox
      • iterm2
      • browser
      • skype
      • teamviewer
      • others
  • quotes
  • english
Powered by GitBook
On this page
  • CLI setup
  • Environment Variables
  • CLI
  • usage
  • npm

Was this helpful?

  1. devops
  2. artifactory

cli

PreviousapiNextaql

Last updated 13 days ago

Was this helpful?

CLI setup

[!NOTE|label:reference:]

  • windows

    # Command Prompt
    > powershell "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/2.41.1/jfrog-cli-windows-amd64/jf.exe -OutFile $env:USERPROFILE\jf.exe'"
    
    # verify
    > %USERPROFILE%\jf.exe --help
    NAME:
       jf - See https://github.com/jfrog/jfrog-cli for usage instructions.
    
    USAGE:
       jf [global options] command [command options] [arguments...]
    ...
  • homebrew

    $ brew install jfrog-cli
  • centos

    # via curl
    $ curl -fL https://install-cli.jfrog.io | sh
    
    # or
    $ sudo bash -c "cat > /etc/yum.repos.d/jfrog-cli.repo" << EOF
    [jfrog-cli]
    name=jfrog-cli
    baseurl=https://releases.jfrog.io/artifactory/jfrog-rpms
    enabled=1
    EOF
    $ sudo rpm --import https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key
    $ sudo yum install -y jfrog-cli-v2-jf
  • ubuntu

    [!NOTE|label:references:]

    # via curl
    $ curl -fL https://install-cli.jfrog.io | sh
    
    # via apt
    #                                                                                               dos2unix
    #                                                                                                   v
    $ curl -fsSL https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key | tr -d '\015' | sudo tee /usr/share/keyrings/jfrog.asc >/dev/null
    $ echo "deb [signed-by=/usr/share/keyrings/jfrog.asc] https://releases.jfrog.io/artifactory/jfrog-debs xenial contrib" > /etc/apt/source.list.d/jfrog.list >/dev/null
    $ sudo apt update -y
    $ sudo apt install jfrog-cli-v2-jf -y
    # deprecated for ubuntu 22.04
    $ wget -qO - https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key | sudo apt-key add -
    $ echo "deb https://releases.jfrog.io/artifactory/jfrog-debs xenial contrib" | sudo tee -a /etc/apt/sources.list
    $ sudo apt update
    $ sudo apt install -y jfrog-cli-v2-jf
  • docker

    # slim
    $ docker run releases-docker.jfrog.io/jfrog/jfrog-cli-v2-jf jf -v
    
    # full
    $ docker run releases-docker.jfrog.io/jfrog/jfrog-cli-full-v2-jf jf -v
  • npm

    $ npm install -g jfrog-cli-v2-jf && jf intro
  • npm

    $ npm i -g jfrog-cli-go
  • homebrew

    $ brew install jfrog-cli-go
  • docker

    $ docker run docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog <COMMAND>

completion

  • bash

    $ jf completion bash --install
  • zsh

    $ jf completion zsh --install
  • Oh My Zsh

    plugins=(git mvn npm sdk jfrog)
  • fish

    $ jf completion fish --install

Environment Variables

VARIABLE NAME
DEFAULT
SUPPORTED

JFROG_CLI_LOG_LEVEL

INFO

DEBUG, INFO, WARN, ERROR

JFROG_CLI_LOG_TIMESTAMP

TIME

TIME, DATE_AND_TIME, OFF

JFROG_CLI_HOME_DIR

~/.jfrog

-

JFROG_CLI_TEMP_DIR

-

-

JFROG_CLI_PLUGINS_SERVER

-

-

JFROG_CLI_PLUGINS_REPO

jfrog-cli-plugins

-

JFROG_CLI_RELEASES_REPO

-

-

JFROG_CLI_SERVER_ID

-

-

CI

false

-

CLI

VARIABLE NAME
DEFAULT

JFROG_CLI_MIN_CHECKSUM_DEPLOY_SIZE_KB

10

JFROG_CLI_RELEASES_REPO

-

JFROG_CLI_DEPENDENCIES_DIR

$JFROG_CLI_HOME_DIR/dependencies

JFROG_CLI_REPORT_USAGE

true

JFROG_CLI_SERVER_ID

-

JFROG_CLI_BUILD_NAME

-

JFROG_CLI_BUILD_NUMBER

-

JFROG_CLI_BUILD_PROJECT

-

JFROG_CLI_BUILD_URL

-

JFROG_CLI_ENV_EXCLUDE

*password*;*secret*;*key*;*token*

JFROG_CLI_TRANSITIVE_DOWNLOAD_EXPERIMENTAL

false

CLI

reference:

ABBREVIATION
COMMANDS

atc

access-token-create

bad

build-add-dependencies

bag

build-add-git

ba

build-append

bc

build-clean

bce

build-collect-env

bdi

build-discard

bdc

build-docker-create

bpr

build-promote

bp

build-publish

bs

build-scan

cp

copy

cl

curl

del

delete

delp

delete-props

dpr

docker-promote

dpl

docker-pull

dp

docker-push

donet

dotnet

dotnetc

dotnet-config

dl

download

glc

git-lfs-clean

go

go

-

go-config

gp

go-publish

-

gradle

gradlec

gradle-config

gau

group-add-users

gc

group-create

gdel

group-delete

h

help

mv

move

mvn

mvn

mvnc

mvn-config

npmci

npm-ci

npmc

npm-config

npmi

npm-install

npmp

npm-publish

nuget

nuget

nugetc

nuget-config

ndt

nuget-deps-tree

osb

oc

ptc

permission-target-create

ptdel

permission-target-delete

ptt

permission-target-template

ptu

permission-target-update

p

ping

pipc

pip-config

pipi

pip-install

ppl

podman-pull

pp

podman-push

rplc

replication-create

rpldel

replication-delete

rplt

replication-template

rc

repo-create

rdel

repo-delete

rpt

repo-template

ru

repo-update

s

search

sp

set-props

-

transfer-config

-

transfer-config-merge

-

transfer-files

-

transfer-plugin-install

-

transfer-settings

u

upload

-

user-create

uc

users-create

udel

users-delete

yarn

yarn

yarnc

yarn-config

configuration

  • $ jf c add --url=ssh://artifactory.example.com:1339 \
               --ssh-key-path=/Users/marslo/.ssh/id_rsa \
               sample
    
    $ jf c show sample
    Server ID:              sample
    JFrog Platform URL:     ssh://artifactory.example.com:1339/
    Artifactory URL:        ssh://artifactory.example.com:1339/
    SSH key file path:      /Users/marslo/.ssh/id_rsa
    Default:                true
  • $ jf c add --serverId rt-api-key \
               --artifactory-url=https://artifactory.sample.com/artifactory \
               --user=marslo \
               --password=A***********************************************************************x \
               --insecure-tls \
               --interactive=false
    $ jfrog rt c sample --url=https://artifactory.example.com/artifactory --apikey=***********
    JFrog Distribution URL (Optional):
    For commands which don't use external tools or the JFrog Distribution service, JFrog CLI supports replacing the configured username and password/API key with automatically created access token that's refreshed hourly. Enable this setting? (y/n) [y]? n
    Is the Artifactory reverse proxy configured to accept a client certificate? (y/n) [n]? n
    
    $ jfrog rt c show
    Server ID:  sample
    Url:        https://artifactory.example.com/artifactory/
    API key:    ***************
    Default:    true
    • via username/password

      $ jfrog rt c sample --user=myaccount \
                          --url=https://artifactory.example.com/artifactory \
                          --password=mypassword
      JFrog Distribution URL (Optional):
      For commands which don't use external tools or the JFrog Distribution service, JFrog CLI supports replacing the configured username and password/API key with automatically created access token that's refreshed hourly. Enable this setting? (y/n) [y]? n
      Is the Artifactory reverse proxy configured to accept a client certificate? (y/n) [n]? n
      [Info] Encrypting password...
  • $ jf c add --serverId sample
               --artifactory-url=https://artifactory.sample.com/artifactory \
               --user=marslo \
               --access-token=c**************************************************************Q \
               --interactive=false \
               --insecure-tls
  • in docker

    $ docker run -it \
                 --rm \
                 -v $(PWD):/root docker.bintray.io/jfrog/jfrog-cli-go \
                 jfrog rt c prod \
                          --url=https://artifactory.example.com/artifactory \
                          --user=myaccount \
                          --password=mypassword

set default

$ jf rt use <SERVER_ID>

ping

  • check configuration or remote server

    $ jf rt p
    OK
    
    # or
    $ jfrog rt p --server-id=sample
    OK

deploy

[!NOTE|label:references:]

$ jf rt u \
     --recursive=true \
     --threads=8 \
     --retries=3 \
     --exclusions="*backup*;*sandbox*" \
     <LOCAL_PATH>/(*) <REPO>/<TARGET_PATH>/{1} \

download

[!NOTE|label:references:]

copy

[!NOTE|label:references:]

move

[!NOTE|label:references:]

remove

[!NOTE|label:references:]

search

[!NOTE|label:references:]

manage properties

[!NOTE|label:references:]

usage

discarding old builds from artifactory

  • clean build info and artifacts 30 days before

    $ jf use <sample>
    $ jfrog rt bdi --max-days=30 --delete-artifacts=true "my-job-build"
    $ jfrog rt use sample
    $ jfrog rt bdi --max-days=30 --delete-artifacts=true "my-job-build"
  • using cli via docker

    $ docker run \
             -it \
             --rm \
             -v $(PWD):/root docker.bintray.io/jfrog/jfrog-cli-go \
                       jfrog rt bdi --max-days=45 --delete-artifacts 'ci - buildinfo - name'

search with aql

[!NOTE|label:references:]

$ cat spec.json
{
  "files": [{
    "aql": {
      "items.find": {
        "repo": "my-repo",
        "type":"folder",
        "depth" : "1",
        "created": { "$before": "15d" }
      }
    }
  }]
}

$ jfrog rt s --spec spec.json
  • delete with aql search

    $ jfrog rt del --spec spec.json

delete docker images

#              registry name  image name    tag
#              +-----------+ +-----------+ +---+
$ jf rt delete docker-local/devops/ubuntu/4.0.0**
  docker-local/devops/ubuntu/4.0.0-py310-jammy-dind-v95-94d13a3db/
  docker-local/devops/ubuntu/4.0.0-py310-jammy-dind/
  docker-local/devops/ubuntu/4.0.0-py310-jammy/
Are you sure you want to delete the above paths? (y/n) [n]? y
{
  "status": "success",
  "totals": {
    "success": 3,
    "failure": 0
  }
}

# or remote all v4.0.0* tags via
$ jf rt delete docker-local/devops/*/4.0.0**
  docker-local/devops/clang/4.0.0-py310-jammy-dind-v95-94d13a3db/
  docker-local/devops/clang/4.0.0-py310-jammy-dind/
  docker-local/devops/clang/4.0.0-py310-jammy-v95-94d13a3db/
  docker-local/devops/clang/4.0.0-py310-jammy/
  docker-local/devops/doxygen/4.0.0-py310-jammy-dind-v95-94d13a3db/
  docker-local/devops/doxygen/4.0.0-py310-jammy-dind/
  docker-local/devops/doxygen/4.0.0-py310-jammy-v95-94d13a3db/
  docker-local/devops/doxygen/4.0.0-py310-jammy/
  docker-local/devops/jnlp/4.0.0-py310-jammy-dind-v95-94d13a3db/
  docker-local/devops/jnlp/4.0.0-py310-jammy-dind/
  docker-local/devops/jnlp/4.0.0-py310-jammy-v95-94d13a3db/
  docker-local/devops/jnlp/4.0.0-py310-jammy/
Are you sure you want to delete the above paths? (y/n) [n]?

[!NOTE|label:references:]

$ jf rt docker-promote hello-world default-docker-local stef-docker-local \
                       --source-tag=1.0.0 \
                       --target-docker-image=hello-world \
                       --target-tag=prod

npm

[!NOTE|label:references:]

$ cd path/to/project
$ jf npm-config --repo-deploy <LOCAL-REPO> --repo-resolve <REMOTE-REPO>

# i.e.:
$ jf npm-config --repo-deploy npmjs-local --repo-resolve npmjs-remote

# result
$ cat .jfrog/projects/npm.yaml
   1   version: 1
   2   type: npm
   3   resolver:
   4       repo: poc-npmjs-remote
   5       serverId: stg
   6   deployer:
   7       repo: poc-npmjs-local
   8       serverId: stg
  • using jf for npm

    [!NOTE|label:references:]

    $ jf npm --help
    
    Name:
      jf npm - Run npm command.
    
    Usage:
      jf npm <npm arguments> [command options]
    
    Arguments:
      ci                        Run npm ci.
      publish, p                Packs and deploys the npm package to the designated npm repository.
      install, i, isntall, add  Run npm install.
      help, h
    $ jf npm install

* JFrog CLI v2
* Artifactory CLI
* Get Cli
JFrog CLI
INSTALL JFROG CLI
Download and Install
jfrog/jfrog-cli
jfrog-cli/build/deb_rpm/v2-jf/build-scripts/pack.sh
jfrog-cli/build/deb_rpm/v2-jf/build-scripts/deb-install.sh
jfrog-cli/build/deb_rpm/v2-jf/build-scripts/rpm-install.sh
jfrog-cli/build/deb_rpm/v2-jf/build-scripts/rpm-sign.sh
#1741 Installing CLI without apt-key
jf options
CLI for JFrog Artifactory
via ssh
via password/api key
access token
Placeholders
Uploading Files
Downloading Files
Copying Files
Moving Files
Deleting Files
Searching Files
Setting Properties on Files
Deleting Properties from Files
Jfrog artifactory delete folder of containing artifacts after remove them
deploy docker image via cli
* iMarlso: deploy docker image via API
Step 2: Use the CLI in your project
Setting npm repositories
Use the npm Command Line
npm Packages with JFrog CLI
CLI setup
completion
Environment Variables
jf options
CLI
CLI
configuration
ping
deploy
download
copy
move
remove
search
manage properties
usage
discarding old builds from artifactory
search with aql
delete docker images
deploy docker image via cli
npm