HackTheRoofCICDDemo
Fork this repository
- Navigate to https://github.com/dslovin/HackTheRoofCICDDemo
- Click the "Fork" button on the top right
- Confirm you now have a repository in the format of
https://github.com/[YOUR GITHUB USERNAME]/HackTheRoofCICDDemo
Login to GCP
- Login to http://console.google.com
- Switch to correct project
Setup Build Triggers
- Navigate to
Cloud Build
in the GCP Console - Within
Cloud Build
, navigate toTriggers
- Click on
Connect Repository
Show More Options
and ensureGitHub (mirrored)
is selected and clickContinue
- Authorize
Cloud Build
to access projects in your account - Select your
HackTheRoofCICDDemo
repository and clickConnect repository
- Select
Done
- Click on
+ Create Trigger
on the top of the page - Use the following values:
Variable | Value |
---|---|
Repository | **[YOUR GITHUB USERNAME]**/HackTheRoofCICDDemo |
Name | HTR Trigger |
Description | input any description |
Trigger type | Branch |
Branch (regex) | .* |
Included files filter (glob) | leave empty |
Ignored files filter (glob) | leave empty |
Build Configuration | Cloud Build configuration file (yaml or json) |
Cloud Build configuration file location | / cloudbuild.yaml |
Dockerfile name | Dockerfile |
- Click
Create trigger
- Click
Run trigger
and ensure that Cloud Build is building the container without errors - Navigate to
History
to check the build history for this to ensure no errors
At this point, Google Cloud Build should be building the container and storing it in Google Container Registry and deploying to cloud run!
Edit Container to Confirm
Now edit the container, follow the history and see if it works! Try putting an error in the Dockerfile and see what happens.
TODO
- Create 4 Projects
- Cloud Build API
- Cloud Build Service Account to Service Account User
- Cloud Build Service Account to Cloud Run Admin
- GKE API
- Cloud Build Service Account to Kubernetes Engine Developer
- Cloud Vision API
GKE Continuous Delivery (WIP - but works)
gcloud container clusters create htr-gke --zone us-east1-b --machine-type "n1-standard-1" --image-type "COS" --num-nodes "3"
Switch Build Trigger to cloudbuild_gke.yaml
GCE Continous Delivery (broken)
gcloud compute instances create-with-container htr-site --container-image gcr.io/$PROJECT_ID/hacktheroofcicddemo
Add ACLs to Cloud Storage
gsutil acl ch -u derek@dslovin.com:R gs://chalupa-images/1.jpg (for 1) gsutil acl ch -u 990943260827-compute@developer.gserviceaccount.com:R gs://chalupa-images/1.jpg