Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace wisp-prod with secrets.GKE_CLUSTER #7

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 45 additions & 44 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,62 @@ on:
env:
GITHUB_SHA: ${{ github.sha }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }}
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: wisp-prod
GKE_ZONE: northamerica-northeast1-c
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }}
LOAD_BALANCER_IP: ${{ secrets.DEV_LOAD_BALANCER_IP }}
GKE_ZONE: ${{ secrets.GKE_ZONE }}
IMAGE: wisp-gateway

jobs:
setup-build-tag-publish-deploy:
name: Setup, Build, Tag, Publish, and Deploy
runs-on: ubuntu-latest
steps:

# Checkout Commit
- name: Checkout
uses: actions/checkout@v2
# Checkout Commit
ValerianClerc marked this conversation as resolved.
Show resolved Hide resolved
- name: Checkout
uses: actions/checkout@v2

# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
- run: |-
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE"

# Build the Docker image
- name: Build
run: |
docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) .

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
- run: |-
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE"
# Tag the Docker image
- name: Tag
run: |
docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":dev-latest

# Build the Docker image
- name: Build
run: |
docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) .

# Tag the Docker image
- name: Tag
run: |
docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":dev-latest
# Push the Docker image to Dockerhub
- name: Publish
run: |
docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
docker push $DOCKER_ORGANIZATION/$IMAGE
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

# Push the Docker image to Dockerhub
- name: Publish
run: |
docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
docker push $DOCKER_ORGANIZATION/$IMAGE
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

# Install helm for use in pipeline
- name: Install helm
run: |
wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
# Install helm for use in pipeline
- name: Install helm
run: |
wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
helm upgrade --atomic --install dev-gateway ./chart/wisp-gateway/ --namespace dev --set image.tag=dev-$(echo ${GITHUB_SHA} | cut -c1-8) --set service.loadBalancerIP=34.95.10.234
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
helm upgrade --atomic --install dev-gateway ./chart/wisp-gateway/ --namespace dev --set image.tag=dev-$(echo ${GITHUB_SHA} | cut -c1-8) --set service.loadBalancerIP=${LOAD_BALANCER_IP}
88 changes: 44 additions & 44 deletions .github/workflows/prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,61 @@ env:
GITHUB_SHA: ${{ github.sha }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }}
DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }}
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: wisp-prod
GKE_ZONE: northamerica-northeast1-c
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }}
LOAD_BALANCER_IP: ${{ secrets.PROD_LOAD_BALANCER_IP }}
GKE_ZONE: ${{ secrets.GKE_ZONE }}
IMAGE: wisp-gateway

jobs:
setup-build-tag-publish:
name: Setup, Build, Tag, and Publish
runs-on: ubuntu-latest
steps:
# Checkout Commit
- name: Checkout
uses: actions/checkout@v2

# Checkout Commit
- name: Checkout
uses: actions/checkout@v2

# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
- run: |-
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE"
# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
- run: |-
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE"

# Build the Docker image
- name: Build
run: |
docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) .

# Tag the Docker image
- name: Tag
run: |
docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":latest
# Build the Docker image
- name: Build
run: |
docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) .

# Push the Docker image to Dockerhub
- name: Publish
run: |
docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
docker push $DOCKER_ORGANIZATION/$IMAGE
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# Tag the Docker image
- name: Tag
run: |
docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":latest

# Install helm for use in pipeline
- name: Install helm
run: |
wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
# Push the Docker image to Dockerhub
- name: Publish
run: |
docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
docker push $DOCKER_ORGANIZATION/$IMAGE
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

# Deploy to GKE cluster using helm
- name: Deploy
run: |-
helm upgrade --atomic --install prod-gateway ./chart/wisp-gateway/ --namespace prod --set image.tag=$(echo ${GITHUB_SHA} | cut -c1-8) --set replicaCount=2 --set service.loadBalancerIP=35.203.108.72
# Install helm for use in pipeline
- name: Install helm
run: |
wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

# Deploy to GKE cluster using helm
- name: Deploy
run: |-
helm upgrade --atomic --install prod-gateway ./chart/wisp-gateway/ --namespace prod --set image.tag=$(echo ${GITHUB_SHA} | cut -c1-8) --set replicaCount=2 --set service.loadBalancerIP=${LOAD_BALANCER_IP}