DevOps Tools/Repository Management/Artifactory
From r00tedvw.com wiki
(Difference between revisions)
| Line 23: | Line 23: | ||
curl --header "X-Checksum-Sha1:${checksum}" -u $username:$password -T $f "$artifactoryurl/$file" | curl --header "X-Checksum-Sha1:${checksum}" -u $username:$password -T $f "$artifactoryurl/$file" | ||
done</nowiki> | done</nowiki> | ||
| + | ==Using API token== | ||
| + | also calculating all the hashes with openssl | ||
| + | <nowiki>#!/bin/bash | ||
| + | |||
| + | url=http://dockerhost:8081/artifactory/generic-local | ||
| + | apikey=697929fdb66e46e1db0b4ec1fd4292028a853c7879a969b3e0188b14ee24d55d98d7e8110c2579c0 | ||
| + | localfile=/Users/r00t/test.html | ||
| + | |||
| + | file=$(basename $localfile) | ||
| + | sha1checksum=$(openssl sha1 $localfile | awk '{ print $2 }') | ||
| + | md5checksum=$(openssl md5 $localfile | awk '{ print $2 }') | ||
| + | sha256checksum=$(openssl sha256 $localfile | awk '{ print $2 }') | ||
| + | |||
| + | curl --header "X-JFrog-Art-Api:${apikey}" \ | ||
| + | --header "X-Checksum-Sha1:${sha1checksum}" \ | ||
| + | --header "X-Checksum-MD5:${md5checksum}" \ | ||
| + | --header "X-Checksum-Sha256:${sha256checksum}" \ | ||
| + | --upload-file $localfile \ | ||
| + | -X PUT "$url/$file"</nowiki> | ||
Revision as of 13:20, 3 December 2019
Artifactory
Contents |
Installation
Docker
Using docker you can pull the container from jfrog and then mount a local volume to house the configuration files and data.
https://www.jfrog.com/confluence/display/RTF/Installing+with+Docker
~$ sudo mkdir -p /opt/jfrog/artifactory ~$ sudo chown -R 1030:1030 /opt/jfrog/artifactory ~$ docker pull docker.bintray.io/jfrog/artifactory-oss:latest ~$ docker run --name artifactory-oss -d -v /opt/jfrog/artifactory:/var/opt/jfrog/artifactory -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:latest
Uploading bulk
quick script to upload in bulk and add the sha1 checksum.
#!/bin/bash
FILES=/Users/r00t/Downloads/*
username=r00t
password=FDOdohfsohf347fsHDJDokhf89
artifactoryurl=http://usa-rnc-dockerhost:8081/artifactory/generic-local/
for f in $FILES
do
echo "Uploading $f to artifactory"
checksum=$(shasum -a 1 $f | awk '{ print $1 }')
file=$(printf $f | awk -F "/" '{ print $NF}')
curl --header "X-Checksum-Sha1:${checksum}" -u $username:$password -T $f "$artifactoryurl/$file"
done
Using API token
also calculating all the hashes with openssl
#!/bin/bash
url=http://dockerhost:8081/artifactory/generic-local
apikey=697929fdb66e46e1db0b4ec1fd4292028a853c7879a969b3e0188b14ee24d55d98d7e8110c2579c0
localfile=/Users/r00t/test.html
file=$(basename $localfile)
sha1checksum=$(openssl sha1 $localfile | awk '{ print $2 }')
md5checksum=$(openssl md5 $localfile | awk '{ print $2 }')
sha256checksum=$(openssl sha256 $localfile | awk '{ print $2 }')
curl --header "X-JFrog-Art-Api:${apikey}" \
--header "X-Checksum-Sha1:${sha1checksum}" \
--header "X-Checksum-MD5:${md5checksum}" \
--header "X-Checksum-Sha256:${sha256checksum}" \
--upload-file $localfile \
-X PUT "$url/$file"