diff --git a/src/main/java/com/conveyal/datatools/manager/controllers/api/DeploymentController.java b/src/main/java/com/conveyal/datatools/manager/controllers/api/DeploymentController.java index 9d43a6616..2e996f0c9 100644 --- a/src/main/java/com/conveyal/datatools/manager/controllers/api/DeploymentController.java +++ b/src/main/java/com/conveyal/datatools/manager/controllers/api/DeploymentController.java @@ -103,6 +103,7 @@ private static String downloadBuildArtifact (Request req, Response res) throws C } // If a jobId query param is provided, find the matching job summary. String jobId = req.queryParams("jobId"); + if (jobId != null) { for (DeployJob.DeploySummary summary : deployment.deployJobSummaries) { if (summary.jobId.equals(jobId)) { @@ -137,12 +138,16 @@ private static String downloadBuildArtifact (Request req, Response res) throws C region = summaryToDownload.ec2Info == null ? null : summaryToDownload.ec2Info.region; } AmazonS3URI uri = new AmazonS3URI(uriString); + + // If a redirect query param is provided, pass it along to the download method. + boolean redirect = Boolean.parseBoolean(req.queryParams("redirect")); + // Assume the alternative role if needed to download the deploy artifact. return S3Utils.downloadObject( S3Utils.getS3Client(role, region), uri.getBucket(), String.join("/", uri.getKey(), filename), - false, + redirect, req, res ); @@ -602,6 +607,9 @@ public static void register (String apiPrefix) { options(apiPrefix + "secure/deployments", (q, s) -> ""); get(apiPrefix + "secure/deployments/:id/download", DeploymentController::downloadDeployment); get(apiPrefix + "secure/deployments/:id/artifact", DeploymentController::downloadBuildArtifact); + // This path allows the downloaded artifact file to be named anything. Without this line, the downloaded file + // will be named `artifact`. + get(apiPrefix + "secure/deployments/:id/artifact/:expectedFileName", DeploymentController::downloadBuildArtifact); get(apiPrefix + "secure/deployments/:id/ec2", DeploymentController::fetchEC2InstanceSummaries, slimJson::write); delete(apiPrefix + "secure/deployments/:id/ec2", DeploymentController::terminateEC2InstanceForDeployment, slimJson::write); get(apiPrefix + "secure/deployments/:id", DeploymentController::getDeployment, fullJson::write); diff --git a/src/main/java/com/conveyal/datatools/manager/jobs/NotifyUsersForSubscriptionJob.java b/src/main/java/com/conveyal/datatools/manager/jobs/NotifyUsersForSubscriptionJob.java index b21504168..c35af0dc9 100644 --- a/src/main/java/com/conveyal/datatools/manager/jobs/NotifyUsersForSubscriptionJob.java +++ b/src/main/java/com/conveyal/datatools/manager/jobs/NotifyUsersForSubscriptionJob.java @@ -64,6 +64,13 @@ public void notifyUsers() { deployment.projectId, deployment.id ); + // Add build log text. + html += String.format( + "
View deployment otp-build.log.
", + APPLICATION_URL, + deployment.id, + deployment.latest().jobId + ); break; default: LOG.warn("Notifications not supported for subscription type {}", subType[0]);