From 3903b622dd56abff0d45c2c616ee5cead93582ef Mon Sep 17 00:00:00 2001 From: Alex Soul Date: Mon, 25 Jan 2021 15:46:17 +0000 Subject: [PATCH] Initial Setup and deploy to Cloud Functions --- .gitignore | 1 + Part_3.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0866604 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +csr-demo/ \ No newline at end of file diff --git a/Part_3.md b/Part_3.md index d2648f5..0dacc3a 100644 --- a/Part_3.md +++ b/Part_3.md @@ -102,14 +102,100 @@ _"If you deploy into production one extra automated capability you should consid #### Bringing CI and CD (and CD) Together -### Continuous Integration on Google Cloud +|---- "CI" From "Codebase" to "Deployable Build" ----| +Codebase --{Integrate i.e. "Build" (v.)}--> Build (n.) / Artifacts, Containers, compiled code --{Deliver}--> Deployable Build --{Deploy}--> Running System + +|---- "CD" From "Build" to "Running System" ----| + + +- Continuation From "Running System": + +Running System --{Reflag}--> Released Feature --{Ask}--> Feedback --{Triage}--> Idea on Backlog --{Code (v.)}--> Code Change & Pull Request (PR) --{Approve}--> Return to "Codebase" + +Whole system has come full circle + +### Continuous Integration on Google Cloud #### GCP Continuous Integration Concepts -### Cloud Source Repositories +Challenges of Team-based Software Development +- Multiple Developers working on a single code base and/or related systems: + - Difficult to coordinate updates between multiple developers + - Incompatible updates from different developers = bugs and problems + - Large + infrequent updates = many bugs to fix + +Solution: Continuous Integration! + +- The 'CI' of CI/CD process +- DevOps culture of submitting smaller code changes, more often: + - Multiple submissions per day + - "Continuously" update code + +Benefits: +- Smaller changes = fewer bugs to troubleshoot +- Fast changes = rapid fedback loop +- Rapid feedback loops = quickly resolve issues +- Result: Improved productivity and Return On Investment(ROI)!! + +The CI Process - 5x Main components + +- Source +- Build +- Test +- Report +- Release + +CI Components - How to we make this work? + +- Single Shared code repository + - Single source of truth +- Automated Build and Test tool: + - Key word: **AUTOMATION** + - Feedback loop for bugs +- Artifact Repository + - Release destination for built and tested code for future development + +Continuous Integration Tools + +| | Source Control | Build & Test | Artifact Storage | +| --------- | ------------------------- | ----------------- | --------------------- | +| GCP | Cloud Source Repositories | Cloud Build | Container Registry | +| 3rd Party | Github, Bitbucket | CircleCI, Jenkins | docker hub, Maven etc | + + +Developer (Commits) > Source Control (Cloud Source Repositories) > {Trigger Build} > Build & Test (Cloud Build) > {Publish Build & Security Scan} > Artifact Management (Container Registry) > Release + +> Only manual step is the actual "Commit", everything else is automated through tooling + +### Cloud Source Repositories #### Cloud Source Repository Concepts +| Fully Managed Private Git Repository | Build, test, deploy and debug code right away | +| Native GCP Integration | Integrate with Cloud Build, Cloud Functions, Cloud Operations (formerly Stackdriver) and more | +| Sync/mirror third party repos | One-way mirror from GitHub/Bitbucket to CSR | +| Powerful code search | Google search for your code | + +Development Environments and Cross-project access + +- Google best practice = separate projects for each environment + - 'prod-project', 'dev-project', 'staging-project', etc +- CSR hosted in single project + - How to access single repo from multiple projects? + - Solution: grant IAM roles to members in other projects + +Example: CSR in 'prod-project', accessible by 'John' in 'dev-project' + +- Grant IAM access to John in either host project or host repo + - Project level = access to all repos in project + - Repo level = access to individual repo + +IAM Roles +- Source repository Admin/Writer/Reader + - Admin: Full access (add roles, create/delete repo) + - Writer: Edit and commit code + - Reader: View only + #### CSR Hands On - Initial Setup and Deploy to Cloud Functions #### CSR Hands On - Mirror Github and Cross-Project Access