Created
September 9, 2015 19:59
-
-
Save techieBrandon/3c17748ec5bfb62658fc to your computer and use it in GitHub Desktop.
Publish archive to artifactory via shell
This file contains hidden or 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
Publish_Web_Archive() { | |
localFilePath="$1" | |
targetFolder="http://artifax:8081/artifactory/internal/$2" | |
artifactoryUser="arieso" | |
artifactoryPassword="Network123!" | |
if [ ! -f "$localFilePath" ]; then | |
echo "ERROR: local file $localFilePath does not exists!" | |
exit 1 | |
fi | |
which md5sum || exit $? | |
which sha1sum || exit $? | |
md5Value="`md5sum "$localFilePath"`" | |
md5Value="${md5Value:0:32}" | |
sha1Value="`sha1sum "$localFilePath"`" | |
sha1Value="${sha1Value:0:40}" | |
fileName="`basename "$localFilePath"`" | |
echo $md5Value $sha1Value $localFilePath | |
echo "INFO: Uploading $localFilePath to $targetFolder/$fileName" | |
curl -i -X PUT -u $artifactoryUser:$artifactoryPassword \ | |
-H "X-Checksum-Md5: $md5Value" \ | |
-H "X-Checksum-Sha1: $sha1Value" \ | |
-T "$localFilePath" \ | |
"$targetFolder/$fileName" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment