使用jfrog ci 在artifactory中上传下载文件

本文详细介绍了如何通过JFrog CLI进行Artifactory配置,包括创建、查看、删除及测试配置,以及上传、下载和文件管理操作。从安装开始,到实例演示,为开发者提供一站式Artifactory管理工具使用教程。
摘要由CSDN通过智能技术生成

参考:https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory

1.jfrog ci安装

官方下载地址:https://www.jfrogchina.com/getcli/  或者https://jfrog.com/getcli/

linux下载安装:
[root@af01 ~]# wget 下载jfrog安装包 

[root@af01 ~]# chmod +x jfrog
[root@af01 ~]# ./jfrog --help

2.创建配置

2.1 创建一个server id为af-biz的配置
[root@af01 ~]# ./jfrog rt c af-111 --url=artifact服务器地址 --user=username --password=password 
JFrog Distribution URL (Optional): 
Replace username and password/API key with automatically created access token that’s refreshed hourly? (y/n): n
Is the Artifactory reverse proxy configured to accept a client certificate? (y/n): n

#af-111 是 server id,多个配置server id不能重复,--url 指定artifactory的url,--user指定用户名, --password指定密码

或者使用api key来添加
[root@af01 ~]# ./jfrog rt c af-222 --url=artifact服务器地址 --apikey=xxxxxx

2.2 查看配置
[root@af01 ~]# ./jfrog rt c show
Server ID: af-111
Url: artifact服务器地址
User: 用户名
Password: ***
Default: true

Server ID: af-222
Url:artifact服务器地址
API key: AK***
Default: false

2.3 删除配置
[root@af01 ~]# ./jfrog rt c delete af-222 
Are you sure you want to delete "af-222" configuration? (y/n): y

清除所有配置
[root@af01 ~]# ./jfrog rt c clear

2.4 测试配置
[root@af01 ~]# ./jfrog rt ping
OK

测试指定server 
[root@af01 ~]# ./jfrog rt ping --server-id=rt-server-1

3. 上传

Example 1
Upload a file called froggy.tgz to the root of the my-local-repo repository.
$ jfrog rt u froggy.tgz my-local-repo

Example 2
Collect all the zip files located under the build directory (including sub-directories), and upload them to the my-local-repo repository, under the zipFiles folder, while maintaining the original names of the files.
$ jfrog rt u "build/*.zip" my-local-repo/zipFiles/

Example 3
Collect all the zip files located under the build directory (including sub-directories), and upload them to the my-local-repo repository, under the zipFiles folder, while maintaining the original names of the files. Also delete all files in the my-local-repo repository, under the zipFiles folder, except for the files which were uploaded by this command.
$ jfrog rt u "build/*.zip" my-local-repo/zipFiles/ --sync-deletes="my-local-repo/zipFiles/"

Example 4
Collect all files located under the build directory (including sub-directories), and upload them to the my-release-local repository, under the files folder, while maintaining the original names of the artifacts. Exclude (do not upload) files, which include install as part of their path, and have the pack extension. This example uses a wildcard pattern. See Example 5, which uses regular expressions instead.
jfrog rt u "build/" my-release-local/files/ --exclusions="*install*pack*"

Example 5
Collect all files located under the build directory (including sub-directories), and upload them to the my-release-local repository, under the files folder, while maintaining the original names of the artifacts. Exclude (do not upload) files, which include install as part of their path, and have the pack extension. This example uses a regular expression. See Example 4, which uses a wildcard pattern instead.
jfrog rt u "build/" my-release-local/files/ --regexp --exclusions="(.*)install.*pack$"


4. 下载

Example 1
Download an artifact called cool-froggy.zip located at the root of the my-local-repo repository to the current directory.
$ jfrog rt dl my-local-repo/cool-froggy.zip

Example 2
Download all artifacts located under the all-my-frogs directory in the my-local-repo repository to the all-my-frogs folder under the current directory.
$ jfrog rt dl my-local-repo/all-my-frogs/ all-my-frogs/

Example 3
Download all artifacts located in the my-local-repo repository with a jar extension to the all-my-frogs folder under the current directory.
$ jfrog rt dl "my-local-repo/*.jar" all-my-frogs/

Example 4
Download the latest file uploaded to the all-my-frogs folder in the my-local-repo repository.
jfrog rt dl "my-local-repo/all-my-frogs/" --sort-by=created --sort-order=desc --limit=1

5. copy

Example 1
Copy all artifacts located under /rabbit in the source-frog-repo repository into the same path in the target-frog-repo repository.
$ jfrog rt cp source-frog-repo/rabbit/ target-frog-repo/rabbit/

Example 2
Copy all zip files located under /rabbit in the source-frog-repo repository into the same path in the target-frog-repo repository.
$ jfrog rt cp "source-frog-repo/rabbit/*.zip" target-frog-repo/rabbit/

Example 3
Copy all artifacts located under /rabbit in the source-frog-repo repository and with property "Version=1.0" into the same path in the target-frog-repo repository .
$ jfrog rt cp "source-frog-repo/rabbit/*" target-frog-repo/rabbit/ --props=Version=1.0

6. move

Example 1
Move all artifacts located under /rabbit in the source-frog-repo repository into the same path in the target-frog-repo repository.
$ jfrog rt mv source-frog-repo/rabbit/ target-frog-repo/rabbit/

Example 2
Move all zip files located under /rabbit in the source-frog-repo repository into the same path in the target-frog-repo repository.
$ jfrog rt mv "source-frog-repo/rabbit/*.zip" target-frog-repo/rabbit/

Example 3
Move all artifacts located under /rabbit in the source-frog-repo repository and with property "Version=1.0" into the same path in the target-frog-repo repository .
$ jfrog rt mv "source-frog-repo/rabbit/*" target-frog-repo/rabbit/ --props=Version=1.0

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值