diff --git a/Part_3.md b/Part_3.md index 0dacc3a..c83bf2f 100644 --- a/Part_3.md +++ b/Part_3.md @@ -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: