Page tree
Skip to end of metadata
Go to start of metadata

Welcome to JFrog CLI

JFrog CLI is a compact and smart client that provides a simple interface that automates access to JFrog products simplifying your automation scripts making them more readable and easier to maintain.JFrog CLI works with JFrog Artifactory, Xray, Distribution and Mission Control, (through their respective REST APIs) making your scripts more efficient and reliable in several ways:

Parallel uploads and downloads

JFrog CLI allows you to upload and download artifacts concurrently by a configurable number of threads that help your automated builds run faster. For big artifacts, you can define a number of chunks to split files for parallel download.

Checksum optimization

上传和下载opera JFrog CLI优化tions by skipping artifacts that already exist in their target location. Before uploading an artifact, JFrog CLI queries Artifactory with the artifact's checksum. If it already exists in Artifactory's storage, the CLI skips sending the file, and if necessary, Artifactory only updates its database to reflect the artifact upload. Similarly, when downloading an artifact from Artifactory if the artifact already exists in the same download path, it will be skipped. With checksum optimization, long upload and download operations can be paused in the middle, and then be continued later where they were left off.

Flexible uploads and downloads

JFrog CLI supports uploading files to Artifactory using wildcard patterns, regular expressions and ANT patterns, giving you an easy way to collect all the files you wish to upload. You can also download files using wildcard patterns.

Upload and download preview

All upload and download operations can be used with the--dry-runoption to give you a preview of all the files that would be uploaded with the current command.


JFrog CLI v2

Overview

我们最近发布的JFrog CLI v2,包括udes changes to the functionality and usage of some of the legacy JFrog CLI commands. The changes are the result of feedback we received from users over time through GitHub, making the usage and functionality easier and more intuitive. For example, some of the default values changed, and are now more consistent across different commands. We also took this opportunity for improving and restructuring the code, as well as replacing old and deprecated functionality.

Most of the changes included in v2 are breaking changes compared to the v1 releases. We therefore packaged and released these changes under JFrog CLI v2, allowing users to migrate to v2 only when they are ready.

We intend to keep v1 available. Future enhancements however are planned to be introduced as part of v2. We therefore encourage users to migrate from the legacy releases to v2.

List of changes in JFrog CLI v2

  1. The default value of the--flatoption is now set to false for thejfrogrt uploadcommand.
  2. The deprecated syntax of thejfrogrt mvncommand is no longer supported. To use the new syntax, the project needs to be first configured using thejfrogrt mvnccommand.
  3. The deprecated syntax of thejfrogrt gradlecommand is no longer supported. To use the new syntax, the project needs to be first configured using thejfrogrt gradleccommand.
  4. The deprecated syntax of thejfrogrt npmandjfrogrt npm-cicommands is no longer supported. To use the new syntax, the project needs to be first configured using thejfrogrt npmccommand.
  5. The deprecated syntax of thejfrogrt gocommand is no longer supported. To use the new syntax, the project needs to be first configured using thejfrogrt go-configcommand.
  6. The deprecated syntax of thejfrogrt nugetcommand is no longer supported. To use the new syntax, the project needs to be first configured using thejfrogrt nugetccommand.
  7. All Bintray commands are removed.
  8. Thejfrogrt configcommand is removed and replaced by thejfrogconfig addcommand.
  9. Thejfrogrt usecommand is removed and replaced with thejfrogconfig use.
  10. The--propscommand option andpropsfile spec property for thejfrogrt uploadcommand are removed, and replaced with the--target-propscommand option andtargetPropsfile spec property respectively.
  11. The following commands are removed

    jfrogrt release-bundle-create jfrog rt release-bundle-delete jfrog rt release-bundle-distribute jfrog rt release-bundle-sign jfrog rt release-bundle-update

    andreplaced with the following commands respectively

    jfrog ds release-bundle-create jfrog ds release-bundle-delete jfrog ds release-bundle-distribute jfrog ds release-bundle-sign jfrog ds release-bundle-update
  12. Thejfrogrt go-publishcommand now only supports Artifactory version 6.10.0 and above. Also, the command no longer accepts the target repository as an argument. The target repository should be pre-configured using thejfrogrt go-configcommand.
  13. Thejfrogrt gocommand no longer falls back to the VCS when dependencies are not found in Artifactory.
  14. The--deps,--publish-deps,--no-registryand--selfoptions of thejfrogrt go-publishcommand are now removed.
  15. The--apiKeyoption is now removed. The API key should now be passed as the value of the--passwordoption.
  16. The--exclude-patternsoption is now removed, and replaced with the--exclusionsoption. The same is true for theexcludePatternsfile spec property, which is replaced with the除外责任property.
  17. TheJFROG_CLI_JCENTER_REMOTE_SERVERandJFROG_CLI_JCENTER_REMOTE_REPOenvironment variables are now removed and replaced with theJFROG_CLI_EXTRACTORS_REMOTEenvironment variable.
  18. TheJFROG_CLI_HOMEenvironment variable is now removed and replaced with theJFROG_CLI_HOME_DIRenvironment variable.
  19. TheJFROG_CLI_OFFER_CONFIGenvironment variable is now removed and replaced with theCIenvironment variable. Setting CI to true disables all prompts.
  20. The directory structure is now changed when thejfrogrt downloadcommand is used with placeholders and --flat=false(--flat=false is now the default). When placeholders are used, the value of the--flatoption is ignored.
  21. When thejfrogrt uploadcommand now uploads symlinks to Atyifctory, the target file referenced by the symlink is uploaded to Artifactory with the symlink name. If the--symlinkoptions is used, the symlink itself (not the referenced file) is uploaded, with the referenced file as a property attached to the file.


Download and installation

General

下载可执行文件,请访问JFrog CLI Download Site.

You can also download the sources from theJFrog CLI Projecton GitHub where you will also find instructions on how to build JFrog CLI.

The legacy name of JFrog CLI's executable isjfrog. In an effort to make the CLI usage easier and more convenient, we recently exposed a series of new installers, which install JFrog CLI with the newjfexecutable name. For backward compatibility, the old installers will remain available. We recommend however migrating to the newerjfexecutable name.

JFrog CLI v2 "jf" installers

The following installers are available for JFrog CLI v2. These installers make JFrog CLI available through thejfexecutable.

Debian
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; apt update; apt install -y jfrog-cli-v2-jf;
RPM
echo "[jfrog-cli]" > jfrog-cli.repo; echo "name=jfrog-cli" >> jfrog-cli.repo; echo "baseurl=https://releases.jfrog.io/artifactory/jfrog-rpms" >> jfrog-cli.repo; echo "enabled=1" >> jfrog-cli.repo; rpm --import https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key sudo mv jfrog-cli.repo /etc/yum.repos.d/; yum install -y jfrog-cli-v2-jf;
Homebrew
brew install jfrog-cli
Install with cUrl
curl -fL https://install-cli.jfrog.io | sh
Download with cUrl
curl -fL https://getcli.jfrog.io/v2-jf | sh
NPM
npm install -g 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
Powershell
powershell "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/[RELEASE]/jfrog-cli-windows-amd64/jf.exe -OutFile $env:SYSTEMROOT\system32\jf.exe'"
Chocolatey
choco install jfrog-cli-v2-jf


JFrog CLI v2 "jfrog" installers

The following installers are available for JFrog CLI v2. These installers make JFrog CLI available through thejfrogexecutable.

Debian
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; apt update; apt install -y jfrog-cli-v2;
RPM
echo "[jfrog-cli]" > jfrog-cli.repo; echo "name=jfrog-cli" >> jfrog-cli.repo; echo "baseurl=https://releases.jfrog.io/artifactory/jfrog-rpms" >> jfrog-cli.repo; echo "enabled=1" >> jfrog-cli.repo; rpm --import https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key sudo mv jfrog-cli.repo /etc/yum.repos.d/; yum install -y jfrog-cli-v2;
Homebrew
brew install jfrog-cli
Download with Curl
curl -fL https://getcli.jfrog.io/v2 | sh
NPM
npm install -g jfrog-cli-v2
Docker
Slim: docker run releases-docker.jfrog.io/jfrog/jfrog-cli-v2 jfrog -v Full: docker run releases-docker.jfrog.io/jfrog/jfrog-cli-full-v2 jfrog -v
Chocolatey
choco install jfrog-cli


JFrog CLI v1 (legacy) installers

The following installations are available for JFrog CLI v1. These installers make JFrog CLI available through thejfrogexecutable.

Debian
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; apt update; apt install -y jfrog-cli;
RPM
echo "[jfrog-cli]" > jfrog-cli.repo; echo "name=jfrog-cli" >> jfrog-cli.repo; echo "baseurl=https://releases.jfrog.io/artifactory/jfrog-rpms" >> jfrog-cli.repo; echo "enabled=1" >> jfrog-cli.repo; rpm --import https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key sudo mv jfrog-cli.repo /etc/yum.repos.d/; yum install -y jfrog-cli;
Download with cUrl
curl -fL https://getcli.jfrog.io | sh
NPM
npm install -g jfrog-cli-go
Docker
Slim: docker run releases-docker.jfrog.io/jfrog/jfrog-cli jfrog -v Full: docker run releases-docker.jfrog.io/jfrog/jfrog-cli-full jfrog -v
Go
GO111MODULE=on go get github.com/jfrog/jfrog-cli; if [ -z "$GOPATH" ] then binPath="$HOME/go/bin"; else binPath="$GOPATH/bin"; fi; mv "$binPath/jfrog-cli" "$binPath/jfrog"; echo "$($binPath/jfrog -v) is installed at $binPath";


System Requirements

JFrog CLI runs on any modern OS that fully supports theGo programming language.


Usage

To use the CLI,installit on your local machine, ordownloadits executable,place it anywhere in your file system and add its location to your路径environment variable.


Environment Variables

Thejf optionscommand displays all the supported environment variables.

JFrog CLI makes use of the following environment variables:

Variable Name
Description
JFROG_CLI_LOG_LEVEL

[Default: INFO]

This variable determines the log level of the JFrog CLI.
Possible values are:INFO,ERROR, and DEBUG.
If set to ERROR, JFrog CLI logs error messages only. It is useful when you wish to read or parse the JFrog CLI output and do not want any other information logged.

JFROG_CLI_LOG_TIMESTAMP

[Default: TIME]

Controls the log messages timestamp format.Possible values are: TIME, DATE_AND_TIME, and OFF.

JFROG_CLI_HOME_DIR

[Default: ~/.jfrog]

Defines the JFrog CLI home directory.

JFROG_CLI_TEMP_DIR

[Default: The operating system's temp directory]

Defines the temp directory used by JFrog CLI.

JFROG_CLI_PLUGINS_SERVER

[Default: Official JFrog CLI Plugins registry]

Configured Artifactory server ID from which to download JFrog CLI Plugins.

JFROG_CLI_PLUGINS_REPO

[Default: 'jfrog-cli-plugins']

Can be optionally used with the JFROG_CLI_PLUGINS_SERVER environment variable.Determines the name of the local repository to use.

CI

[Default: false]

If true, disables interactive prompts and progress bar.

JFrog Platform Configuration

Adding and Editing Configured Servers

Theconfig addandconfig editcommands are used to add and edit JFrog Platform server configuration, stored in JFrog CLI's configuration storage. These configured servers can be used by the other commands. The configured servers' details can be overridden per command by passing in alternative values for the URL and login credentials. The values configured are saved in file under the JFrog CLI home directory.

Command name
config add / config edit
Abbreviation
c add / c edit
命令选项


--access-token

[Optional]

Access token.

--artifactory-url

[Optional]

Artifactory URL.

--basic-auth-only

[Default: false]

Used for Artifactory authentication. Set to true to disable replacing username and password/API key with automatically created access token that's refreshed hourly. Username and password/API key will still be used with commands which use external tools or the JFrog Distribution service. Can only be passed along with username and password/API key options.

--client-cert-key-path

[Optional]

Private key file for the client certificate in PEM format.

--client-cert-path

[Optional]

Client certificate file in PEM format.

--dist-url

[Optional]

Distribution URL.

--enc-password

[Default: true]

If true, the configured password will be encrypted using Artifactory'sencryption APIbefore being stored.If false, the configured password will not be encrypted.

--insecure-tls

Default: false]

Set to true to skip TLS certificates verification, while encrypting the Artifactory password during the config process.

--interactive

[Default: true, unless $CI is true]

Set to false if you do not want the config command to be interactive.

--mission-control-url

[Optional]

Mission Control URL.

--password

[Optional]

JFrog Platform password.

--pipelines-url

[Optional]

Pipelines URL.

--ssh-key-path

[Optional]

For authentication with Artifactory. SSH key file path.

--url

[Optional]

JFrog platform URL.

--user

[Optional]

JFrog Platform username.

--xray-url [Optional] Xray URL.
--overwrite

[Available forconfig addonly]

[Default: false]

Overwrites the instance configuration if an instance with the same ID already exists.

Command arguments

server ID A unique ID for the server configuration.

Removing Configured Servers

Theconfig removecommand is used to remove JFrog Platform server configuration, stored in JFrog CLI's configuration storage.

Command name
config remove
Abbreviation
c rm
命令选项


--quiet

[Default: $CI]

Set to true to skip the delete confirmation message.

Command arguments

server ID The server ID to remove. If no argument is sent, all configured servers are removed.


Showing the Configured Servers

Theconfig showcommand shows the stored configuration. You may show a specific server's configuration by sending its ID as an argument to the command.

Command name
config show
Abbreviation
c s
Command arguments

server ID The ID of the server to show. If no argument is sent, all configured servers are shown.


Setting a Server as Default

Theconfig usecommand sets a configured server as default. The following commands will use this server.

Command name
config use
Command arguments

server ID The ID of the server to set as default.

Exporting and Importing Configuration

Theconfig exportcommand generates a token, which stores the server configuration. This token can be used by theconfig importcommand, to import the configuration stored in the token, and save it in JFrog CLI's configuration storage.

Export

Command name
config export
Abbreviation
c ex
Command arguments

server ID The ID of the server to export

Import

Command name
config import
Abbreviation
c im
Command arguments

服务器的令牌 The token to import

Setting up a CI Pipeline

Theci-setupcommand allows setting up a basic CI pipeline with the JFrog Platform, while automatically configuring the JFrog Platform to serve the pipeline. It is an interactive command, which prompts you with a series for questions, such as your source control details, your build tool, build command and your CI provider. The command then uses this information to do following:

  • Create the repositories in JFrog Artifactory, to be used by the pipeline to resolve dependencies.
  • Configure JFrog Xray to scan the build.
  • Generate a basic CI pipeline, which builds and scans your code.

You can use the generated CI pipeline as a working starting point and then expand it as needed.

The command currently supports the following package managers:

  • Maven
  • Gradle
  • npm.

and the following CI providers:

  • JFrog Pipelines
  • Jenkins
  • GitHub Actions.

Usage:

jf ci-setup


Proxy Support

JFrog CLI supports using an HTTP/S proxy. All you need to do is set HTTP_PROXY or HTTPS_PROXY environment variable with the proxy URL.

HTTP_PROXY, HTTPS_PROXY and NO_PROXY are the industry standards for proxy usages.


Variable Name

Description

HTTP_PROXY

Determines a URL to an HTTP proxy.

HTTPS_PROXY

Determines a URL to an HTTPS proxy.

NO_PROXY

Use this variable to bypass the proxy to IP addresses, subnets or domains. This may containa comma-separated list of hostnames or IPs without protocols and ports. A typical usage may be to set this variable to Artifactory’s IP address.


Shell Auto-Completion

If you're using JFrog CLI from a bash, zsh, or fish shells, you can install JFrog CLI's auto-completion scripts.

Install JFrog CLI with Homebrew?

If you're installing JFrog CLI using Homebrew, the bash, zsh, or fish auto-complete scripts are automatically installed by Homebrew.Please make sure that your.bash_profileor.zshrcare configured as described in theHomebrew Shell Completion documentation.

Using Oh My Zsh?

With your favourite text editor, open$HOME/.zshrc andadd‘jfrog’to the plugin list.

For example:

plugins=(git mvn npm sdk jfrog)

To install auto-completion forbash, run the following command and follow the instructions to complete the installation:

jf completion bash --install

To install auto-completion forzsh, run the following command and follow the instructions to complete the installation:

jf completion zsh --install

To install auto-completion forfish, run the following command:

jf completion fish --install

Sensitive Data Encryption

Since version 1.37.0, JFrog CLI supports encrypting the sensitive data stored in JFrog CLI's config. To enable encryption, follow these steps.

  • Create a random 32 character master key. Make sure that the key size is exactly 32 characters. For examplef84hc22dQfhe9f8ydFwfsdn48!wejh8A
  • Create a file namedsecurity.yamlunder~/.jfrog/security.

    If you modified the default JFrog CLI home directory by setting JFROG_CLI_HOME_DIR environment variable, then thesecurity/security.yamlfile should br created under the configured home directory.

  • Add the master key you generated to security.yaml. The file content should be:

version: 1 masterKey: ""
  • Make sure that the only permission security.yaml has is read for the user running JFrog CLI.

The configuration will be encrypted the next time JFrog CLI attempts to access the config.

When upgrading JFrog CLI from a version prior to 1.37.0 to version 1.37.0 or above, JFrog CLI automatically makes changes to the content of the ~/.jfrogdirectory, to support the new functionality introduced in version 1.37.0. Before making these changes, the content of the~/.jfrogdirectory is backed up inside the ~/.jfrog/backupdirectory. Therefore, after enabling sensitive data encryption, it is recommended to remove thebackupdirectory, to ensure no sensitive data is left unencrypted.


JFrog CLI Plugins

General

JFrog CLI Plugins allow enhancing the functionality of JFrog CLI to meet the specific user and organization needs. The source code of a plugin is maintained as an open source Go project on GitHub. All public plugins are registered inJFrog CLI's Plugins Registry. We encourage you, as developers, to create plugins and share them publicly with the rest of the community. When a plugin is included in the registry, it becomes publicly available and can be installed using JFrog CLI.Read theJFrog CLI Plugins Developer Guideif you wish to create and publish your own plugins.

Installing Plugins

A plugin which is includedJFrog CLI's Plugins Registrycan be installed using the following command.

$ jf plugin install the-plugin-name

This command will install the plugin from the official public registry by default. You can also install a plugin from a private JFrog CLI Plugin registry, as described in thePrivate Plugins Registriessection.

Private Plugins Registries

In addition to the public official JFrog CLI Plugins Registry, JFrog CLI supports publishing and installing plugins to and from private JFrog CLI Plugins Registries. A private registry can be hosted on any Artifactory server. It uses a local generic Artifactory repository for storing the plugins.

To create your own private plugins registry, follow these steps.

  • On your Artifactory server, create a local generic repository namedjfrog-cli-plugins.
  • Make sure your Artifactory server is included in JFrog CLI's configuration, by running thejf c showcommand.
  • If needed, configure your Artifactory instance using thejfrogc addcommand.
  • Set the ID of the configured server as the value of the JFROG_CLI_PLUGINS_SERVER environment variable.
  • If you wish the name of the plugins repository to be different than jfrog-cli-plugins, set this name as the value of the JFROG_CLI_PLUGINS_REPO environment variable.

Thejf plugin installcommand will now install plugins stored in your private registry.

To publish a plugin to the private registry, run the following command, while inside the root of the plugin's sources directory. This command will build the sources of the plugin for all the supported operating systems. All binaries will be uploaded to the configured registry.

jf plugin publish the-plugin-name the-plugin-version


Release Notes

Release notesforJFrog CLI v2

Release notesfor the legacy releases of JFrog CLI


  • No labels