Created
July 10, 2014 20:50
-
-
Save rtluckie/6aa49c53e8faaf430b3d to your computer and use it in GitHub Desktop.
deploy artifact to artifactory
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
art_url="https://artifactory.company.com/artifactory" | |
user="user" | |
pass="password" | |
function upload { | |
local_file_path=$1 | |
target_folder=$2 | |
if [ ! -f "$local_file_path" ]; then | |
echo "ERROR: local file $local_file_path does not exists!" | |
exit 1 | |
fi | |
which md5sum || exit $? | |
which sha1sum || exit $? | |
md5Value="`md5sum "$local_file_path"`" | |
md5Value="${md5Value:0:32}" | |
sha1Value="`sha1sum "$local_file_path"`" | |
sha1Value="${sha1Value:0:40}" | |
fileName="`basename "$local_file_path"`" | |
echo $md5Value $sha1Value $local_file_path | |
echo "INFO: Uploading $local_file_path to $target_folder/$fileName" | |
curl -i -k -X PUT -u $user:$pass \ | |
-H "X-Checksum-Md5: $md5Value" \ | |
-H "X-Checksum-Sha1: $sha1Value" \ | |
-T "$local_file_path" \ | |
${art_url}/"$target_folder/$fileName" | |
} | |
upload "/projects/app.war" "libs-release-local/com/company/app/app-comp/1.0.0/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment