{"id":101263,"date":"2020-10-30T16:00:12","date_gmt":"2020-10-30T13:00:12","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-get-started-with-continuous-integration-delivery-on-google-cloud-platform-cloudsavvy-it\/"},"modified":"2020-10-30T16:00:12","modified_gmt":"2020-10-30T13:00:12","slug":"how-to-get-started-with-continuous-integration-delivery-on-google-cloud-platform-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-get-started-with-continuous-integration-delivery-on-google-cloud-platform-cloudsavvy-it\/","title":{"rendered":"#How to Get Started With Continuous Integration &#038; Delivery On Google Cloud Platform \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a43029a998a8\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a43029a998a8\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-get-started-with-continuous-integration-delivery-on-google-cloud-platform-cloudsavvy-it\/#Writing_a_Build_Configuration\" >Writing a Build Configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-get-started-with-continuous-integration-delivery-on-google-cloud-platform-cloudsavvy-it\/#Setting_Up_Cloud_Source_Cloud_Build\" >Setting Up Cloud Source &amp; Cloud Build<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Get Started With Continuous Integration &amp; Delivery On Google Cloud Platform \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<figure id=\"attachment_7677\" style=\"width: 700px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7677 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/2ed38cd48784ba35a98e4f6eb600d079\/p\/uploads\/2020\/06\/ab15c77c.png\" alt=\"\" width=\"700\" height=\"300\" data-crediturl=\"https:\/\/www.shutterstock.com\/image-vector\/team-programmer-concept-devops-software-development-1363648634\" data-credittext=\"Shutterstock\/Ribkhan\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><figcaption class=\"wp-caption-text\"><span class=\"imagecredit\"><a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.shutterstock.com\/image-vector\/team-programmer-concept-devops-software-development-1363648634\">Shutterstock\/Ribkhan<\/a><\/span><\/figcaption><\/figure>\n<p>Continuous Integration\/Continuous Delivery (CI\/CD) is the process of automating <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lication updates, from changes in source control, to automated builds, to automated deployments to your servers. GCP provides a service for this, called Cloud Build.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Writing_a_Build_Configuration\"><\/span>Writing a Build Configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The CI\/CD pipeline featured here works pretty simply. GCP listens for changes in your source control, either new commits on a specific branch, or new pull requests. Then, it sends the source to Cloud Build, which runs a set of commands to test and build the application, and sends the output build artifacts over to App Engine, GKE, Cloud Functions, or a Cloud Storage bucket.<\/p>\n<p>Most of the configuration for Cloud Build actually happens outside of Cloud Build, in a YAML file called <code>cloudbuild.yaml<\/code>. This defines the build steps, options, and output settings. The schema looks something like this:<\/p>\n<pre>steps:&#13;\n- name: string&#13;\n  args: [string, string, ...]&#13;\n  env: [string, string, ...]&#13;\n  dir: string&#13;\n  id: string&#13;\n  waitFor: [string, string, ...]&#13;\n  entrypoint: string&#13;\n  secretEnv: string&#13;\n  volumes: object(Volume)&#13;\n  timeout: string (Duration format)&#13;\n- name: string&#13;\n  ...&#13;\n- name: string&#13;\n  ...&#13;\ntimeout: string (Duration format)&#13;\nqueueTtl: string (Duration format)&#13;\nlogsBucket: string&#13;\noptions:&#13;\n env: [string, string, ...]&#13;\n secretEnv: string&#13;\n volumes: object(Volume)&#13;\n sourceProvenanceHash: enum(HashType)&#13;\n machineType: enum(MachineType)&#13;\n diskSizeGb: string (int64 format)&#13;\n substitutionOption: enum(SubstitutionOption)&#13;\n logStreamingOption: enum(LogStreamingOption)&#13;\n logging: enum(LoggingMode)&#13;\nsubstitutions: map (key: string, value: string)&#13;\ntags: [string, string, ...]&#13;\nsecrets: object(Secret)&#13;\nimages:&#13;\n- [string, string, ...]&#13;\nartifacts: object (Artifacts)<\/pre>\n<p>You won\u2019t need all of these options though. A simple configuration like the following will build an NPM application and deploy it to a Cloud Storage bucket:<\/p>\n<pre>steps:&#13;\n# Install dependencies&#13;\n- name: node&#13;\n  entrypoint: npm&#13;\n  args: ['install']&#13;\n# Run tests&#13;\n- name: node&#13;\n  entrypoint: npm&#13;\n  args: ['test']&#13;\n# Run custom commands&#13;\n- name: node&#13;\n  entrypoint: npm&#13;\n  args: ['run', 'build']&#13;\nartifacts:&#13;\n  objects:&#13;\n    location: 'gs:\/\/mybucket\/'&#13;\n    paths: ['build']<\/pre>\n<p>The first key, \u201cSteps,\u201d runs <code>npm install<\/code>\u00a0to get dependencies in order, then <code>npm test<\/code>\u00a0to run any tests you have set up, then <code>npm run build<\/code>\u00a0to start the build process. After that completes, output artifacts in the <code>build<\/code>\u00a0folder are sent to <code>gs:\/\/mybucket\/<\/code>. You don\u2019t have to deploy to an output bucket though; Cloud Build supports deployments to <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/cloud.google.com\/cloud-build\/docs\/deploying-builds\/deploy-gke\">GKE<\/a>,\u00a0 <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/cloud.google.com\/cloud-build\/docs\/deploying-builds\/deploy-functions\">Cloud Functions<\/a> and <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/cloud.google.com\/cloud-build\/docs\/deploying-builds\/deploy-cloud-run\">Cloud Run<\/a>, and\u00a0<a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/cloud.google.com\/cloud-build\/docs\/deploying-builds\/deploy-appengine\">App Engine<\/a>.<\/p>\n<p>Ultimately though, this step will highly depend on what kind of application you\u2019re building, so we can\u2019t write a step-by-step guide for everyone. We recommend <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/cloud.google.com\/cloud-build\/docs\/build-config\">reading Google\u2019s configuration overview<\/a> to learn more.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Setting_Up_Cloud_Source_Cloud_Build\"><\/span>Setting Up Cloud Source &amp; Cloud Build<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once you have a build configuration, you can set up Cloud Build to handle the actual builds. Cloud Build gets its source from Cloud Source, Google\u2019s own hosted Git solution. If you want to use your own git though, you can link an external account, or just set up Cloud Source as a secondary release remote.<\/p>\n<p>Head over to <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/source.cloud.google.com\/\">Cloud Source<\/a> and create a new repository. You can sign in with Github or Bitbucket to link an external account and select a repository, or just create a new one and add it as a secondary remote.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5157 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/df69c319c64d96be9c78454ef7228a9c\/p\/uploads\/2020\/06\/562f923a.png\" alt=\"link external repository\" width=\"700\" height=\"515\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Head over to <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/console.cloud.google.com\/cloud-build\/\">Cloud Build<\/a>, and click \u201cSet Up Build Trigger\u201d from the dashboard.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5158 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/98b949ba7ad2ee7369b35de96e2ddfba\/p\/uploads\/2020\/06\/d04f8732.png\" alt=\"set up trigger\" width=\"700\" height=\"279\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Give it a name, select the source repository, and choose when you want this trigger to run. You can trigger based on commits to a certain branch, new tags, or pull requests. You can also use regex to match the branch names.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5159\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/7d15da2cbbdbfecda0bcef13e77631e4\/p\/uploads\/2020\/06\/acf9dc4f.png\" alt=\"select branch\" width=\"700\" height=\"357\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You\u2019ll want to keep the default here for the Cloud Build configuration file, but if you gave it a different name or placed it under a different path, you can select that here. You also have the option of setting custom variables, which will let you re-use configuration with multiple triggers on different branches.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5160\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/3beb96c55e29b987aef31c953919c64c\/p\/uploads\/2020\/06\/69f9df76.png\" alt=\"choose build configuration yaml file\" width=\"700\" height=\"266\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Click create, and the trigger will appear in the dashboard. You can manually run the trigger here to test your settings.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5161\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/00149ce1a2cc40fb2b9ea8c478c6a606\/p\/uploads\/2020\/06\/eb5fbff8.png\" alt=\"\" width=\"700\" height=\"261\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Once it\u2019s set up though, it will run automatically on every push to the branch, or pull request, depending on what you configured.\n<\/p><\/div>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/5154\/how-to-get-started-with-continuous-integration-delivery-on-google-cloud-platform\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Get Started With Continuous Integration &amp; Delivery On Google Cloud Platform \u2013 CloudSavvy IT&#8221; Shutterstock\/Ribkhan Continuous Integration\/Continuous Delivery (CI\/CD) is the process of automating application updates, from changes in source control, to automated builds, to automated deployments to your servers. GCP provides a service for this, called Cloud Build. Writing a Build Configuration&#8230;<\/p>\n","protected":false},"author":1,"featured_media":101264,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/06\/ab15c77c.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-101263","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/101263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=101263"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/101263\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/101264"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=101263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=101263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=101263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}