Cloud build CI/CD & k8s files

5/21/2019

I am using cloud build and GKE k8s cluster and i have setup CI/CD from github to cloud build.

I want to know is it good to add CI build file and Dockerfile in the repository or manage config file separately in another repository?

Is it good to add Ci & k8s config files with business logic repository?

What is best way to implement CI/CD cloud build to GKE with managing CI/k8 yaml files

-- Harsh Manvar
docker
google-kubernetes-engine
kubernetes

2 Answers

5/21/2019

Yes, you can add deployment directives, typically in a dedicated folder of your project, which can in turn use a cicd repository

See "kelseyhightower/pipeline-application" as an example, where:

Changes pushed to any branch except master should trigger the following actions:

  • build a container image tagged with the build ID suitable for deploying to a staging cluster
  • clone the pipeline-infrastructure-staging repo
  • patch the pipeline deployment configuration file with the staging container image and commit the changes to the pipeline-infrastructure-staging repo

The pipeline-infrastructure-staging repo will deploy any updates committed to the master branch.

-- VonC
Source: StackOverflow

5/21/2019

Please keep in mind that:

The best solution for storing Dockerfile or build config file should be the remote repository. For dockerfiles this is supported as "Native Docker support" in gcloud.

You can use different host repositories like:

  • Cloud Source Repository
  • Bitbucket
  • GitHub

As an example structure for build config yaml file you can find here, informations about cloud build concepts and tutorials.

-- Hanx
Source: StackOverflow