Completed Initial Setup and Deploy to Cloud functions

This commit is contained in:
Alex Soul 2021-01-25 17:09:42 +00:00
parent 3903b622dd
commit 92d4c49164

View File

@ -198,6 +198,39 @@ IAM Roles
#### CSR Hands On - Initial Setup and Deploy to Cloud Functions
- Create a repository in a project
- Web console and command line
- Clone Cloud Functions example into repo from GitHub
- Deploy Cloud Function directly from CSR
- Note: Familiarity with Git commands is assumed
```
gcloud services enable sourcerepo.googleapis.com
gcloud services enable cloudfunctions.googleapis.com
gcloud source repos create csr-demo
touch .gitignore && echo 'csr-demo/' > .gitignore
git add -A
git commit -m "Initial Setup and deploy to Cloud Functions"
gcloud source repos clone csr-demo
cd csr-demo/
git clone https://github.com/linuxacademy/content-gcpro-devops-engineer
cd content-gcpro-devops-engineer/
rm -rf .DS_Store .git/
git add -A
git commit -m "Initial Commit to CSR"
git remote -v
git branch -m main
git push origin main
```
- Setup Cloud function, pointing to repository that we cloned making sure to specify the sub-directory where the python code is located, create the function and then call it from the cli
```
➭ gcloud functions call function-1 --region="europe-west2" --data='{"name":"Alex"}'
executionId: 68kl6ybsinvx
result: <h1 style="margin:20px auto;width:800px;">Welcome to the GCP DevOps course,
Alex!</h1><h2>Via Source Control Repo</h2>
```
#### CSR Hands On - Mirror Github and Cross-Project Access
#### Hands On Lab - Migration Source Code to a Google Cloud Source Repository