-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clone repo to find if the tag was created on master
WIP
- Loading branch information
Showing
4 changed files
with
98 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM ubuntu | ||
RUN apt-get -q update && apt-get install -qqy git |
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,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -z "$1" ] || [ -z "$2" ]; then | ||
(>&2 echo "Usage: check_repo.sh <module name> <git tag>") | ||
exit 1 | ||
fi | ||
|
||
module=$1 | ||
tag=$2 | ||
|
||
echo "Checking if '$tag' exists in master branch" | ||
|
||
if [ ! -f "$module/script/deploy.sh" ]; then | ||
(>&2 echo "Run this script from project root dir (ostelco-core)") | ||
exit 1 | ||
fi | ||
|
||
CHECK_REPO="$module/script/check_repo.sh" | ||
|
||
if [ ! -f ${CHECK_REPO} ]; then | ||
(>&2 echo "Missing file - $CHECK_REPO") | ||
exit 1 | ||
fi | ||
|
||
command -v git >/dev/null 2>&1 || { echo >&2 "Git not available, Aborting."; exit 1; } | ||
|
||
git clone https://github.com/ostelco/ostelco-core.git | ||
cd ostelco-core | ||
git checkout master | ||
|
||
tag_commit=$(git rev-list -n 1 $tag) | ||
echo $tag_commit | ||
|
||
if git rev-list --first-parent master | grep $tag_commit >/dev/null; then | ||
(>&2 echo "$tag points to a commit reachable via first-parent from master") | ||
else | ||
(>&2 echo "$tag does not point to a commit reachable via first-parent from master") | ||
fi | ||
|
||
cd .. | ||
rm -rf ostelco-core | ||
|
||
exit 1 |
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,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
module="" | ||
if [ -z "$1" ]; then | ||
echo "module is blank" | ||
exit 1 | ||
else | ||
module=$1 | ||
fi | ||
tag="" | ||
if [ -z "$2" ]; then | ||
echo "tag is blank" | ||
exit 1 | ||
else | ||
tag=$2 | ||
fi | ||
|
||
if [ ! -f pseudonym-server/script/deploy.sh ]; then | ||
(>&2 echo "Run this script from project root dir (ostelco-core)") | ||
exit 1 | ||
fi | ||
|
||
CHECK_REPO="pseudonym-server/script/check_repo.sh" | ||
|
||
if [ ! -f ${CHECK_REPO} ]; then | ||
(>&2 echo "Missing file - $CHECK_REPO") | ||
exit 1 | ||
fi | ||
|
||
PROJECT_ID="$(gcloud config get-value project -q)" | ||
BRANCH_NAME=$(git branch | grep \* | cut -d ' ' -f2) | ||
|
||
echo PROJECT_ID=${PROJECT_ID} | ||
echo BRANCH_NAME=${BRANCH_NAME} | ||
|
||
echo "Deploying pseudonym-server to GKE" | ||
|
||
gcloud container builds submit \ | ||
--config pseudonym-server/cloudbuild.yaml \ | ||
--substitutions TAG_NAME=${tag},BRANCH_NAME=${BRANCH_NAME} . |