-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# There are 4 arguments passed in. | ||
# $1 is the name of the micro service | ||
# $2 is the image id | ||
# $3 is the GITHUB OAUTH Key | ||
# This script will first get the latest raw of the docker-compose file for impulse and copy it into a local file | ||
# It will then replace the entire name of the image for the passed in ($1) micro service with the image name that is built | ||
# Finally it will commit the new docker-compose file to impulse with a message | ||
|
||
set -x | ||
# echo running script | ||
# | ||
# echo getting file from GITHUB | ||
# curl --user $3:$4 "https://api.bitbucket.org/2.0/repositories/motivlabs/impulse/src/master/docker-tools/docker-compose.yml" > docker-compose.yml | ||
curl -H 'Authorization: token '"$3"'' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/docker-compose.yml | ||
|
||
# echo search and replace | ||
sed -i "s+motivlabs/$1:.*+$2+g" docker-compose.yml | ||
# echo pushing file to GITHUB | ||
|
||
# curl --user $3:$4 "https://api.bitbucket.org/2.0/repositories/motivlabs/impulse/src" -F /docker-tools/docker-compose.yml=@docker-compose.yml -F message="updated $1 image" | ||
curl -X PUT -H 'Authorization: token '"$3"'' -d '{"message":"updated janus image","content":"'"$(base64 -w0 docker-compose.yml)"'","sha":'"$(curl -s -X GET -H 'Authorization: token '"$3"'' https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/docker-compose.yml | jq .sha)"'}' -L https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/docker-compose.yml | ||
|
||
# update googlecloud image | ||
curl -H 'Authorization: token '"$3"'' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/motiv-labs/impulse-googlecloud/contents/impulse/janus-deployment.yaml | ||
sed -i "s+motivlabs/$1:.*+$2+g" janus-deployment.yaml | ||
curl -X PUT -H 'Authorization: token '"$3"'' -d '{"message":"updated janus image","content":"'"$(base64 -w0 janus-deployment.yaml)"'","sha":'"$(curl -s -X GET -H 'Authorization: token '"$3"'' https://api.github.com/repos/motiv-labs/impulse-googlecloud/contents/impulse/janus-deployment.yaml | jq .sha)"'}' -L https://api.github.com/repos/motiv-labs/impulse-googlecloud/contents/impulse/janus-deployment.yaml | ||
|
||
# echo finished script |