-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
c087d73
commit a2aca2b
Showing
3 changed files
with
40 additions
and
30 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
types: published | ||
|
||
env: | ||
DOCKER_IMAGE: lukaswire/polls | ||
DOCKER_IMAGE: wire-bot/poll | ||
SERVICE_NAME: poll | ||
|
||
jobs: | ||
|
@@ -22,10 +22,13 @@ jobs: | |
- name: Build and publish docker image | ||
uses: docker/build-push-action@v1 | ||
with: | ||
# login to repo | ||
# set docker image | ||
repository: ${{ env.DOCKER_IMAGE }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
# use GCR repository | ||
registry: eu.gcr.io | ||
# see https://github.com/marketplace/actions/docker-build-push#google-container-registry-gcr | ||
username: _json_key | ||
password: ${{ secrets.GCR_ACCESS_JSON }} | ||
# pass release_version | ||
build_args: release_version=${{ env.RELEASE_VERSION }} | ||
# tag the image with latest git tag | ||
|
@@ -52,11 +55,11 @@ jobs: | |
IMAGE: ${{ env.DOCKER_IMAGE }} | ||
SERVICE: ${{ env.SERVICE_NAME }} | ||
VERSION: ${{ env.RELEASE_VERSION }} | ||
run: |- | ||
run: | | ||
# go to directory with configuration | ||
cd "rubicon/prod/services/$SERVICE" | ||
# escape literals for the sed | ||
export SED_PREPARED=$(echo $IMAGE | awk '{ gsub("/", "\\/", $1); print $1 }') | ||
# escape literals for the sed and set output with GCR | ||
export SED_PREPARED=$(echo $IMAGE | awk '{ gsub("/", "\\/", $1); print "eu.gcr.io\\/"$1 }') | ||
# update final yaml | ||
sed -i".bak" "s/image: $SED_PREPARED.*/image: $SED_PREPARED:$VERSION/g" "$SERVICE.yaml" | ||
# delete bakup file | ||
|
@@ -67,26 +70,28 @@ jobs: | |
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | ||
with: | ||
version: '286.0.0' | ||
service_account_email: ${{ secrets.GKE_SA_EMAIL }} | ||
service_account_email: [email protected] | ||
service_account_key: ${{ secrets.GKE_SA_KEY }} | ||
project_id: ${{ secrets.GKE_PROJECT }} | ||
project_id: wire-bot | ||
|
||
# Configure Docker to use the gcloud command-line tool | ||
- name: Configure Docker Google cloud | ||
run: |- | ||
run: | | ||
gcloud --quiet auth configure-docker | ||
# Get the GKE credentials so we can deploy to the cluster | ||
- name: Obtain k8s credentials | ||
env: | ||
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }} | ||
GKE_ZONE: ${{ secrets.GKE_ZONE }} | ||
run: |- | ||
GKE_CLUSTER: anayotto | ||
GKE_ZONE: europe-west1-c | ||
run: | | ||
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" | ||
# K8s is set up, deploy the app | ||
- name: Deploy the Service | ||
run: |- | ||
env: | ||
SERVICE: ${{ env.SERVICE_NAME }} | ||
run: | | ||
kubectl apply -f "rubicon/prod/services/$SERVICE/$SERVICE.yaml" | ||
# Commit all data to Rubicon and open PR | ||
|
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
- staging | ||
|
||
env: | ||
DOCKER_IMAGE: lukaswire/polls | ||
DOCKER_IMAGE: wire-bot/poll | ||
SERVICE_NAME: poll | ||
|
||
jobs: | ||
|
@@ -23,10 +23,13 @@ jobs: | |
- name: Build docker image, push | ||
uses: docker/build-push-action@v1 | ||
with: | ||
# login to repo | ||
# set docker image | ||
repository: ${{ env.DOCKER_IMAGE }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
# use GCR repository | ||
registry: eu.gcr.io | ||
# see https://github.com/marketplace/actions/docker-build-push#google-container-registry-gcr | ||
username: _json_key | ||
password: ${{ secrets.GCR_ACCESS_JSON }} | ||
# pass release_version | ||
build_args: release_version=${{ env.RELEASE_VERSION }} | ||
# tag the image with name of the branch - staging | ||
|
@@ -41,28 +44,28 @@ jobs: | |
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | ||
with: | ||
version: '286.0.0' | ||
service_account_email: ${{ secrets.GKE_SA_EMAIL }} | ||
service_account_email: [email protected] | ||
service_account_key: ${{ secrets.GKE_SA_KEY }} | ||
project_id: ${{ secrets.GKE_PROJECT }} | ||
project_id: wire-bot | ||
|
||
# Configure Docker to use the gcloud command-line tool | ||
- name: Configure Docker Google cloud | ||
run: |- | ||
run: | | ||
gcloud --quiet auth configure-docker | ||
# Get the GKE credentials so we can deploy to the cluster | ||
- name: Obtain k8s credentials | ||
env: | ||
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }} | ||
GKE_ZONE: ${{ secrets.GKE_ZONE }} | ||
run: |- | ||
GKE_CLUSTER: anayotto | ||
GKE_ZONE: europe-west1-c | ||
run: | | ||
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" | ||
# K8s is set up, deploy the app | ||
- name: Deploy the Service | ||
env: | ||
SERVICE: ${{ env.SERVICE_NAME }} | ||
run: |- | ||
run: | | ||
kubectl delete pod -l name=$SERVICE -n staging | ||
kubectl describe pod -l name=$SERVICE -n staging | ||
|