riff-raff
riff-raff copied to clipboard
Add `braze-publish` deployment type (plus hidden `lambda-invoke` deployment type)
Co-Authored-By: @twrichards
The primary motivation for this PR was to facilitate version control and automated deployment of Braze content blocks, making use of guardian/braze-version-control-service
.
What does this change?
As per the branch name, we initially intended to implement a generic lambda-invoke
deployment type, but there were concerns around this being used too broadly. Instead, we have kept the lambda-invoke
deployment type hidden, but extended it in the form of the braze-publish
deployment type (which adds a more specific description and suppresses user-entered parameters in favour of hard-coded references to the publish-lambda
- see https://github.com/guardian/braze-version-control-service/pull/3).
Some example usages of this new braze-publish
deployment type can be seen in:
- https://github.com/guardian/braze-version-control/blob/main/riff-raff.yaml
- https://github.com/guardian/braze-version-control-TEST/blob/main/riff-raff.yaml
To implement the generic lambda-invoke
deployment type, we abstracted common behaviour (such as being able to look up lambdas by function name) from Lambda.scala
into LambdaDeploymentType.scala
which is extended by both:
-
LambdaDeploy
(existing behaviour but new file name) -
LambdaInvoke
(new)
The generic lambda-invoke
deployment type works by taking the artifact files and building the JSON input payload for the lambda from their filenames (keys) and the text content (values) - see the documentation screenshot below for an example. We then invoke the lambda synchronously, which relies on the lambda:InvokeFunction
IAM permissions added in https://github.com/guardian/deploy-tools-platform/pull/538. The console/log output from the lambda invocation is given to the riff-raff reporter as verbose output, and the lambda response payload as info output.
When the DevX team are comfortable in opening up the lambda-invoke
deployment type to the department it should be as simple as uncommenting: https://github.com/guardian/riff-raff/blob/5dd93b0abeb8d1d3bba8162bdab535677b3e656f/riff-raff/app/AppComponents.scala#L89
How to test
- Deploy this branch to
riff-raff
CODE. - Deploy
braze-version-control-TEST
and observe the deployment detail, e.g. https://riffraff.code.dev-gutools.co.uk/deployment/view/37d754a2-8920-477b-93cd-d84df7b728a0?verbose=1
How can we measure success?
This allows developers to make changes in Braze with all the confidence of version control, PRs and automated deployments that they are familiar with from all other development at The Guardian.