Skip to content

Commit

Permalink
Add last minute changes to create script
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Forbes committed Feb 8, 2016
1 parent 6cbebe3 commit 1fb8024
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 33 deletions.
38 changes: 30 additions & 8 deletions json_examples/create.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
#!/bin/bash
PORT=5000
auth_token=$(curl -s -X GET http://localhost:${PORT}/token --user alforbes:moreblabla | json_pp | grep token | cut -d '"' -f 4)
echo auth_token
ril=$(curl -s -H "X-Auth-Token: $auth_token" -H "Content-Type: application/json" -X POST "http://127.0.0.1:${PORT}/releases" -d @./releases.json | grep 'id' | cut -d '"' -f 4)
echo $ril
curl -s -H "X-Auth-Token: $auth_token" -H "Content-Type: application/json" -X POST "http://127.0.0.1:${PORT}/releases/${ril}/packages" -d @./package.json

echo "Relase created: ${ril}"
PORT=8080

clear
echo -e "Get auth token"
auth_token=$(curl -s -X GET http://localhost:${PORT}/token --user alforbes:moreblabla | json_pp | grep token | cut -d '"' -f 4) &>/dev/null
curl -vs -X GET http://localhost:${PORT}/token --user alforbes:moreblabla
echo
read -n1 -p 'Press any key to continue'

curl -H "X-Auth-Token: $auth_token" -v -X POST "http://127.0.0.1:${PORT}/releases/${ril}/deploy"; echo
clear
echo "Create release"
ril=$(curl -sv -H "X-Auth-Token: $auth_token" -H "Content-Type: application/json" -X POST "http://127.0.0.1:${PORT}/releases" -d @./releases.json | grep 'id' | cut -d '"' -f 4)
echo -e "Created release ${ril}\n\n"
read -n1 -p 'Press any key to continue'


clear
echo "Create package"
curl -sv -H "X-Auth-Token: $auth_token" -H "Content-Type: application/json" -X POST "http://127.0.0.1:${PORT}/releases/${ril}/packages" -d @./package.json
echo -e "Created package\n\n"
read -n1 -p 'Press any key to continue'


clear
echo "Start deploy"
curl -svH "X-Auth-Token: $auth_token" -v -X POST "http://127.0.0.1:${PORT}/releases/${ril}/deploy"; echo -e


read -n1 -p 'Press any key to continue'
clear
curl -svH "X-Auth-Token: $auth_token" -v -X GET "http://127.0.0.1:${PORT}/releases/${ril}" | jq .; echo -e
echo -e "Done"
50 changes: 25 additions & 25 deletions json_examples/releases.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"platforms": [ "GumtreeUK" ],
"stime": "2015-12-17T17:02:04Z",
"ftime": "2015-12-17T17:02:24Z",
"team": "Gumtree UK Site Operations",
"metadata" : {"env" : "test", "pool" : "web"},
"references": [
"TICKET-1"
],
"notes": [
"Imported from other_system"
],
"packages": [
{
"name": "",
"diff_url": null,
"stime": "2015-12-17T17:02:22Z",
"ftime": 1450371742,
"rollback": false,
"status": "SUCCESSFUL",
"version": "1.0.1"
}
],
"user": "user_one"
}
{
"platforms": ["GumtreeUK"],
"stime": "2015-12-17T17:02:04Z",
"ftime": "2015-12-17T17:02:24Z",
"team": "Gumtree UK Site Operations",
"metadata" : {"env" : "test", "pool" : "web"},
"references": [
"TICKET-1"
],
"notes": [
"Imported from other_system"
],
"packages": [
{
"name": "",
"diff_url": null,
"stime": "2015-12-17T17:02:22Z",
"ftime": 1450371742,
"rollback": false,
"status": "SUCCESSFUL",
"version": "1.0.1"
}
],
"user": "user_one"
}

0 comments on commit 1fb8024

Please sign in to comment.