[Cloud Deploy] Using profiles with multi target deploys

Google Cloud Deploy supports multi targets by creating a child target. However the profiles configuration is a part of the pipeline config so during rendering the profiles go missing.

e.g. let us assume I have a web-server and a jobs-server that I want to deploy in parallel. The following config sort of works

 

 

apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
  name: parallel-deploy-example
description: Parallel deploy Example
serialPipeline:
  stages:
    - targetId: all-servers
      profiles: [profile1, profile2]
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
  name: all-servers
description: Deploy all servers
multiTarget:
  targetIds:
    - web-server
    - jobs-server
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
  name: web-server
  labels:
    service-type: web server
description: staging web us-central1
run:
  location: projects/something/locations/us-central1
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
  name: jobs-server
  labels:
    service-type: jobs
description: jobs server
run:
  location: projects/something/locations/us-central1

 

Now While I can pass profile1 profile2 to both servers I can't pass a profile specifically for web-server and a different profile for jobs server.

However when doing it serially since each step has a profiles array I can give them their own profile.

Is there some secret config I am missing or is this a limitation I have to live with.

1 2 110
2 REPLIES 2

Hello @roopakv ,

Attaching here the limitation documentation that you can check for reference. For your concern, with the provided configuration partially works, it doesn't allow assigning specific profiles to individual child targets.

As a workaround you can try:

  1. Separate Pipelines for Different Profiles: By creating separate delivery pipelines for each target with their respective profiles defined. This way,  you can, you can have  more granular control over profile assignments for individual targets.
  2. Conditional Profile Assignment: Implementing  conditional logic within your pipeline configuration or deployment scripts to dynamically assign profiles based on the target being deployed.
  3. Custom Scripting or Templating: Utilizing custom scripting or templating mechanisms to generate dynamic configurations that include specific profile assignments for each target.

We are also interested in using different profiles for different parallel targets in a pipeline.

@dionv can you please expand on suggestion 2 a bit? How do we do conditional logic within a Cloud Deploy pipeline?