lambda
Used in:
components
- OverviewOverview
- VersionsVersions
- DependentsDependents
- DependenciesDependencies
<dependency>
<groupId>io.github.solven-eu.cleanthat</groupId>
<artifactId>lambda</artifactId>
<version>2.25</version>
</dependency><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.solven-eu.cleanthat</groupId>
<artifactId>aggregator-cleanthat</artifactId>
<version>2.25</version>
</parent>
<artifactId>lambda</artifactId>
<!-- `name` is required by Sonatype-->
<name>${project.groupId}:${project.artifactId}</name>
<properties>
<!-- <wrapper.version>1.0.17.RELEASE</wrapper.version> -->
<maven.deploy.skip>true</maven.deploy.skip>
<!-- The equivalent property for nexus-staging-maven-plugin -->
<!-- https://github.com/sonatype/nexus-maven-plugins/blob/main/staging/maven-plugin/README.md -->
<!-- Useless with central-publishing-maven-plugin? -->
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</properties>
<dependencies>
<dependency>
<groupId>io.github.solven-eu.cleanthat</groupId>
<artifactId>runnable</artifactId>
<version>${project.version}</version>
<exclusions>
<!-- Scala is big, and it overweight the JAR with respect to AWS constrains. -->
<!-- To be re-incroporated when each language is processed by its own Lambda -->
<exclusion>
<groupId>io.github.solven-eu.cleanthat</groupId>
<artifactId>scala</artifactId>
</exclusion>
<exclusion>
<!-- Scala is big, and it overweight the JAR with respect to AWS constrains. -->
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-embeddable</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-aws</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.3</version>
<!-- TODO Why provided? -->
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-dynamodb -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<!-- Else failure in SimpleFunctionRegistry$FunctionInvocationWrapper.isJson(SimpleFunctionRegistry.java:850) -->
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20240303</version>
</dependency>
<dependency>
<!-- Used to trigger Lambda from Lambda -->
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-lambda</artifactId>
</dependency>
<dependency>
<!--Notify Marketplace events -->
<groupId>com.github.seratch</groupId>
<artifactId>jslack-api-client</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<!-- https://cloud.spring.io/spring-cloud-static/spring-cloud-function/2.1.1.RELEASE/spring-cloud-function.html#_comparing_functional_with_traditional_bean_definitions -->
<!-- It seems we need this to open an actual HTTP server for the Function -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-web</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.solven-eu.cleanthat</groupId>
<artifactId>test-helpers</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<!-- standalone looks better at it seems necessary to start the servers lazily -->
<artifactId>wiremock-jre8-standalone</artifactId>
<version>2.35.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- https://github.com/spring-cloud/spring-cloud-function/blob/master/spring-cloud-function-samples/function-sample-aws/pom.xml -->
<build>
<plugins>
<plugin>
<!-- https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-git-info -->
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>aws</shadedClassifierName>
</configuration>
<dependencies>
<dependency>
<!-- https://stackoverflow.com/questions/51521953/how-to-use-propertiesmergingresourcetransformer-of-maven-shade-plugin-when-add -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.18</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>shadeFatJar</id>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<resource>META-INF/spring.factories</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>eu.solven.cleanthat.lambda.CleanThatWebhookLambdaFunction</mainClass>
</transformer>
<!-- We exclude some resources to fit the 144MB constrains on Lambda -->
<!-- https://stackoverflow.com/questions/45342990/aws-lambda-error-unzipped-size-must-be-smaller-than-262144000-bytes -->
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
<resources>
<resource>.dll</resource>
<resource>.a</resource>
<resource>.so</resource>
<resource>.jnilib</resource>
<resource>.ttf</resource>
<resource>.woff</resource>
</resources>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!-- mvn package lambda:deploy-lambda -->
<!-- mvn lambda:deploy-lambda -->
<!-- GITHUB_APP_PRIVATE_JWK=XXX -->
<!-- https://github.com/equodev/equo-ide/issues/146 about -DlockFileGenerousTimeout=true -->
<!-- JAVA_TOOL_OPTIONS=-Duser.home=/tmp/cleanthat/user_home -Dcleanthat-spotless-m2repository=/tmp/cleanthat/spotless/.m2/repository -DlockFileGenerousTimeout=true -->
<plugin>
<!-- https://github.com/SeanRoy/lambda-maven-plugin -->
<groupId>com.github.seanroy</groupId>
<artifactId>lambda-maven-plugin</artifactId>
<!-- https://github.com/SeanRoy/lambda-maven-plugin/issues/104 -->
<!-- https://github.com/SeanRoy/lambda-maven-plugin/issues/117 -->
<version>2.3.5</version>
<!-- IAM configuration is described here: https://github.com/SeanRoy/lambda-maven-plugin#credentials -->
<configuration>
<functionCode>${project.build.directory}/${project.build.finalName}-aws.jar</functionCode>
<version>${project.version}</version>
<alias>development</alias>
<!-- Used to deploy different versions for different eclipse -->
<functionNameSuffix>${lambda.functionNameSuffix}</functionNameSuffix>
<!-- https://console.aws.amazon.com/iam/home#/roles/cleanthat-lambda-role -->
<lambdaRoleArn>arn:aws:iam::144657973876:role/cleanthat-lambda-role</lambdaRoleArn>
<!-- olapless-us-east-1-unittests -->
<s3Bucket>olapless-lambda-us-east-1</s3Bucket>
<runtime>java17</runtime>
<publish>true</publish>
<forceUpdate>true</forceUpdate>
<lambdaFunctions>
<lambdaFunction>
<functionName>checkEventIsRelevant</functionName>
<handler>eu.solven.cleanthat.lambda.step0_checkwebhook.CheckWebhooksHandler</handler>
<!-- MB -->
<memorySize>512</memorySize>
<!-- Startup can take up to 30 seconds -->
<!-- Filtering for valid webhook should be quite fast -->
<timeout>60</timeout>
<triggers>
<trigger>
<enabled>true</enabled>
<integration>SQS</integration>
<standardQueue>FromGithub</standardQueue>
</trigger>
</triggers>
</lambdaFunction>
<lambdaFunction>
<functionName>checkRepositoryIsConfigured</functionName>
<handler>eu.solven.cleanthat.lambda.step1_checkconfiguration.CheckConfigWebhooksHandler</handler>
<!-- MB -->
<memorySize>512</memorySize>
<!-- Startup can take up to 30 seconds -->
<timeout>90</timeout>
<triggers>
<trigger>
<enabled>true</enabled>
<integration>DynamoDB</integration>
<dynamoDBTable>cleanthat_webhooks_github</dynamoDBTable>
<batchSize>100</batchSize>
<!-- https://stackoverflow.com/questions/38280958/dynamodb-triggers-streams-lambda-details-on-trim-horizon -->
<!-- https://github.com/awslabs/amazon-kinesis-client/issues/327 -->
<startingPosition>TRIM_HORIZON</startingPosition>
</trigger>
</triggers>
</lambdaFunction>
<lambdaFunction>
<functionName>cleanGivenConfiguration</functionName>
<handler>eu.solven.cleanthat.lambda.step2_executeclean.ExecuteCleaningWebhooksHandler</handler>
<!-- MB -->
<!-- We encounter a lot of Metaspace OutOfMemoryError with 512M -->
<!-- https://stackoverflow.com/questions/35298616/aws-lambda-and-inaccurate-memory-allocation -->
<memorySize>1024</memorySize>
<!-- Startup can take up to 30 seconds -->
<!-- Repo cloning can take minutes -->
<timeout>300</timeout>
<triggers>
<trigger>
<enabled>true</enabled>
<integration>DynamoDB</integration>
<dynamoDBTable>cleanthat_accepted_events</dynamoDBTable>
<batchSize>100</batchSize>
<!-- https://stackoverflow.com/questions/38280958/dynamodb-triggers-streams-lambda-details-on-trim-horizon -->
<!-- https://github.com/awslabs/amazon-kinesis-client/issues/327 -->
<startingPosition>TRIM_HORIZON</startingPosition>
</trigger>
</triggers>
</lambdaFunction>
</lambdaFunctions>
</configuration>
</plugin>
</plugins>
</build>
</project>