Skip to content

Commit

Permalink
Debugging manual_terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
ausbennett committed Nov 11, 2023
1 parent 31d5074 commit f646b3e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 49 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Manual K8s Deployment"

on:
workflow_dispatch: # This allows the workflow to be manually triggered

jobs:
kubernetes:
name: "Deploy K8s manifests"
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2 # Checks out your repository under $GITHUB_WORKSPACE, so your job can access it

- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.1
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.PROJECT_ID }}

- name: Get GKE credentials
run: |
gcloud container clusters get-credentials automl-cluster --region us-east1 --project automateml
- name: Deploy to GKE
run: |
kubectl apply -f cloud-infra/k8s/
26 changes: 0 additions & 26 deletions .github/workflows/main.yml

This file was deleted.

48 changes: 25 additions & 23 deletions .github/workflows/manual_terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,50 @@ on:

jobs:
terraform:
name: "Deploy to Environment"
name: "Provision Terraform"
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment }}

# environment:
# name: ${{ github.event.inputs.environment }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.1
- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.DEFAULT_SA_KEY2 }}
project_id: ${{ secrets.PROJECT_ID }}

- name: Install Terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1

- name: Decode GCP Credentials
run: |
echo '${{ secrets.GCP_SA_KEY_BASE64 }}' | base64 -d > ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json
cat ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json
echo '${{ secrets.GCP_SA_KEY_BASE64 }}'
# - name: Decode GCP Credentials
# run: |
# echo '${{ secrets.GCP_SA_KEY_BASE64 }}' | base64 -d > ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json
# cat ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json
# echo '${{ secrets.GCP_SA_KEY_BASE64 }}'

env:
GCP_SA_KEY_BASE64: ${{ secrets.GCP_SA_KEY_BASE64 }}
# env:
# GCP_SA_KEY_BASE64: ${{ secrets.GCP_SA_KEY_BASE64 }}

- name: Terraform Init and Plan
- name: Terraform Init
working-directory: ./cloud-infra
run: |
terraform init
terraform plan -out=tfplan
- name: Terraform Format
working-directory: ./cloud-infra
run: |
terraform fmt -check
- name: Terraform Plan
working-directory: ./cloud-infra
run: |
terraform plan -out=tfplan
- name: Hold for approval
if: github.event_name == 'workflow_dispatch'
uses: softprops/turnstyle@v1
Expand All @@ -57,12 +68,3 @@ jobs:
if: github.event_name == 'workflow_dispatch'
run: |
terraform apply tfplan
- name: Get GKE credentials
run: |
gcloud container clusters get-credentials automl-cluster --region us-east1 --project automateml
# use kubectl to interact with your GKE cluster and provision k8s manifest files
- name: Deploy to GKE
run: |
kubectl apply -f cloud-infra/k8s/

0 comments on commit f646b3e

Please sign in to comment.