Skip to content

add deployment details #33

add deployment details

add deployment details #33

Workflow file for this run

name: churn-prediction-service
on:
push:
branches:
- main
apiVersion: apps/v1

Check failure on line 8 in .github/workflows/deploy.yaml

View workflow run for this annotation

GitHub Actions / churn-prediction-service

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yaml (Line: 8, Col: 1): Unexpected value 'apiVersion' .github/workflows/deploy.yaml (Line: 9, Col: 1): Unexpected value 'kind'
kind: Deployment
metadata:
name: churn-prediction-service
spec:
replicas: 2
selector:
matchLabels:
app: churn-prediction-service
template:
metadata:
labels:
app: churn-prediction-service
spec:
containers:
- name: churn-prediction-service-container
image: asia-south1-docker.pkg.dev/data-science-project-418009/dockerregistry/churn-prediction-service:${{ github.sha }}
ports:
- containerPort: 8080
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Google Cloud SDK
run: |
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud --version
- name: Authenticate with Google Cloud
run: |
echo "${{ secrets.GKE_SECRET_CPS }}" | base64 --decode > gcp-sa-key.json
gcloud auth activate-service-account --key-file=gcp-sa-key.json
# gcloud projects add-iam-policy-binding data-science-project --member=serviceAccount:sample-service-account@data-science-project-418009.iam.gserviceaccount.com --role=roles/storage.objectViewer
env:
GOOGLE_APPLICATION_CREDENTIALS: gcp-sa-key.json
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@main
with:
project_id: neemar
# service_account_key: ${{ secrets.GKE_SECRET_CPS }}
# export_default_credentials: true
- name: Let's copy gcp credentials
run: echo "${{secrets.GKE_SECRET_CPS}}" | base64 --decode > gcp_credentials.json
- name: Configure Docker to use GCR
run: |
gcloud auth configure-docker asia-south1-docker.pkg.dev
- name: Build and Push Docker image
run: |
docker build -t asia-south1-docker.pkg.dev/data-science-project-418009/dockerregistry/churn-prediction-service:${{ github.sha }} .
docker push asia-south1-docker.pkg.dev/data-science-project-418009/dockerregistry/churn-prediction-service:${{ github.sha }}
- name: Configure kubectl
run: |
gcloud container clusters get-credentials autopilot-cluster-1 --zone asia-south1 --project data-science-project-418009
- name: Deploy to GKE
run: |
kubectl apply -f ./.github/workflows/deploy.yaml