Branch | Status |
---|---|
master | |
dev |
- Overview
- Download and Installation
- Building the Executable
- Tests
- Code Contributions
- Using JFrog CLI
- Release Notes
JFrog CLI is a compact and smart client that provides a simple interface that automates access to Artifactory, Bintray and Mission Control through their respective REST APIs. By using the JFrog CLI, you can greatly simplify your automation scripts making them more readable and easier to maintain. Several features of the JFrog CLI makes your scripts more efficient and reliable:
- Multi-threaded upload and download of artifacts make builds run faster
- Checksum optimization reduces redundant file transfers
- Wildcards and regular expressions give you an easy way to collect all the artifacts you wish to upload or download.
- "Dry run" gives you a preview of file transfer operations before you actually run them
You can download the executable directly using the JFrog CLI Download Page, or install it with npm, homebrew or docker.
npm install jfrog-cli-go
brew install jfrog-cli-go
docker run docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog <COMMAND>
JFrog CLI is written in the Go programming language, so to build the CLI yourself, you first need to have Go installed and configured on your machine.
To download and install Go
, please refer to the Go documentation.
Please download Go 1.14.x
or above.
Navigate to a directory where you want to create the jfrog-cli project, outside the $GOPATH
tree.
If the GOPATH
variable is unset, it's default value is the go folder under the user home.
Verify that the GO111MODULE
variable is either unset, or explicitly set to auto
.
Clone the jfrog-cli project by executing the following command:
git clone https://github.com/jfrog/jfrog-cli
Build the project by navigating to the jfrog folder and executing the following commands. On Unix based systems run:
cd jfrog-cli
build/build.sh
On Windows run:
cd jfrog-cli
build\build.bat
Once completed, you will find the JFrog CLI executable at your current directory.
go test -v github.com/jfrog/jfrog-cli [test-types] [flags]
The flags are:
Flag | Description |
---|---|
-rt.url |
[Default: http://localhost:8081/artifactory] Artifactory URL. |
-rt.user |
[Default: admin] Artifactory username. |
-rt.password |
[Default: password] Artifactory password. |
-rt.apikey |
Artifactory API key. |
-rt.accessToken |
Artifactory access token. |
The types are:
Type | Description |
---|---|
-test.artifactory |
Artifactory tests |
-test.npm |
Npm tests |
-test.maven |
Maven tests |
-test.gradle |
Gradle tests |
-test.docker |
Docker tests |
-test.go |
Go tests |
-test.pip |
Pip tests |
-test.nuget |
Nuget tests |
- Running the tests will create builds and repositories with timestamps,
for example:
cli-tests-rt1-1592990748
andcli-tests-rt2-1592990748
.
Once the tests are completed, the content of these repositories will be deleted.
In addition to general optional flags you can use the following optional artifactory flags.
Flag | Description |
---|---|
-rt.sshKeyPath |
[Optional] Ssh key file path. Should be used only if the Artifactory URL format is ssh://[domain]:port. |
-rt.sshPassphrase |
[Optional] Ssh key passphrase. |
To run artifactory tests execute the following command.
go test -v github.com/jfrog/jfrog-cli -test.artifactory [flags]
- The npm executables should be included as part of the PATH environment variable.
- Currently, npm integration support only http(s) connections to Artifactory using username and password.
To run npm tests execute the following command.
go test -v github.com/jfrog/jfrog-cli -test.npm [flags]
- The M2_HOME environment variable should be set to the local maven installation path.
- The java executable should be included as part of the PATH environment variable. Alternatively, set the JAVA_HOME environment variable.
- Currently, maven integration support only http(s) connections to Artifactory using username and password.
To run maven tests execute the following command.
go test -v github.com/jfrog/jfrog-cli -test.maven [flags]
- The gradle executables should be included as part of the PATH environment variable.
- The java executable should be included as part of the PATH environment variable. Alternatively, set the JAVA_HOME environment variable.
- Currently, gradle integration support only http(s) connections to Artifactory using username and password.
To run gradle tests execute the following command.
go test -v github.com/jfrog/jfrog-cli -test.gradle [flags]
In addition to general optional flags you must use the following docker flags.
Flag | Description |
---|---|
-rt.dockerRepoDomain |
Artifactory Docker registry domain. |
-rt.dockerVirtualRepo |
Artifactory Docker virtual repository name. |
-rt.dockerTargetRepo |
Artifactory Docker repository name. |
To run docker tests execute the following command (fill out the missing parameters as described below).
go test -v github.com/jfrog/jfrog-cli -test.docker -rt.dockerRepoDomain=DOCKER_DOMAIN -rt.dockerTargetRepo=DOCKER_TARGET_REPO [flags]
To run go tests run the following command.
go test -v github.com/jfrog/jfrog-cli -test.go [flags]
- Add NuGet executable to the system search path (PATH environment variable).
- Create a remote repository named jfrog-cli-tests-nuget-remote-repo.
- Run the following command.
go test -v github.com/jfrog/jfrog-cli -test.nuget [flags]
- Add Python and pip executables to the system search path (PATH environment variable).
- Pip tests must run inside a clean pip-environment. You can either activate a virtual-environment and execute the tests from within, or provide the path to your virtual-environment using the -rt.pipVirtualEnv flag.
- Run the following command:
In addition to general optional flags you can use the following optional pip flags
Flag | Description |
---|---|
-rt.pipVirtualEnv |
[Optional] Path to the directory of a clean pip virtual-environment. Make sure to provide the binaries directory (in unix: /bin, in windows: \Scripts). |
go test -v github.com/jfrog/jfrog-cli -test.pip [flags]
Bintray tests credentials are taken from the CLI configuration. If non configured or not passed as flags, the tests will fail.
To run Bintray tests execute the following command:
go test -v github.com/jfrog/jfrog-cli -test.bintray
Flags:
Flag | Description |
---|---|
-bt.user |
[Mandatory if not configured] Bintray username. |
-bt.key |
[Mandatory if not configured] Bintray API key. |
-bt.org |
[Optional] Bintray organization. If not configured, -bt.user is used as the organization name. |
- Running the tests will create a repository named
cli-tests-bintray-<timestamp>
in bintray.
Once the tests are completed, the repository will be deleted.
In addition to general optional flags you can use the following flags:
Flag | Description |
---|---|
-rt.distUrl |
[Mandatory] JFrog Distribution URL. |
-rt.distAccessToken |
[Optional] Distribution access token. |
To run distribution tests run the following command:
go test -v github.com/jfrog/jfrog-cli -test.distribution [flags]
We welcome code contributions through pull requests from the community.
- If the existing tests do not already cover your changes, please add tests..
- Pull requests should be created on the dev branch.
- Please use gofmt for formatting the code before submitting the pull request.
JFrog CLI can be used for a variety of functions with Artifactory, Bintray, Xray and Mission Control, and has a dedicated set of commands for each product. To learn how to use JFrog CLI, please visit the JFrog CLI User Guide.
The docker image of JFrog CLI can be pulled from Bintray by running the following command:
docker pull docker.bintray.io/jfrog/jfrog-cli-go:latest
Run a JFrog CLI command using docker as follows:
docker run docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog <COMMAND>
The release are available on Bintray.