Skip to content

Instantly share code, notes, and snippets.

@mathcass
Created January 19, 2018 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathcass/cc9fdd666c2631f10ca63aab0f3bd200 to your computer and use it in GitHub Desktop.
Save mathcass/cc9fdd666c2631f10ca63aab0f3bd200 to your computer and use it in GitHub Desktop.
A generic AppEngine deploy script
#!/bin/bash
# Deploys application to default service setting version to current time, thus
# mimicking how `gcloud app deploy` works
APP="$PROJECT_NAME" # Or, just replace with your project
VERSION=$(date +%Y%m%dt%H%M%S) # ${year}${month}${day}t${24hour}${minute}${second}
gcloud config set project "$APP"
echo "Deploying $APP to version $VERSION..."
goapp deploy -application "$APP" -version "$VERSION"
if [ $? -eq 0 ]; then
echo "Setting traffic for $APP running $VERSION to 100%"
gcloud app services set-traffic default --splits "$VERSION=1"
else
echo "Encountered an error deploying the application, aborting..."
fi
gcloud config unset project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment