Skip to content
Snippets Groups Projects
update-deployment 958 B
Newer Older
  • Learn to ignore specific revisions
  • GRIDNAME=$1
    shift
    
    
    case "${GRIDNAME}" in
        "local")
    	BRANCH="323.continuous-deployment"
    	;;
    
        "testing")
    	BRANCH="staging"
    	;;
    
        "production")
    	BRANCH="production"
    	;;
    
        *)
    	echo "Unknown grid: ${GRIDNAME}"
    	exit 1
    esac
    
    CHECKOUT="${HOME}/PrivateStorageio"
    
    REPO="https://whetstone.privatestorage.io/privatestorage/PrivateStorageio.git"
    
    if [ -e "${CHECKOUT}" ]; then
        git -C "${CHECKOUT}" pull
    else
        git clone "${REPO}" "${CHECKOUT}"
        # Check out the right branch ... which also happens to be named after this
        # grid (or maybe this grid is named after the branch).
    
        git -C "${CHECKOUT}" checkout "${BRANCH}"
    
    echo "$(date --iso-8601=seconds) $(git -C "${CHECKOUT}" rev-parse HEAD)" >> ${HOME}/updates.txt
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    
    
    nix-shell "${CHECKOUT}"/shell.nix --command "
      morph deploy \"${CHECKOUT}\"/morph/grid/\"${GRIDNAME}\"/grid.nix switch --on \"$(hostname)\"
    "