-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Scanamo v1.1.1 #1351
Conversation
Here we're moving up from Scanamo [1.0.0-M11](https://github.com/scanamo/scanamo/releases/tag/v1.0.0-M11) to [1.1.1](https://github.com/scanamo/scanamo/releases/tag/v1.1.1), which involves several changes to requirements: * AWS SDK v1 → v2 - Scanamo [1.0-M13](https://github.com/scanamo/scanamo/releases/tag/v1.0-M13) and above require AWS SDK v2. AWS SDK v2 is actually used quite widely already in Riff Raff, so this wasn't hard - there does still seem to be _some_ other code in Riff Raff using AWS SDK v1 at the moment. * Scanamo API changes: - Auto-generated `DynamoFormat` handlers are now created with `org.scanamo.generic.auto._` rather than `org.scanamo.auto._` (scanamo/scanamo#538 - [1.0-M12](https://github.com/scanamo/scanamo/releases/tag/v1.0.0-M12)) - `DynamoFormat.coercedXmap()` now has a single set of two arguments, rather than curried arguments (scanamo/scanamo#588 - [1.0-M13](https://github.com/scanamo/scanamo/releases/tag/v1.0-M13)) - `Table.put()` now returns `Unit` rather than the old value- you can use `Table.putAndReturn()` if you want a value returned, which allows you to specify whether it's the prior value or the new one you want (scanamo/scanamo#486 - [1.0-M13](https://github.com/scanamo/scanamo/releases/tag/v1.0-M13)) See also: * guardian/media-atom-maker#1143 - upgrading to Scanamo v1.0.0-M28
Trigger.withName | ||
)(_.toString) | ||
Trigger.withName, | ||
_.toString | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DynamoFormat.coercedXmap()
now has a single set of two arguments, rather than curried arguments (due to scanamo/scanamo#588 - released with 1.0-M13)
): Option[Either[DynamoReadError, TargetId]] = | ||
): Unit = | ||
exec(table.put(TargetId(target, projectName, lastSeen))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table.put()
now returns Unit
rather than the old value- you can use Table.putAndReturn()
if you want a value returned, which allows you to specify whether it's the prior value or the new one you want (scanamo/scanamo#486 - release with 1.0-M13)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this will throw an exception if the update fails, but this seems safe given that our only usage of this function is here:
riff-raff/riff-raff/app/ci/TargetResolver.scala
Lines 57 to 59 in 295ec4b
Either.catchNonFatal( | |
t -> targetDynamoRepository.set(t, build.jobName, build.startTime) | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it would always have thrown an exception if the update fails, the difference is just that if the update succeeds, there's now no value being returned, and no chance of a DynamoReadError
representing a deserialisation error. And you're right, TargetResolver
is catching any erxception!
This was deployed to PROD as build 3392, and subsequent deploys look good: |
Here we're moving up from Scanamo 1.0.0-M11 to 1.1.1, which involves several changes to requirements:
DynamoFormat
handlers are now created withorg.scanamo.generic.auto._
rather thanorg.scanamo.auto._
(Generic derivation with Magnolia scanamo/scanamo#538 - 1.0-M12)DynamoFormat.coercedXmap()
now has a single set of two arguments, rather than curried arguments (Add DynamoFormat#{xmap,coercedXmap,iso} scanamo/scanamo#588 - 1.0-M13)Table.put()
now returnsUnit
rather than the old value- you can useTable.putAndReturn()
if you want a value returned, which allows you to specify whether it's the prior value or the new one you want (AddputAndReturn
, useUnit
as return type scanamo/scanamo#486 - 1.0-M13)See also: