How to read deployment.yaml from GCS if the trigger is set to Docker?


#1

I have cloudbuild.yaml to build:

  • Docker image: $git_repository_name:$git_tag
  • K8S yaml files to GCS with dynamic path: gs://MY_BUCKET/$git_repository_name/$git_tag/manifests/deployment.yaml

In Spinnaker, I have set the trigger to be the Docker image. However, to be able to deploy the image to K8S cluster, I need the K8S yaml files as well.

How to configure Spinnaker (K8S V2 deployment) to read those yaml files? The challenge is: the GCS path is dynamic.


#2

Hi,
I’m looking to do the same but with deployment.yaml in private github instead og GCS


#3

Fundamentally, your event source system (in your case docker registry) needs to contain the GCS path, in order to even have the option of publishing that information in a trigger paylaod.

You’ll need to either find a way to get the GCS URL in the message payload, and unfortunately there just aren’t many good options for such metadata in the docker registry (e.g. tag).

An alternative is to trigger the pipeline on the GCS event, with for example the docker tag being indicated in the collection of files pushed.

You can also push a pub/sub message from the process which pushes the GCS file and includes all the pertinent information.