-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update/non_aws
- Loading branch information
Showing
406 changed files
with
266,902 additions
and
313,545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
# These are default codeowners, later rules take precedence | ||
* @wellcomecollection/scala-reviewers | ||
|
||
# To ensure only properly audited changes are run in CI, we require reviews | ||
# from @wellcomecollection/developers when updating pipeline config | ||
/CODEOWNERS @wellcomecollection/developers | ||
/.buildkite/ @wellcomecollection/developers | ||
|
||
# Allow reviews from all developers on infrastructure changes | ||
/pipeline/terraform @wellcomecollection/developers | ||
* @wellcomecollection/digital-platform | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
PIPELINE_NAMESPACE="catalogue-$PIPELINE_DATE" | ||
REPOSITORY_URI="760097843905.dkr.ecr.eu-west-1.amazonaws.com" | ||
|
||
for SERVICE_NAME in "$@" | ||
do | ||
IMAGE_URI="${REPOSITORY_URI}"/uk.ac.wellcome/"${SERVICE_NAME}":"env.${PIPELINE_DATE}" | ||
FUNCTION_NAME="${PIPELINE_NAMESPACE}"-"${SERVICE_NAME}" | ||
|
||
echo "Deploying ${IMAGE_URI} to ${FUNCTION_NAME}, @ $(date) ..." | ||
|
||
echo "Current lambda configuration for ${FUNCTION_NAME}:" | ||
aws lambda get-function-configuration \ | ||
--function-name "$FUNCTION_NAME" \ | ||
--no-cli-pager | ||
|
||
echo "Updating lambda configuration ..." | ||
echo "Using ${IMAGE_URI}:" | ||
aws lambda update-function-code \ | ||
--function-name "$FUNCTION_NAME" \ | ||
--image-uri "${IMAGE_URI}" \ | ||
--no-cli-pager | ||
|
||
|
||
echo "Updated lambda configuration, (waiting for update @ $(date)}):" | ||
aws lambda wait function-updated \ | ||
--function-name "$FUNCTION_NAME" \ | ||
--no-cli-pager | ||
|
||
echo "New lambda configuration complete (@ $(date)), config after change:" | ||
aws lambda get-function-configuration \ | ||
--function-name "$FUNCTION_NAME" \ | ||
--no-cli-pager | ||
|
||
echo "Done deploying ${FUNCTION_NAME} @ $(date)! 🚀" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package weco.lambda | ||
|
||
import io.circe.Encoder | ||
import software.amazon.awssdk.services.sns.SnsClient | ||
import weco.messaging.sns.{SNSConfig, SNSMessageSender} | ||
import weco.json.JsonUtil.toJson | ||
|
||
import scala.util.Try | ||
|
||
trait Downstream { | ||
def notify(workId: String): Try[Unit] | ||
def notify[T](batch: T)(implicit encoder: Encoder[T]): Try[Unit] | ||
} | ||
|
||
class SNSDownstream(snsConfig: SNSConfig) extends Downstream { | ||
protected val msgSender = new SNSMessageSender( | ||
snsClient = SnsClient.builder().build(), | ||
snsConfig = snsConfig, | ||
subject = "Sent from relation_embedder" | ||
) | ||
|
||
override def notify(workId: String): Try[Unit] = Try(msgSender.send(workId)) | ||
override def notify[T](batch: T)(implicit encoder: Encoder[T]): Try[Unit] = | ||
msgSender.sendT(batch) | ||
} | ||
|
||
object STDIODownstream extends Downstream { | ||
override def notify(workId: String): Try[Unit] = Try(println(workId)) | ||
override def notify[T](t: T)(implicit encoder: Encoder[T]): Try[Unit] = Try( | ||
println(toJson(t)) | ||
) | ||
} | ||
|
||
sealed trait DownstreamTarget | ||
case class SNS(config: SNSConfig) extends DownstreamTarget | ||
case object StdOut extends DownstreamTarget | ||
|
||
object Downstream { | ||
def apply(downstreamTarget: DownstreamTarget): Downstream = { | ||
downstreamTarget match { | ||
case SNS(config) => new SNSDownstream(config) | ||
case StdOut => STDIODownstream | ||
} | ||
} | ||
def apply(): Downstream = STDIODownstream | ||
} |
Oops, something went wrong.