Skip to content
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 java11 #102

Closed
wants to merge 26 commits into from
Closed

Upgrade to java11 #102

wants to merge 26 commits into from

Conversation

lindseydew
Copy link
Contributor

@lindseydew lindseydew commented Feb 29, 2024

What does this change?

This upgrades the lambdas that serve the Save For Later functionality from Java8 to Java11

How to test

Tested Save for Later on CODE:

  • Can get articles
  • Can post articles

Tested User Deletion CODE:

  • Delete a user account and see that this is deleted from Save For Later

Note I wasn't able to test the full interaction on CODE as I have been unable to find the exact string the app is expecting to parse. I think the json parsing logic needs a bit of an update too, so I'll make a note to do that and this should make it possible to test an example event.

For now, we have alarms set up on PROD if the delete interaction is unable to complete.

How can we measure success?

Have we considered potential risks?

Images

Accessibility

val jacksonDataFormat =
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % jacksonVersion
val jacksonJdk8DataType =
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % jacksonVersion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be removed

@mchv
Copy link
Member

mchv commented Mar 1, 2024

@lindseydew I noticed a few additional changes linked to this upgrade which I have directly added as additional commits..but the build is now breaking 😢! I think this is because sbt-assembly had changed its API, and it should not be too hard to fix existing file using documentation (but I have not done it!).

Anyway once this is fixed, the upgrade to java 21 should be straightforward as it supported by latest scala 2.12.x and sbt 1.9.9, and so require only a few changes.

@lindseydew
Copy link
Contributor Author

@lindseydew I noticed a few additional changes linked to this upgrade which I have directly added as additional commits..but the build is now breaking 😢! I think this is because sbt-assembly had changed its API, and it should not be too hard to fix existing file using documentation (but I have not done it!).

Anyway once this is fixed, the upgrade to java 21 should be straightforward as it supported by latest scala 2.12.x and sbt 1.9.9, and so require only a few changes.

Great thank you, I'll take a look at the build

@@ -0,0 +1,84 @@
# This AWS SAM template has been generated from your function's configuration. If
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it the cloudformation for mobile-save-for-later? Why do we need this one when there is "conf/cfn.yaml"?

@@ -0,0 +1,97 @@
# This AWS SAM template has been generated from your function's configuration. If
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CDK is used to define the cloudformation stack for this service? Is it used for another purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we are using the CDK for the cfn stack definition. This is used to be able to run the lambda functions locally using aws sam. Instructions here: https://github.com/guardian/mobile-save-for-later/pull/102/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R86

case "META-INF/MANIFEST.MF" => MergeStrategy.discard
case "META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat" =>
new MergeFilesStrategy
case PathList(ps @ _*) if ps.last equalsIgnoreCase "Log4j2Plugins.dat" =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may have explained this in our snyk session, but I am not sure why we change the implementation of merge strategy here? The previous one does not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was getting an error with instantiating the MergeFilesStrategy class.

Copy link
Contributor

@waisingyiu waisingyiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the great work, I am happy to approve.

As an aside, I suppose that I need a docker desktop license if I want to run this service locally? (I see your name on the docker desktop license spreadsheet)

Copy link
Member

@rtyley rtyley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only quickly skimmed through the diff of this PR, as I'm a bit short of time today!

I think the diff might be a bit bigger than it needs to be, I think because scalafmt formatting changes are being included - that makes it a bit harder to concentrate on the significant code changes? If scalafmt is desired, it might be worth doing a separate scalafmt PR and then rebasing this one on top of that.

@lindseydew, you suggested that maybe should merge this PR, and then merge #105, which is understandable because #105 talks about Java 21, and this PR is for Java 11!

However, #105 only allows mobile-save-for-later to build under Java 21, doesn't require it, and doesn't even attempt to update mobile-save-for-later up from Java 8 - consequently, it's a much smaller PR, easier to review, and therefore, I would say, much lower risk!

So personally, I would prefer to merge #105 immediately, and then look at rebasing this PR on top of main - maybe even separating out a scalafmt run into it's own PR first. I'd be really happy to pair tomorrow on those stages of the operation if that would help?

build.sbt Show resolved Hide resolved
@lindseydew
Copy link
Contributor Author

I've only quickly skimmed through the diff of this PR, as I'm a bit short of time today!

I think the diff might be a bit bigger than it needs to be, I think because scalafmt formatting changes are being included - that makes it a bit harder to concentrate on the significant code changes? If scalafmt is desired, it might be worth doing a separate scalafmt PR and then rebasing this one on top of that.

@lindseydew, you suggested that maybe should merge this PR, and then merge #105, which is understandable because #105 talks about Java 21, and this PR is for Java 11!

However, #105 only allows mobile-save-for-later to build under Java 21, doesn't require it, and doesn't even attempt to update mobile-save-for-later up from Java 8 - consequently, it's a much smaller PR, easier to review, and therefore, I would say, much lower risk!

So personally, I would prefer to merge #105 immediately, and then look at rebasing this PR on top of main - maybe even separating out a scalafmt run into it's own PR first. I'd be really happy to pair tomorrow on those stages of the operation if that would help?

Ok sounds good. Yes I'm happy for you to merge your branch first. Agree with separating the PR. A pairing session would be great. When would you be free?

@lindseydew lindseydew force-pushed the ld/upgrade-to-java11 branch from a340321 to f115e24 Compare March 20, 2024 09:46
Co-authored-by: Roberto Tyley <[email protected]>
@lindseydew
Copy link
Contributor Author

Closing because this has been superseded by subsequent PRs: #106 and #107

@lindseydew lindseydew closed this Mar 25, 2024
@lindseydew lindseydew mentioned this pull request Mar 28, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants