PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label google-deployment-manager. Show all posts
Showing posts with label google-deployment-manager. Show all posts

Tuesday, September 27, 2022

[FIXED] How to use 'gcloud deployment-manager deployments' within 'gcloud builds' do have a full CI/CD pipeline on GCP?

 September 27, 2022     continuous-deployment, continuous-integration, google-cloud-build, google-cloud-platform, google-deployment-manager     No comments   

Issue

I am trying to setup a CI/CD pipeline on GCP. I would like following:

  • new modification in Github is used as a trigger
  • use gcloud builds submit --config=cloud_build.yaml to build a new docker image that contain the modification from git (mainly new python packages and python code) and push the image in ContainerRegistry
  • use gcloud deployment-manager deployments create xxx -- template pipeline.jinja --properties xxx` to deploy and run my container (it is a jupyter notebook)

I have the 2 last steps setup and working (gcloud and gcloud deployment-manager).

My question is how can I do that with one script ? I would line to have the pipeline fully automated. Some of the test I would like to implement is to test that python packages are installed properly will be done on the container after the deployment.

What is the best practices on GCP ? I was thinking that I could use gcloud deployment-manager inside gcloud builds but didn't really find documentation up to know how to do that. For the deployment, I have a lot of variables to pass to setup network, machine type and other parameters and I can only do it using jinja script.


Solution

What is the best practices on GCP ? I was thinking that I could use gcloud deployment-manager inside gcloud builds but didn't really find documentation up to know how to do that

Cloud Build provides and maintains pre-built images of builders that you can reference in your build steps to execute your tasks.

You can trigger the deployment manager using the gcr.io/cloud-builders/gcloud (doc) builder:

# Build images
[...]

# Load/Generate your Jinja templates
[...]

# Deploy
- name: 'gcr.io/cloud-builders/gcloud'
  id: Deploy your application
  args: ['deployment-manager', 'deployments', 'create', 'your-template']

However, there are more conventional ways to deploy containerized application within a GKE cluster:

  • via gcr.io/cloud-builders/kubectl to directly deploy application via well-defined Kubernetes manifests;
  • via Helm tool builder to package and deploy Kubernetes applications starting from custom templates.

Disclaimer: Comments and opinions are my own and not the views of my employer.



Answered By - vdenotaris
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing