SlideShare a Scribd company logo
Stop wasting time
Automate your deployments
Jerry Jalava
Cloud GDE Helsinki
@W_I
“Companies waste $300 Billion of
developer productivity every year”
“Developers spend 42% of their time on
code maintenance”
- Stripe (The Developer Coefficient study)
Using CI/CD
Saves you time and money, brings reliability and trust
Essentially it means this
Picture from "Setting up GitLab CI/CD for Android projects"
Multiple options
Landscape of CI/CD tools
The number of different CI/CD tools and solutions have grown rapidly in
the past years
CNCF Product listing today
● Source code location(s)
Github, Gitlab, Cloud Source
● Target systems
Kubernetes, Cloud Run, VMs
● Target Environments
Development, Testing,
Staging, QA, Production
Your solution needs may vary
Not all projects are created equal
● Code structure
Multiple repos, Monorepo
● Deployment tooling
Helm charts, Chef, etc.
● And so on...
● Keep your Pipelines fast
● Run the Fastest Tests Early
● Run tests locally before committing
● Think about your branches
● Secure and Isolate your CI/CD environment
● Allow Production deployments only through CI/CD
● If the process is painful, you are doing it wrong!
Some key things to consider
Your solution needs may vary
Demo time
Let’s start with Cloud Build
Tools we will be using
Google Cloud Build
Cloud Build lets you build software quickly across all languages. Get
complete control over defining custom workflows for building, testing,
and deploying across multiple environments such as VMs, serverless,
Kubernetes, or Firebase.
Pricing: 120 min/day free (10 concurrent builds), $0.003 per minute
https://cloud.google.com/cloud-build
https://github.com/GoogleCloudPlatform/cloud-builders-community
Performance tweaks
Best practices for speeding up builds
Build leaner containers
https://cloud.google.com/cloud-build/docs/building-leaner-containers
Use Kaniko cache (in demo)
Use a cached Docker image (in demo)
Use custom virtual machine sizes (Defaults to 2 high-CPU VMs)
Avoid uploading of unnecessary files (.gcloudignore)
Architecture
# Create Build project and Enable Billing
$ gcloud projects create $BUILD_PROJECT_ID
$ gcloud --quiet beta billing projects link $BUILD_PROJECT_ID --billing-account $BILLING_ID
# Enable APIs in the build project
$ ENABLE_APIS=(
"cloudresourcemanager.googleapis.com" 
"servicemanagement.googleapis.com" 
"sourcerepo.googleapis.com" 
"cloudbuild.googleapis.com" 
"run.googleapis.com" 
"containerregistry.googleapis.com"
)
$ gcloud services enable --project=$BUILD_PROJECT_ID ${ENABLE_APIS[@]}
Preparations
DEMO
https://github.com/jerryjj/gdg-cicd-presentation
demos/cloudbuild-std/README.md & demos/cb-trigger-demo/README.md
Deploy to environment
Google Cloud Repository, Google Cloud Run
- Prepare projects
- Setup repository
- Setup Cloud Trigger
- Check the Magic
Architecture
# Create Deploy project and Enable Billing
$ gcloud projects create $DEPLOY_PROJECT_ID
$ gcloud --quiet beta billing projects link $DEPLOY_PROJECT_ID --billing-account $BILLING_ID
# Enable APIs in the build project
$ ENABLE_APIS=(
"cloudresourcemanager.googleapis.com" 
"compute.googleapis.com" 
"container.googleapis.com" 
"run.googleapis.com" 
"storage-api.googleapis.com" 
"servicenetworking.googleapis.com"
)
$ gcloud services enable --project=$DEPLOY_PROJECT_ID ${ENABLE_APIS[@]}
Preparations
# Create Cloud Repository
$ gcloud source repos create cb-deploy-run 
--project $BUILD_PROJECT_ID
# Allow Cloud Run to fetch containers from Build Project
$ DEPLOY_PROJECT_NUMBER=$(gcloud projects describe $DEPLOY_PROJECT_ID --format='value(projectNumber)')
$ RUN_SA_EMAIL="service-$DEPLOY_PROJECT_NUMBER@serverless-robot-prod.iam.gserviceaccount.com"
$ BUCKET_PATH="gs://eu.artifacts.$BUILD_PROJECT_ID.appspot.com"
$ gsutil iam ch serviceAccount:$RUN_SA_EMAIL:objectViewer $BUCKET_PATH
# Allow Cloud Build to deploy to Cloud Run on Deploy Project
$ BUILD_PROJECT_NUMBER=$(gcloud projects describe $BUILD_PROJECT_ID --format='value(projectNumber)')
$ CB_SA_EMAIL="$BUILD_PROJECT_NUMBER@cloudbuild.gserviceaccount.com"
$ COMPUTE_SA_EMAIL="$DEPLOY_PROJECT_NUMBER-compute@developer.gserviceaccount.com"
$ gcloud projects add-iam-policy-binding $DEPLOY_PROJECT_ID 
--member=serviceAccount:$CB_SA_EMAIL 
--role roles/run.admin
$ gcloud iam service-accounts add-iam-policy-binding 
$COMPUTE_SA_EMAIL 
--project $DEPLOY_PROJECT_ID 
--member="serviceAccount:$CB_SA_EMAIL" --role=roles/iam.serviceAccountUser
Preparations
DEMO
https://github.com/jerryjj/gdg-cicd-presentation
demos/cb-deploy-run/README.md
Deploy to environment
Google Cloud Repository, Google Kubernetes Engine
- Prepare projects
- Setup repository
- Setup Cloud Trigger
- Check the Magic
Architecture
# Create GKE Cluster
$ gcloud beta container clusters create "demo-cluster" 
--project $DEPLOY_PROJECT_ID 
--zone $COMPUTE_ZONE...
# Set yourself as the cluster admin
$ export CONTEXT=`kubectl config view | awk '{print $2}' | grep "demo-cluster" | tail -n 1`
$ ACCOUNT=$(gcloud info --format='value(config.account)')
$ NAME=$(echo "${ACCOUNT%@*}")
$ kubectl --context $CONTEXT create clusterrolebinding $NAME-cluster-admin-binding 
--clusterrole=cluster-admin --user=$ACCOUNT
Preparations
# Create Cloud Repository
$ gcloud source repos create cb-deploy-k8s 
--project $BUILD_PROJECT_ID
# Allow GKE to fetch containers from Build Project
$ DEPLOY_PROJECT_NUMBER=$(gcloud projects describe $DEPLOY_PROJECT_ID --format='value(projectNumber)')
$ GKE_SA_EMAIL="$DEPLOY_PROJECT_NUMBER-compute@developer.gserviceaccount.com"
$ BUCKET_PATH="gs://eu.artifacts.$BUILD_PROJECT_ID.appspot.com"
$ gsutil iam ch serviceAccount:$GKE_SA_EMAIL:objectViewer $BUCKET_PATH
# Allow Cloud Build to deploy to GKE on Deploy Project
$ BUILD_PROJECT_NUMBER=$(gcloud projects describe $BUILD_PROJECT_ID --format='value(projectNumber)')
$ CB_SA_EMAIL="$BUILD_PROJECT_NUMBER@cloudbuild.gserviceaccount.com"
$ gcloud projects add-iam-policy-binding $DEPLOY_PROJECT_ID 
--member=serviceAccount:$CB_SA_EMAIL 
--role roles/container.developer
Preparations
DEMO
https://github.com/jerryjj/gdg-cicd-presentation
demos/cb-deploy-k8s/README.md
There is a lot more you could do
Eg. GitOps-style continuous delivery with Cloud Build
https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build
Github Triggers
Using the new App Triggers
Ci/CD  - Stop wasting time, Automate your deployments
DEMO
https://github.com/jerryjj/gdg-cicd-presentation
demos/cb-deploy-k8s/GITHUP_APP.md
This is only the
beginning
We have just scratched the surface
Some of the solutions
I suggest looking into
- Tekton https://tekton.dev/
- Jenkins X https://jenkins-x.io/
- Gitlab Kubernetes Executor
- Github Actions https://github.com/features/actions
- Flux https://docs.fluxcd.io/en/latest/
- Flagger https://flagger.app/
Thank You!
Jerry Jalava
Cloud GDE Helsinki
@W_I

More Related Content

PDF
Kubernetes - Security Journey
PDF
User authentication and authorizarion in Kubernetes
PDF
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
PDF
Kubernetes Security
PPTX
Kubernetes security with AWS
PDF
Kubernetes security and you
PDF
Kubernetes - security you need to know about it
PDF
Container Security Deep Dive & Kubernetes
Kubernetes - Security Journey
User authentication and authorizarion in Kubernetes
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
Kubernetes Security
Kubernetes security with AWS
Kubernetes security and you
Kubernetes - security you need to know about it
Container Security Deep Dive & Kubernetes

What's hot (20)

PDF
Secrets in Kubernetes
PDF
Google Cloud Container Security Quick Overview
PDF
Keeping your Kubernetes Cluster Secure
PDF
Zombies in Kubernetes
PDF
Cloud-native applications with Java and Kubernetes - Yehor Volkov
PDF
What is Google Cloud Good For at DevFestInspire 2021
PPTX
CloudStack vs OpenStack vs Eucalyptus: IaaS Private Cloud Brief Comparison
PDF
Moving to Kubernetes - Tales from SoundCloud
PPTX
Kubernetes 101 VMworld 2019 workshop slides
PPTX
Security best practices for kubernetes deployment
PDF
How abusing the Docker API led to remote code execution same origin bypass an...
PPTX
VMware Hybrid Cloud Service - Overview
POTX
Jenkins, jclouds, CloudStack, and CentOS by David Nalley
PDF
Kubernetes Architecture and Introduction
PDF
Building an Angular 2 App
PDF
New Features of Kubernetes v1.2.0 beta
PDF
Lessons learned and challenges faced while running Kubernetes at Scale
PPTX
Hypervisor Selection in Apache CloudStack 4.4
PDF
OpenStack Architecture
PPTX
Websockets: Pushing the web forward
Secrets in Kubernetes
Google Cloud Container Security Quick Overview
Keeping your Kubernetes Cluster Secure
Zombies in Kubernetes
Cloud-native applications with Java and Kubernetes - Yehor Volkov
What is Google Cloud Good For at DevFestInspire 2021
CloudStack vs OpenStack vs Eucalyptus: IaaS Private Cloud Brief Comparison
Moving to Kubernetes - Tales from SoundCloud
Kubernetes 101 VMworld 2019 workshop slides
Security best practices for kubernetes deployment
How abusing the Docker API led to remote code execution same origin bypass an...
VMware Hybrid Cloud Service - Overview
Jenkins, jclouds, CloudStack, and CentOS by David Nalley
Kubernetes Architecture and Introduction
Building an Angular 2 App
New Features of Kubernetes v1.2.0 beta
Lessons learned and challenges faced while running Kubernetes at Scale
Hypervisor Selection in Apache CloudStack 4.4
OpenStack Architecture
Websockets: Pushing the web forward
Ad

Similar to Ci/CD - Stop wasting time, Automate your deployments (20)

PPTX
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
PDF
Microservices DevOps on Google Cloud Platform
PDF
GCP-DevOps-projectintroduxtionfir devopsproject.pdf
PDF
CI/CD on Google Cloud Platform
ODP
Google Cloud Platform for DeVops, by Javier Ramirez @ teowaki
PPTX
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
PPTX
Introduction to GCCP - 2022.pptx
PDF
Kubernetes best practices
PPTX
Cloud computing which explians about cloud topics
PDF
Kubernetes Boulder - Kit Merker - Cloud Native Deployment
PDF
The Self-Service Developer - GOTOCon CPH
PPTX
TIAD : Automate everything with Google Cloud
PDF
Powerful Google Cloud tools for your hack
PDF
Docker, Kubernetes, and Google Cloud
PDF
Dipping Your Toes Into Cloud Native Application Development
PDF
Infrastructure Management in GCP
PDF
GCP Meetup #3 - Approaches to Cloud Native Architectures
PDF
Serverless Computing with Google Cloud
PDF
Gitlab ci e kubernetes, build test and deploy your projects like a pro
PPTX
How google cloud platform can benefit devops?
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
Microservices DevOps on Google Cloud Platform
GCP-DevOps-projectintroduxtionfir devopsproject.pdf
CI/CD on Google Cloud Platform
Google Cloud Platform for DeVops, by Javier Ramirez @ teowaki
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
Introduction to GCCP - 2022.pptx
Kubernetes best practices
Cloud computing which explians about cloud topics
Kubernetes Boulder - Kit Merker - Cloud Native Deployment
The Self-Service Developer - GOTOCon CPH
TIAD : Automate everything with Google Cloud
Powerful Google Cloud tools for your hack
Docker, Kubernetes, and Google Cloud
Dipping Your Toes Into Cloud Native Application Development
Infrastructure Management in GCP
GCP Meetup #3 - Approaches to Cloud Native Architectures
Serverless Computing with Google Cloud
Gitlab ci e kubernetes, build test and deploy your projects like a pro
How google cloud platform can benefit devops?
Ad

Recently uploaded (20)

PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
medical staffing services at VALiNTRY
PDF
System and Network Administraation Chapter 3
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Introduction to Artificial Intelligence
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
ai tools demonstartion for schools and inter college
PDF
AI in Product Development-omnex systems
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Operating system designcfffgfgggggggvggggggggg
medical staffing services at VALiNTRY
System and Network Administraation Chapter 3
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo Companies in India – Driving Business Transformation.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
wealthsignaloriginal-com-DS-text-... (1).pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Introduction to Artificial Intelligence
Design an Analysis of Algorithms I-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PTS Company Brochure 2025 (1).pdf.......
ai tools demonstartion for schools and inter college
AI in Product Development-omnex systems
Reimagine Home Health with the Power of Agentic AI​
Softaken Excel to vCard Converter Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool

Ci/CD - Stop wasting time, Automate your deployments

  • 1. Stop wasting time Automate your deployments Jerry Jalava Cloud GDE Helsinki @W_I
  • 2. “Companies waste $300 Billion of developer productivity every year” “Developers spend 42% of their time on code maintenance” - Stripe (The Developer Coefficient study)
  • 3. Using CI/CD Saves you time and money, brings reliability and trust
  • 4. Essentially it means this Picture from "Setting up GitLab CI/CD for Android projects"
  • 5. Multiple options Landscape of CI/CD tools The number of different CI/CD tools and solutions have grown rapidly in the past years
  • 7. ● Source code location(s) Github, Gitlab, Cloud Source ● Target systems Kubernetes, Cloud Run, VMs ● Target Environments Development, Testing, Staging, QA, Production Your solution needs may vary Not all projects are created equal ● Code structure Multiple repos, Monorepo ● Deployment tooling Helm charts, Chef, etc. ● And so on...
  • 8. ● Keep your Pipelines fast ● Run the Fastest Tests Early ● Run tests locally before committing ● Think about your branches ● Secure and Isolate your CI/CD environment ● Allow Production deployments only through CI/CD ● If the process is painful, you are doing it wrong! Some key things to consider Your solution needs may vary
  • 9. Demo time Let’s start with Cloud Build
  • 10. Tools we will be using Google Cloud Build Cloud Build lets you build software quickly across all languages. Get complete control over defining custom workflows for building, testing, and deploying across multiple environments such as VMs, serverless, Kubernetes, or Firebase. Pricing: 120 min/day free (10 concurrent builds), $0.003 per minute https://cloud.google.com/cloud-build https://github.com/GoogleCloudPlatform/cloud-builders-community
  • 11. Performance tweaks Best practices for speeding up builds Build leaner containers https://cloud.google.com/cloud-build/docs/building-leaner-containers Use Kaniko cache (in demo) Use a cached Docker image (in demo) Use custom virtual machine sizes (Defaults to 2 high-CPU VMs) Avoid uploading of unnecessary files (.gcloudignore)
  • 13. # Create Build project and Enable Billing $ gcloud projects create $BUILD_PROJECT_ID $ gcloud --quiet beta billing projects link $BUILD_PROJECT_ID --billing-account $BILLING_ID # Enable APIs in the build project $ ENABLE_APIS=( "cloudresourcemanager.googleapis.com" "servicemanagement.googleapis.com" "sourcerepo.googleapis.com" "cloudbuild.googleapis.com" "run.googleapis.com" "containerregistry.googleapis.com" ) $ gcloud services enable --project=$BUILD_PROJECT_ID ${ENABLE_APIS[@]} Preparations
  • 15. Deploy to environment Google Cloud Repository, Google Cloud Run - Prepare projects - Setup repository - Setup Cloud Trigger - Check the Magic
  • 17. # Create Deploy project and Enable Billing $ gcloud projects create $DEPLOY_PROJECT_ID $ gcloud --quiet beta billing projects link $DEPLOY_PROJECT_ID --billing-account $BILLING_ID # Enable APIs in the build project $ ENABLE_APIS=( "cloudresourcemanager.googleapis.com" "compute.googleapis.com" "container.googleapis.com" "run.googleapis.com" "storage-api.googleapis.com" "servicenetworking.googleapis.com" ) $ gcloud services enable --project=$DEPLOY_PROJECT_ID ${ENABLE_APIS[@]} Preparations
  • 18. # Create Cloud Repository $ gcloud source repos create cb-deploy-run --project $BUILD_PROJECT_ID # Allow Cloud Run to fetch containers from Build Project $ DEPLOY_PROJECT_NUMBER=$(gcloud projects describe $DEPLOY_PROJECT_ID --format='value(projectNumber)') $ RUN_SA_EMAIL="service-$DEPLOY_PROJECT_NUMBER@serverless-robot-prod.iam.gserviceaccount.com" $ BUCKET_PATH="gs://eu.artifacts.$BUILD_PROJECT_ID.appspot.com" $ gsutil iam ch serviceAccount:$RUN_SA_EMAIL:objectViewer $BUCKET_PATH # Allow Cloud Build to deploy to Cloud Run on Deploy Project $ BUILD_PROJECT_NUMBER=$(gcloud projects describe $BUILD_PROJECT_ID --format='value(projectNumber)') $ CB_SA_EMAIL="$BUILD_PROJECT_NUMBER@cloudbuild.gserviceaccount.com" $ COMPUTE_SA_EMAIL="$DEPLOY_PROJECT_NUMBER-compute@developer.gserviceaccount.com" $ gcloud projects add-iam-policy-binding $DEPLOY_PROJECT_ID --member=serviceAccount:$CB_SA_EMAIL --role roles/run.admin $ gcloud iam service-accounts add-iam-policy-binding $COMPUTE_SA_EMAIL --project $DEPLOY_PROJECT_ID --member="serviceAccount:$CB_SA_EMAIL" --role=roles/iam.serviceAccountUser Preparations
  • 20. Deploy to environment Google Cloud Repository, Google Kubernetes Engine - Prepare projects - Setup repository - Setup Cloud Trigger - Check the Magic
  • 22. # Create GKE Cluster $ gcloud beta container clusters create "demo-cluster" --project $DEPLOY_PROJECT_ID --zone $COMPUTE_ZONE... # Set yourself as the cluster admin $ export CONTEXT=`kubectl config view | awk '{print $2}' | grep "demo-cluster" | tail -n 1` $ ACCOUNT=$(gcloud info --format='value(config.account)') $ NAME=$(echo "${ACCOUNT%@*}") $ kubectl --context $CONTEXT create clusterrolebinding $NAME-cluster-admin-binding --clusterrole=cluster-admin --user=$ACCOUNT Preparations
  • 23. # Create Cloud Repository $ gcloud source repos create cb-deploy-k8s --project $BUILD_PROJECT_ID # Allow GKE to fetch containers from Build Project $ DEPLOY_PROJECT_NUMBER=$(gcloud projects describe $DEPLOY_PROJECT_ID --format='value(projectNumber)') $ GKE_SA_EMAIL="$DEPLOY_PROJECT_NUMBER-compute@developer.gserviceaccount.com" $ BUCKET_PATH="gs://eu.artifacts.$BUILD_PROJECT_ID.appspot.com" $ gsutil iam ch serviceAccount:$GKE_SA_EMAIL:objectViewer $BUCKET_PATH # Allow Cloud Build to deploy to GKE on Deploy Project $ BUILD_PROJECT_NUMBER=$(gcloud projects describe $BUILD_PROJECT_ID --format='value(projectNumber)') $ CB_SA_EMAIL="$BUILD_PROJECT_NUMBER@cloudbuild.gserviceaccount.com" $ gcloud projects add-iam-policy-binding $DEPLOY_PROJECT_ID --member=serviceAccount:$CB_SA_EMAIL --role roles/container.developer Preparations
  • 25. There is a lot more you could do Eg. GitOps-style continuous delivery with Cloud Build https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build
  • 26. Github Triggers Using the new App Triggers
  • 29. This is only the beginning We have just scratched the surface
  • 30. Some of the solutions I suggest looking into - Tekton https://tekton.dev/ - Jenkins X https://jenkins-x.io/ - Gitlab Kubernetes Executor - Github Actions https://github.com/features/actions - Flux https://docs.fluxcd.io/en/latest/ - Flagger https://flagger.app/
  • 31. Thank You! Jerry Jalava Cloud GDE Helsinki @W_I