Created
July 9, 2018 16:17
-
-
Save jt-nti/206a1fcb40e0f96c17e856ee4a076723 to your computer and use it in GitHub Desktop.
Experimental function to get a deploy name that's unlikely to collide on IBM Cloud
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
#!/bin/bash | |
function get_deploy_name { | |
uuid="$1" | |
shift | |
old_ifs="$IFS" | |
IFS='_' | |
name="$*" | |
IFS=$old_ifs | |
unique_name="${name}_${uuid}" | |
short_hash=$(echo ${unique_name} | git hash-object --stdin | head -c 7) | |
deploy_name="$(echo ${name} | head -c 43)${short_hash}" | |
echo $deploy_name | |
} | |
echo $(get_deploy_name $(uuidgen) blockchain-20180709151348280 some-deployable-thing) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment