The checksums in the Packages.bz2 file in jfrog's trusty repository for artifactory don't match the packages. This causes mirroring and installations to fail. Checked 19-Jul-2018 0606 UTC
$ curl -s https://jfrog.bintray.com/artifactory-
debs/dists/trusty/main/binary-amd64/Packages.bz2|bzcat|grep -A2 -F jfrog-artifactory-oss-6.1.0.deb
Filename: pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb
SHA1: dfe6d0cce9c3ca946d27b8dd1cf080e0ef6b9818
SHA256: c88e6f2f183426721ce3273642e0df00abce2150c7ca67afe1a69b175e9775f6
$ curl -s https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb | sha1sum
da39a3ee5e6b4b0d3255bfef95601890afd80709 -
$ curl -s https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb | sha256sum
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
Edit:
As has been kindly pointed out by Royg, I was missing the -L flag to curl in order to follow bintray's redirects. However, that then exposes an issue with the package for version 4.3.1:
$ curl -sL https://jfrog.bintray.com/artifactory-debs/dists/trusty/main/binary-amd64/Packages.bz2 | bzcat | grep -A2 -F jfrog-artifactory-oss-4.3.1.deb
Filename: pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-4.3.1.deb
SHA1: dc8b12436f309b538f6b80b4027b797e3cfce897
SHA256: 8cad6699ff17866b93a02124254ba3fb9a3ca2036048161b9bd3a49c8257831f
$ curl -sL https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-4.3.1.deb | sha1sum
575dc3debd016ff3a21e635625de266a6b0c2e48 -
You are missing the redirect option in your curl -L or --location.
If you try the curl command to the artifact with -v or --verbose you can seen that Bintray is redirecting you to the CDN nearest you. That means that you are sha1sum and sha256sum on empty artifact, that is why the checksum doesn't match.
$ curl https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb -vL | sha1sum
dfe6d0cce9c3ca946d27b8dd1cf080e0ef6b9818 -
$ curl https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb -vL | sha256sum
c88e6f2f183426721ce3273642e0df00abce2150c7ca67afe1a69b175e9775f6 -
Related
I have two servers, one with Nexus Repository and one with JFrog Artifactory OSS.
I would like to migrate to JFrog Artifactory but because it is open source there is no tool to migrate. If it were the pro version I could migrate easily.
I need some idea how to migrate from Nexus Repository to JFrog Artifactory OSS.
The way that I accomplished this task was to:
manually download the repos from Nexus. For nexus2 you can directly copy the repos from the filesystem. For nexus3 you will need to use the API. For nexus3 I used a script that I will put below.
Zip the repos into a folder
Upload the zipped file to artifactory with their import tool. Go to admin panel, artifactory, import, repositories.
You should be good to go from there more or less. I had to manually set some permissions and snapshot settings.
WARNING! This script doesn't work 100% you may/will have to modify it. WARNING!
sourceServer=
sourceRepo=
sourceUser=
sourcePassword=
logfile=$sourceRepo-backup.log
outputFile=$sourceRepo-artifacts.txt
# ======== GET DOWNLOAD URLs =========
url=$sourceServer"/service/rest/v1/assets?repository="$sourceRepo
contToken="initial"
while [ ! -z "$contToken" ]; do
if [ "$contToken" != "initial" ]; then
url=$sourceServer"/service/rest/v1/assets?continuationToken="$contToken"&repository="$sourceRepo
fi
echo Processing repository token: $contToken | tee -a $logfile
response=`curl -ksSL -u "$sourceUser:$sourcePassword" -X GET --header 'Accept: application/json' "$url"`
readarray -t artifacts < <( jq '[.items[].downloadUrl]' <<< "$response" )
printf "%s\n" "${artifacts[#]}" > artifacts.temp
sed 's/\"//g' artifacts.temp > artifacts1.temp
sed 's/,//g' artifacts1.temp > artifacts.temp
sed 's/[][]//g' artifacts.temp > artifacts1.temp
cat artifacts1.temp >> $outputFile
#for filter in "${filters[#]}"; do
# cat artifacts.temp | grep "$filter" >> $outputFile
#done
#cat maven-public-artifacts.txt
contToken=( $(echo $response | sed -n 's|.*"continuationToken" : "\([^"]*\)".*|\1|p') )
done
# ======== DOWNLOAD EVERYTHING =========
echo Downloading artifacts...
urls=($(cat $outputFile)) > /dev/null 2>&1
for url in "${urls[#]}"; do
path=${url#http://*:*/*/*/}
dir=$sourceRepo"/"${path%/*}
mkdir -p $dir
cd $dir
pwd
curl -vks -u "$sourceUser:$sourcePassword" -D response.header -X GET "$url" -O >> /dev/null 2>&1
responseCode=`cat response.header | sed -n '1p' | cut -d' ' -f2`
if [ "$responseCode" == "200" ]; then
echo Successfully downloaded artifact: $url
else
echo ERROR: Failed to download artifact: $url with error code: $responseCode
fi
rm response.header > /dev/null 2>&1
cd $curFolder
done
curl -v -u admin:admin123 --upload-file abclog.jar http://111.111.1.121:8081/nexus/content/repositories/releases/com/keshri/fileupload/
This works on nexus 3.12 (from windows, uploading a nuget package)
$curl.exe" -u ${NUGET_DEPLOYER_USER}:${NUGET_DEPLOYER_PASS} -F filename=the_artifact.nupkg
http://mynexus.example.org:9881/nexus/service/extdirect -F file=c:\\fakepath\\the_artifact.nupkg
-F repositoryName=nuget-hosted -F extTID=36 -F extAction=coreui_Upload
-F extMethod=doUpload -F extType=rpc -F extUpload=true
On 3.14 it fails with something about an csrf token being missing.
I have the problem, that curl doesn't upload all my data, when uploading with -d #-
The following command doesn't work:
tar -cz folder | curl -X PUT -d #- http://example.com/api/take/file
The following command works:
tar -cz folder | curl -X PUT -T - http://example.com/api/take/file
Does somebody know what is the reason for this behaviour.
Ok I found the root cause in the docs of curl:
--data-ascii <data>
(HTTP) This is just an alias for -d, --data.
So when you use just -d then the data will sent as ascii.
According to the docs binary data should be sent with --data-binary and indeed the following command works
tar -cz folder | curl -X PUT --data-binary #- http://example.com/api/take/file
How to perform an upload of a jar via curl the Nexus 3?
I tried using the link tips but without success.
Here are my attempts:
curl -v -F r = -F releases hasPom = true and = -F jar -F file = #. / v12.1.0.1 / pom.xml -F file = #. / v12.1.0.1 / ojdbc7.jar -u admin: admin123 http: // localhost: 8081 / repository / maven releases
curl -v -F r = -F releases hasPom = false -F and -F jar = g = com.oracle.jdbc -F = ojdbc7 -F v = 1.0 p = -F jar -F file = #. / v12 .1.0.1 / ojdbc7.jar -u admin: admin123 http: // localhost: 8081 / repository / maven releases
Both have 400 Bad Request.
Contents of directory
cert_for_nexus.pem
curl.exe
pom.xml
utils-1.0.jar
Nexus v3 is configured for http
curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.pom
curl -v -u admin:admin123 --upload-file utils-1.0.jar http://localhost:8081/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.jar
Nexus v3 is configured for https
prerequisite: must have curl with SSL enabled (link - left menu)
curl -v --cacert cert_for_nexus.pem -u admin:admin123 --upload-file pom.xml https://localhost:8443/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.pom
curl -v --cacert cert_for_nexus.pem -u admin:admin123 --upload-file utils-1.0.jar https://localhost:8443/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.jar
Contents of pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.foo</groupId>
<artifactId>utils</artifactId>
<version>1</version>
</project>
EDIT: fixed -u order for both https examples
You could use nexus-cli.
docker run -ti -v $(pwd):$(pwd):ro sjeandeaux/nexus-cli:0.2.0 \
-repo=http://nexus:8081/repository/maven-releases \
-user=admin \
-password=admin123 \
-file=$(pwd)/upload.jar \
-groupID=your.group \
-artifactID=yourArtifactID \
-version=0.1.0 \
-hash md5 \
-hash sha1
I've modified your code as below. Please try this.
curl -v -F r=releases -F hasPom=false -F e=jar -F g=com.oracle.jdbc -F a=ojdbc7 -F v=1.0 -F p=jar -F file=#"./v12.1.0.1/ojdbc7.jar" -u admin:admin123 http://localhost:8081/nexus/service/local/artifact/maven/content
Also I would suggest using the full path rather than relative path. Can you share where you are using this curl snippet? Any CI tool like Jenkins?
I need to send a fax where the source file is coming from an HTTP URL. I have configured hylaFax. When trying a local file, it works fine. But with a URL it gives an error.
The command I am using is something like this:
sendfax -v -h faxhost -f kaur#xyz.com -D -d 1234567890 \
'http://kaur.dev.xyz.com:7771/app-name/proxy?bName=Test&oName=1.txt'
The error:
Error : 'Can not open file'
The file is downloading when connecting through browser.
sendfax will process stdin so you can pipe documents in:
wget -O - 'http://kaur.dev.xyz.com:7771/app-name/proxy?bName=Test&oName=1.txt' | sendfax -v -h faxhost -f kaur#xyz.com -D -d 1234567890
or
curl 'http://kaur.dev.xyz.com:7771/app-name/proxy?bName=Test&oName=1.txt' | sendfax -v -h faxhost -f kaur#xyz.com -D -d 1234567890