Initial Setup and deploy to Cloud Functions

This commit is contained in:
Alex Soul 2021-01-25 15:46:17 +00:00
parent eb281a9226
commit 3903b622dd
2 changed files with 89 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
csr-demo/

View File

@ -102,14 +102,100 @@ _"If you deploy into production one extra automated capability you should consid
#### Bringing CI and CD (and CD) Together #### 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 #### 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 #### 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 <u>members</u> 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 - Initial Setup and Deploy to Cloud Functions
#### CSR Hands On - Mirror Github and Cross-Project Access #### CSR Hands On - Mirror Github and Cross-Project Access