Created
November 19, 2014 15:44
-
-
Save ngauthier/9325d3ccd8843e07771e to your computer and use it in GitHub Desktop.
Restart last build
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
#!/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