def startBaking()

in app/controllers/BakeController.scala [33:58]


  def startBaking(recipeId: RecipeId, debug: Boolean): Action[AnyContent] =
    authAction { request =>
      Recipes.findById(recipeId).fold[Result](NotFound) { recipe =>
        Recipes.incrementAndGetBuildNumber(recipe.id) match {
          case Some(buildNumber) =>
            val theBake = Bakes
              .create(recipe, buildNumber, startedBy = request.user.fullName)
            packerRunner.createImage(
              stage,
              theBake,
              prism,
              eventBus,
              ansibleVars,
              debugAvailable && debug,
              amiMetadataLookup,
              amigoDataBucket
            )
            Redirect(routes.BakeController.showBake(recipeId, buildNumber))
          case None =>
            val message =
              s"Failed to get the next build number for recipe $recipeId"
            log.warn(message)
            InternalServerError(message)
        }
      }
    }