概述
参考: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
最后
以上就是含蓄小兔子为你收集整理的使用jfrog ci 在artifactory中上传下载文件的全部内容,希望文章能够帮你解决使用jfrog ci 在artifactory中上传下载文件所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复