in riff-raff/app/deployment/Deployments.scala [34:80]
def deploy(
requestedParams: DeployParameters,
requestSource: RequestSource
): Either[Error, UUID] = {
log.info(s"Started deploying $requestedParams")
val restrictionsPreventingDeploy =
RestrictionChecker.configsThatPreventDeployment(
restrictionConfigDynamoRepository,
requestedParams.build.projectName,
requestedParams.stage.name,
requestSource
)
if (restrictionsPreventingDeploy.nonEmpty) {
Left(
Error(
s"Unable to queue deploy as restrictions are currently in place: ${restrictionsPreventingDeploy
.map(r => s"${r.fullName}: ${r.note}")
.mkString("; ")}"
)
)
} else {
val params =
if (requestedParams.build.id != "lastSuccessful")
requestedParams
else {
builds
.getLastSuccessful(requestedParams.build.projectName)
.map { latestId =>
requestedParams
.copy(build = requestedParams.build.copy(id = latestId))
}
.getOrElse(requestedParams)
}
deploysEnabled.whileOnYield {
val record = create(params)
deploymentEngine.interruptibleDeploy(record)
Right(record.uuid)
} getOrElse {
Left(
Error(
s"Unable to queue a new deploy; deploys are currently disabled by the ${enableDeploysSwitch.name} switch"
)
)
}
}
}