0
点赞
收藏
分享

微信扫一扫

JFrog CLI 客户端的使用

概述

JFrog CLI 是一个智能的命令行客户端工具,它提供了一个简单的交互界面,可以自动访问JFrog仓库,简化指令脚本,便于操作维护,使用更加高效和可靠。

JFrog CLI 客户端的使用_客户端


官方介绍

https://jfrog.com/help/r/jfrog-cli/about-jfrog-cli

JFrog CLI 客户端的使用_ci_02


系统平台

CentOS Linux 7

JFrog CLI 客户端的使用_bundle_03


下载工具

官方下载链接 : https://jfrog.com/getcli/

JFrog CLI 客户端的使用_ci_04

按你系统需求,按你习惯下载对应的工具即可。

也分享个 GitHub 上的仓库链接

链接如下 : https://github.com/jfrog/jfrog-cli

JFrog CLI 客户端的使用_bundle_05


安装配置

我用的上面 GitHub 仓库的代码,下载到本地后,进入 installcli 目录后,按下面的方式执行。

JFrog CLI 客户端的使用_bundle_06

[root@192 installcli]# ./jfrog.sh
Downloading the latest version of JFrog CLI...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 25.4M  100 25.4M    0     0  2642k      0  0:00:09  0:00:09 --:--:-- 3673k

The jfrog executable was installed in /usr/local/bin
[root@192 installcli]# 
[root@192 installcli]# jfrog --version
jf version 2.45.0
[root@192 installcli]#

在下载安装的时候,需要 root 账户,下载完成后,自动就 copy 到 /usr/local/bin 目录下了,执行版本查看,能正常显示版本,就说明客户端工具,就安装完成了,就这么简单。


配置环境


JFrog CLI 客户端的使用_客户端_07

# 主要是如下的几个配置项,按实践需求配置即可。
1、服务器ID
2、服务器URL
3、用户名
4、用户密码 或者 API Key

[scm@192 ~]$
[scm@192 ~]$ jfrog rt ping
To avoid this message in the future, set the CI environment variable to true.
The CLI commands require the URL and authentication details
Configuring JFrog CLI with these parameters now will save you having to include them as command options.
You can also configure these parameters later using the 'jfrog c' command.
Configure now? (y/n) [n]? y
Choose a server ID: jfdev
JFrog Platform URL: http://192.168.59.148:18081/
JFrog username: admin
JFrog password or API key:
Is the Artifactory reverse proxy configured to accept a client certificate? (y/n) [n]?
Your JFrog URL uses an insecure HTTP connection, instead of HTTPS. Are you sure you want to continue? (y/n) [n]? y
OK
[scm@192 ~]$ jfrog rt ping
OK
[scm@192 ~]$ jfrog c show
Server ID:                      jfdev
JFrog Platform URL:             http://192.168.59.148:18081/
Artifactory URL:                http://192.168.59.148:18081/artifactory/
Distribution URL:               http://192.168.59.148:18081/distribution/
Xray URL:                       http://192.168.59.148:18081/xray/
Mission Control URL:            http://192.168.59.148:18081/mc/
Pipelines URL:                  http://192.168.59.148:18081/pipelines/
User:                           admin
Password:                       ***
Access token:                   *** (Subject: 'jfrt@01f2rs2gwna0m50wffq8ba1vna/users/admin')
Default:                        true

[scm@192 ~]$
[scm@192 ~]$

客户端工具环境配置完成后,就可以使用客户端工具了。

如下示例展示客户端工具的使用

JFrog CLI 客户端的使用_客户端_08


登录 jfrog 系统,查看刚才上传的制品包。

JFrog CLI 客户端的使用_bundle_09

可以看到,使用 JFrog CLI 客户端工具,已顺利上传了制品包。

JFrog CLI 还有非常多非常强大的功能,需要的同学可以在官网查看学习使用,也可以查看帮助学习。

[scm@192 target]$ jfrog --help
NAME:
   jfrog - See https://github.com/jfrog/jfrog-cli for usage instructions.

USAGE:
   jfrog [global options] command [command options] [arguments...]

VERSION:
   2.45.0

COMMANDS:
     help, h  Shows a list of commands or help for one command

   Audit & Scan:
     audit, aud          Audit your local project's dependencies by generating a dependency tree and scanning it with Xray.
     build-scan, bs      Scan a published build-info with Xray.
     curation-audit, ca  Audit your project dependencies for their curation status.
     scan, s             Scan files located on the local file-system with Xray.

   Build Tools:
     docker                  Run any docker command, including ‘jf docker scan’ for scanning a local image with Xray.
     dotnet                  Run .NET Core CLI.
     dotnet-config, dotnetc  Generate dotnet configuration.
     go, go                  Runs go.
     go-config, goc          Generate go build configuration.
     go-publish, gp          Publish go package and/or its dependencies to Artifactory.
     gradle                  Run Gradle build.
     gradle-config, gradlec  Generate gradle build configuration.
     mvn                     Run Maven build.
     mvn-config, mvnc        Generate maven build configuration.
     npm                     Run npm command.
     npm-config, npmc        Generate npm configuration.
     nuget                   Run NuGet.
     nuget-config, nugetc    Generate nuget configuration.
     pip                     Run pip install.
     pip-config, pipc        Generate pip build configuration.
     pipenv                  Run pipenv install.
     pipenv-config, pipec    Generate pipenv build configuration.
     poetry                  Run poetry command
     poetry-config, poc      Generate poetry build configuration.
     terraform, tf           Runs terraform
     terraform-config, tfc   Generate terraform configuration.
     yarn                    Run Yarn commands.
     yarn-config, yarnc      Generate Yarn configuration.

   Lifecycle:
     release-bundle-create, rbc   Create a release bundle from builds or from existing release bundles
     release-bundle-promote, rbp  Promote a release bundle

   Other:
     rt          Artifactory commands.
     mc          Mission Control commands.
     xr          Xray commands.
     ds          Distribution commands.
     pl          JFrog Pipelines commands.
     completion  Generate autocomplete scripts.
     plugin      Plugins handling commands.
     config, c   Config commands.
     project     Project commands.
     ci-setup    Set up a CI pipeline with the JFrog Platform.
     options     Show all supported environment variables.

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version


[scm@192 target]$

至此,JFrog CLI 客户端的使用就介绍到这,希望对各位有所帮助,也希望看过的同学,动动你发财的手,点个小红心点个赞。

举报

相关推荐

0 条评论