Single build, multiple deploys

Here’s the scenario I have. I want to deploy master to 3 environments (QA1, QA2, QA3)with only building once. I also have other branches that I build that are only deployed to a single environment. I’m using jsoonnet and it is working as expected for a 1 to 1 scenario, but I’m trying avoid building multiple containers for the same branch.

I cut out a lot of the jsonnet file but here’s a snippet of what I have currently.

local build_deploy(name, branch, service, event, database, nodes, region, subnet, secgroup) = {
  kind: "pipeline",
  name: "Auto Build and Deploy " + service + "in " + region,
  concurrency: {
    limit: 1
  },
  steps: [
    {
      name: "Build and Push",
      image: "plugins/ecr",
    },
    {
      name: "Deploy to " + service,
      image: "peloton/drone-ecs",
    },
  ],
};

[
  build_deploy("release-autodeploy", "master", "qa1", "push", "db1", "1", "region", "subnet-", "sg-"),
  build_deploy("release-autodeploy2", "master", "qa2", "push", "db2", "1", "region", "subnet-", "sg-"),
]

Hi @mindcruft , Yes you should be able to use conditional check to determine which environment needs to be deployed based on given condition. Please check our documentation Conditions | Drone and let us know if you have any questions.

Regards,
Harness Support Team