Skip to content

Instantly share code, notes, and snippets.

@ngauthier
Created November 19, 2014 15:44
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngauthier/9325d3ccd8843e07771e to your computer and use it in GitHub Desktop.
Save ngauthier/9325d3ccd8843e07771e to your computer and use it in GitHub Desktop.
Restart last build
#!/usr/bin/env bash
# Usage: restart-last-build <project-id>
# You must set the environment variable API_KEY to your codeship API key, for example:
# $ CODESHIP_API_KEY=abc123 restart-last-build 1234
PROJECT_ID=$1
set -e
echo Restarting last build for project $PROJECT_ID
last_build_id=`curl "https://codeship.com/api/v1/projects/${PROJECT_ID}.json?api_key=${CODESHIP_API_KEY}" | jq '.builds[0].id'`
echo Restarting build $last_build_id
curl -X POST https://codeship.com/api/v1/builds/${last_build_id}/restart.json?api_key=${CODESHIP_API_KEY}
echo
echo "All done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment