Skip to content

[Design] Ordering deployments in a pipeline #3402

@efekarakus

Description

@efekarakus

We propose adding support for a deployments field under stages to the pipeline manifest in order to control which workloads should be deployed and their deployment order in a stage.

stage:
- name: string
  requires_approval: boolean      
  test_commands: [string, ...]              
  deployments:                    # Optional. New.
    <name>:                       # Name for the codepipeline Deploy action.
       stack_name: string         # Optional. Defaults to {app name}-{stage name}-{name}
       template_path: string      # Optional. Path to the generated template during Build. Defaults to infrastructure/{name}-{stage name}.yml
       template_config: string    # Optional. Path to the generated config file during Build. Defaults to infrastructure/{name}-{stage name}.params.json
       depends_on: [string, ...]  # Optional. Actions that need to happen before this one.

An example

For example, let's say we have an application with two environments, "test" and "prod", and services organized in a monorepo:

copilot/
├── worker
│   └── manifest.yml
└── www
    └── manifest.yml

Now we can run copilot pipeline init and modify the pipeline manifest like this:

name: pipeline-sample-app

stages:
-  name: test
   deployments:
     worker:
- name: prod
  deployments:
     worker:

The above manifest will allow us to restrict the pipeline to deploy only the "worker" service instead of both "worker" and "www" in parallel.

I could also modify my manifest file like this:

stages:
-  name: test
   deployments:
     worker:
     www:
       depends_on:
       - worker
- name: prod
  deployments:
     worker:
     www:
       depends_on:
       - worker

To create an order between deployments, first the "worker" service will be deployed and then the "www" service.

Related #2935

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/pipelineIssues about pipelines to release applications.type/designIssues that are design proposals.

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions