Last active
May 9, 2022 19:31
-
-
Save perfecto25/8ad606be41b1d7b4bb6a0327f4c91fd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REST API | |
### Artifactory #### | |
deploy artifact using REST | |
curl -u myUser:myP455w0rd! -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt | |
query artifacts by Repo and Path | |
curl -u user:pw -X POST -k http://mrxartifactory:8081/artifactory/api/search/aql -d "items.find({\"type\" : \"file\",\"\$and\":[{\"repo\" : {\"\$match\" : \"myRepo*\"}, \"path\" : {\"\$match\" : \"myPkg*\"} }]}).include(\"name\",\"repo\",\"path\",\"size\")" | |
# upload RPM to artifactory, include checksums | |
echo "----- get md5 checksum" | |
md5=$(md5sum $rpm_name | awk -F" " {'print $1'}) | |
echo "----- get sha1 checksum" | |
sha1=$(sha1sum $rpm_name | awk -F" " {'print $1'}) | |
echo "----- upload RPM to artifactory using API key" | |
curl -H "X-JFrog-Art-Api:${artif_key}" -H "X-Checksum-Md5:${md5}" -H "X-Checksum-Sha1:${sha1}" -X PUT "http://${artif_server}:${artif_port}/artifactory/${artif_repo_path}/${rpm_name}" -T $rpm_name | |
### BINTRAY #### | |
# get artifact name | |
product=$(ls %system.teamcity.build.checkoutDir% | grep myProduct) | |
# push to bintray | |
curl -T %system.teamcity.build.checkoutDir%/$product -u%bintray_user%:%bintray_key% https://api.bintray.com/org_name/repo_name/pkg_name/version_name/$product | |
# publish binaries on Bintray | |
curl -X POST -u%bintray_user%:%bintray_key% https://api.bintray.com/content/org_name/repo_name/pkg_name/version_name/publish | |
get all packages in a repo | |
curl -u<USERNAME>:<API_KEY> -X GET https://api.bintray.com/repos/<ORG NAME>/<REPO NAME>/packages | jq . | |
get all files under a specific pkg | |
curl -u<USERNAME>:<API-KEY> -X GET https://api.bintray.com/packages/<ORG NAME>/<REPO NAME>/<PKG NAME>/versions/<VERSION NUMBER>/files | jq . | |
delete a file in a package | |
curl -u <USER>:<API-KEY> -X DELETE https://api.bintray.com/content/<ORG NAME>/<REPO_NAME>/<name of file> | |
curl -u admin:2fc03434xxxx -X DELETE https://api.bintray.com/content/jfrog/test_rpms/myapp-0.1-x64.rpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment