{"id":2767,"date":"2020-03-08T13:20:44","date_gmt":"2020-03-08T12:20:44","guid":{"rendered":"https:\/\/www.aerian.fr\/?p=2767"},"modified":"2020-03-19T20:21:06","modified_gmt":"2020-03-19T19:21:06","slug":"english-gitlab-ci-cd-to-deploy-on-gcloud","status":"publish","type":"post","link":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/","title":{"rendered":"Gitlab CI\/CD to deploy on GCloud"},"content":{"rendered":"<p>So, sometimes I&#8217;m kinda lazy.<br \/>\nConsidering the fact I needed to be connecting to different Gcloud env for different project, it was kinda a hassle to have to switch every time.<br \/>\nSo I told myself&#8230; why not automatize it ?<\/p>\n<p>So I search a bit and found this good example:<br \/>\nhttps:\/\/gist.github.com\/troyharvey\/bae82c86c27a3aa539dea83857ee9ecd<\/p>\n<p>I searched a bit for a alpine image and then adapted for my needs like that<\/p>\n<pre class=\"brush:yaml\">\ndeploy:\n  stage: deploy\n  image: google\/cloud-sdk:alpine\n  only:\n    - dev\n  before_script:\n    - echo $FIREBASE_KEY > ${CI_PROJECT_DIR}\/key.json\n    - echo $GCLOUD_SERVICE_KEY > \/tmp\/$CI_PIPELINE_ID.json\n    - gcloud auth activate-service-account --key-file \/tmp\/$CI_PIPELINE_ID.json\n    - gcloud config set project $CLOUDSDK_CORE_PROJECT\n  script:\n    - cd ${CI_PROJECT_DIR} \n    - gcloud app deploy\n  allow_failure: false\n<\/pre>\n<p>With this, you&#8217;ll also need a configuration in your settings, CI\/CD variables.<br \/>\nSomething like that<\/p>\n<figure id=\"attachment_2769\" aria-describedby=\"caption-attachment-2769\" style=\"width: 1027px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci.png\" alt=\"Example CI\/CD variable\" width=\"1027\" height=\"445\" class=\"size-full wp-image-2769\" srcset=\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci.png 1027w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-150x65.png 150w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-300x130.png 300w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-768x333.png 768w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-1024x444.png 1024w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-830x360.png 830w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-230x100.png 230w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-350x152.png 350w, https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/ci-480x208.png 480w\" sizes=\"auto, (max-width: 1027px) 100vw, 1027px\" \/><figcaption id=\"caption-attachment-2769\" class=\"wp-caption-text\">This is the configuration example for deploy Gcloud app in CI\/CD<\/figcaption><\/figure>\n<p>Once done, Please do not forget to have at least your branch \/ tag as protected.<br \/>\nElse you&#8217;ll loose time like me :)<\/p>","protected":false},"excerpt":{"rendered":"<p>So, sometimes I&#8217;m kinda lazy. Considering the fact I needed to be connecting to different Gcloud env for different project, it was [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2771,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[221],"tags":[243,241,240,244,239,242],"class_list":["post-2767","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system","tag-app","tag-cd","tag-ci","tag-engine","tag-gcloud","tag-gitlab"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Gitlab CI\/CD to deploy on GCloud - Aerian.fr<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gitlab CI\/CD to deploy on GCloud - Aerian.fr\" \/>\n<meta property=\"og:description\" content=\"So, sometimes I&#8217;m kinda lazy. Considering the fact I needed to be connecting to different Gcloud env for different project, it was [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\" \/>\n<meta property=\"og:site_name\" content=\"Aerian.fr\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-08T12:20:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-19T19:21:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png\" \/>\n\t<meta property=\"og:image:width\" content=\"498\" \/>\n\t<meta property=\"og:image:height\" content=\"388\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"42\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@LinceAerian\" \/>\n<meta name=\"twitter:site\" content=\"@LinceAerian\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"42\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\"},\"author\":{\"name\":\"42\",\"@id\":\"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b\"},\"headline\":\"Gitlab CI\/CD to deploy on GCloud\",\"datePublished\":\"2020-03-08T12:20:44+00:00\",\"dateModified\":\"2020-03-19T19:21:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\"},\"wordCount\":146,\"publisher\":{\"@id\":\"https:\/\/www.aerian.fr\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png\",\"keywords\":[\"app\",\"cd\",\"ci\",\"engine\",\"gcloud\",\"gitlab\"],\"articleSection\":[\"System\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\",\"url\":\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\",\"name\":\"Gitlab CI\/CD to deploy on GCloud - Aerian.fr\",\"isPartOf\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png\",\"datePublished\":\"2020-03-08T12:20:44+00:00\",\"dateModified\":\"2020-03-19T19:21:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[[\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/\"]]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage\",\"url\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png\",\"contentUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png\",\"width\":498,\"height\":388,\"caption\":\"Thanks to https:\/\/medium.com\/google-cloud\/deploying-parse-server-to-google-app-engine-6bc0b7451d50\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.aerian.fr\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"(English) Gitlab CI\/CD to deploy on GCloud\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.aerian.fr\/en\/#website\",\"url\":\"https:\/\/www.aerian.fr\/en\/\",\"name\":\"Aerian.fr\",\"description\":\"Welcome to Aerian.fr\",\"publisher\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.aerian.fr\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.aerian.fr\/en\/#organization\",\"name\":\"Aerian.fr\",\"url\":\"https:\/\/www.aerian.fr\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png\",\"contentUrl\":\"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png\",\"width\":667,\"height\":522,\"caption\":\"Aerian.fr\"},\"image\":{\"@id\":\"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/LinceAerian\",\"https:\/\/www.linkedin.com\/in\/marleixmathieu\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b\",\"name\":\"42\",\"sameAs\":[\"http:\/\/www.aerian.fr\"],\"url\":\"https:\/\/www.aerian.fr\/en\/author\/lince\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Gitlab CI\/CD to deploy on GCloud - Aerian.fr","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/","og_locale":"en_US","og_type":"article","og_title":"Gitlab CI\/CD to deploy on GCloud - Aerian.fr","og_description":"So, sometimes I&#8217;m kinda lazy. Considering the fact I needed to be connecting to different Gcloud env for different project, it was [&hellip;]","og_url":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/","og_site_name":"Aerian.fr","article_published_time":"2020-03-08T12:20:44+00:00","article_modified_time":"2020-03-19T19:21:06+00:00","og_image":[{"width":498,"height":388,"url":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png","type":"image\/png"}],"author":"42","twitter_card":"summary_large_image","twitter_creator":"@LinceAerian","twitter_site":"@LinceAerian","twitter_misc":{"Written by":"42","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#article","isPartOf":{"@id":"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/"},"author":{"name":"42","@id":"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b"},"headline":"Gitlab CI\/CD to deploy on GCloud","datePublished":"2020-03-08T12:20:44+00:00","dateModified":"2020-03-19T19:21:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/"},"wordCount":146,"publisher":{"@id":"https:\/\/www.aerian.fr\/#organization"},"image":{"@id":"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png","keywords":["app","cd","ci","engine","gcloud","gitlab"],"articleSection":["System"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/","url":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/","name":"Gitlab CI\/CD to deploy on GCloud - Aerian.fr","isPartOf":{"@id":"https:\/\/www.aerian.fr\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage"},"image":{"@id":"https:\/\/www.aerian.fr\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png","datePublished":"2020-03-08T12:20:44+00:00","dateModified":"2020-03-19T19:21:06+00:00","breadcrumb":{"@id":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":[["https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/"]]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#primaryimage","url":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png","contentUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2020\/03\/1-VHYGqjhONSJ20pRlIUbg7w.png","width":498,"height":388,"caption":"Thanks to https:\/\/medium.com\/google-cloud\/deploying-parse-server-to-google-app-engine-6bc0b7451d50"},{"@type":"BreadcrumbList","@id":"https:\/\/www.aerian.fr\/en\/english-gitlab-ci-cd-to-deploy-on-gcloud\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.aerian.fr\/en\/"},{"@type":"ListItem","position":2,"name":"(English) Gitlab CI\/CD to deploy on GCloud"}]},{"@type":"WebSite","@id":"https:\/\/www.aerian.fr\/en\/#website","url":"https:\/\/www.aerian.fr\/en\/","name":"Aerian.fr","description":"Welcome to Aerian.fr","publisher":{"@id":"https:\/\/www.aerian.fr\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.aerian.fr\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.aerian.fr\/en\/#organization","name":"Aerian.fr","url":"https:\/\/www.aerian.fr\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png","contentUrl":"https:\/\/www.aerian.fr\/wp-content\/uploads\/2012\/01\/logo.png","width":667,"height":522,"caption":"Aerian.fr"},"image":{"@id":"https:\/\/www.aerian.fr\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/LinceAerian","https:\/\/www.linkedin.com\/in\/marleixmathieu"]},{"@type":"Person","@id":"https:\/\/www.aerian.fr\/#\/schema\/person\/622c3cefbea11a0be741137608b4bf8b","name":"42","sameAs":["http:\/\/www.aerian.fr"],"url":"https:\/\/www.aerian.fr\/en\/author\/lince\/"}]}},"_links":{"self":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts\/2767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/comments?post=2767"}],"version-history":[{"count":6,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts\/2767\/revisions"}],"predecessor-version":[{"id":2838,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/posts\/2767\/revisions\/2838"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/media\/2771"}],"wp:attachment":[{"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/media?parent=2767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/categories?post=2767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aerian.fr\/en\/wp-json\/wp\/v2\/tags?post=2767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}