diff --git a/json_examples/create.sh b/json_examples/create.sh old mode 100644 new mode 100755 index 3bed897..c7e8745 --- a/json_examples/create.sh +++ b/json_examples/create.sh @@ -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" diff --git a/json_examples/releases.json b/json_examples/releases.json index 338c7ed..4c8097c 100644 --- a/json_examples/releases.json +++ b/json_examples/releases.json @@ -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" +}