Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2ee33b5

Browse filesBrowse files
committed
Add java8.al2 runtime
1 parent 9b895e3 commit 2ee33b5
Copy full SHA for 2ee33b5

File tree

Expand file treeCollapse file tree

17 files changed

+227
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

17 files changed

+227
-4
lines changed
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboardExpand all lines: .gitignore
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ base/diff-2
88
base/tar-find-layer/layer.zip
99
base/dump-java8/bin
1010
base/dump-java8/build
11+
base/dump-java8al2/bin
12+
base/dump-java8al2/build
1113
base/dump-java11/bin
1214
base/dump-java11/build
1315
base/dump-dotnetcore20/bin
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ These follow the Lambda runtime names:
310310
- `ruby2.5`
311311
- `ruby2.7`
312312
- `java8`
313+
- `java8.al2`
313314
- `java11`
314315
- `go1.x`
315316
- `dotnetcore2.0`
@@ -328,6 +329,7 @@ These follow the Lambda runtime names:
328329
- `build-ruby2.5`
329330
- `build-ruby2.7`
330331
- `build-java8`
332+
- `build-java8.al2`
331333
- `build-java11`
332334
- `build-go1.x`
333335
- `build-dotnetcore2.0`
Collapse file

‎base/dump-java8/.settings/org.eclipse.buildship.core.prefs‎

Copy file name to clipboardExpand all lines: base/dump-java8/.settings/org.eclipse.buildship.core.prefs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
arguments=
22
auto.sync=false
33
build.scans.enabled=false
4-
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0-20191016123526+0000))
4+
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
55
connection.project.dir=
66
eclipse.preferences.version=1
77
gradle.user.home=
Collapse file

‎base/dump-java8al2/.classpath‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="bin/main" path="src/main/java">
4+
<attributes>
5+
<attribute name="gradle_scope" value="main"/>
6+
<attribute name="gradle_used_by_scope" value="main,test"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
10+
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
11+
<classpathentry kind="output" path="bin/default"/>
12+
</classpath>
Collapse file

‎base/dump-java8al2/.project‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>dump-java8</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22+
</natures>
23+
</projectDescription>
Collapse file
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
arguments=
2+
auto.sync=false
3+
build.scans.enabled=false
4+
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
5+
connection.project.dir=
6+
eclipse.preferences.version=1
7+
gradle.user.home=
8+
java.home=
9+
jvm.arguments=
10+
offline.mode=false
11+
override.workspace.settings=true
12+
show.console.view=true
13+
show.executions.view=true
Collapse file
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
Collapse file
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=disabled
8+
org.eclipse.jdt.core.compiler.source=1.8
Collapse file

‎base/dump-java8al2/build.gradle‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apply plugin: 'java'
2+
3+
sourceCompatibility = '1.8'
4+
targetCompatibility = '1.8'
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
implementation (
12+
'com.amazonaws:aws-lambda-java-core:1.2.0',
13+
'com.amazonaws:aws-lambda-java-events:2.2.7',
14+
'com.amazonaws:aws-java-sdk-s3:1.11.681'
15+
)
16+
}
17+
18+
task buildZip(type: Zip) {
19+
from compileJava
20+
from processResources
21+
into('lib') {
22+
from configurations.runtimeClasspath
23+
}
24+
}
25+
26+
build.dependsOn buildZip
27+
28+
// docker run --rm -v "$PWD":/app -w /app gradle:jdk8 gradle build
Collapse file
+88Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package org.lambci.lambda;
2+
3+
import java.io.File;
4+
import java.io.IOException;
5+
import java.lang.InterruptedException;
6+
import java.lang.management.ManagementFactory;
7+
import java.nio.file.Files;
8+
import java.nio.file.Paths;
9+
import java.util.Map;
10+
import java.util.Scanner;
11+
12+
import com.amazonaws.services.lambda.runtime.Context;
13+
import com.amazonaws.services.lambda.runtime.RequestHandler;
14+
import com.amazonaws.services.s3.AmazonS3;
15+
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
16+
import com.amazonaws.services.s3.model.CannedAccessControlList;
17+
import com.amazonaws.services.s3.model.PutObjectRequest;
18+
import com.amazonaws.services.s3.model.PutObjectResult;
19+
20+
public class DumpJava8 implements RequestHandler<Object, PutObjectResult> {
21+
22+
@Override
23+
public PutObjectResult handleRequest(Object input, Context context) {
24+
String filename = "java8.al2.tgz";
25+
String cmd = "tar -cpzf /tmp/" + filename + " --numeric-owner --ignore-failed-read /var/runtime /var/lang";
26+
AmazonS3 s3client = AmazonS3ClientBuilder.standard().withRegion("us-east-1").build();
27+
28+
System.out.println(ManagementFactory.getRuntimeMXBean().getInputArguments().toString());
29+
System.out.println(System.getProperty("sun.java.command"));
30+
System.out.println(System.getProperty("java.home"));
31+
System.out.println(System.getProperty("java.library.path"));
32+
System.out.println(System.getProperty("java.class.path"));
33+
System.out.println(System.getProperty("user.dir"));
34+
System.out.println(System.getProperty("user.home"));
35+
System.out.println(System.getProperty("user.name"));
36+
System.out.println(new File(".").getAbsolutePath());
37+
Map<String, String> env = System.getenv();
38+
for (String envName : env.keySet()) {
39+
System.out.println(envName + "=" + env.get(envName));
40+
}
41+
42+
try {
43+
int pid = Integer.parseInt(new File("/proc/self").getCanonicalFile().getName());
44+
45+
System.out.println("Parent cmdline:");
46+
System.out.println(new String(Files.readAllBytes(Paths.get("/proc/1/cmdline"))).replace("\0", " "));
47+
48+
System.out.println("Parent env:");
49+
runShell("xargs --null --max-args=1 < /proc/1/environ");
50+
51+
System.out.println("This cmdline:");
52+
System.out.println(new String(Files.readAllBytes(Paths.get("/proc/" + pid + "/cmdline"))).replace("\0", " "));
53+
54+
System.out.println("This env:");
55+
runShell("xargs --null --max-args=1 < /proc/" + pid + "/environ");
56+
57+
if (runShell(cmd) != 0) {
58+
return null;
59+
}
60+
61+
System.out.println("Zipping done! Uploading...");
62+
63+
return s3client.putObject(new PutObjectRequest("lambci", "fs/" + filename, new File("/tmp/" + filename))
64+
.withCannedAcl(CannedAccessControlList.PublicRead));
65+
} catch (Exception e) {
66+
throw new RuntimeException(e);
67+
}
68+
}
69+
70+
public static int runShell(String cmd) throws IOException, InterruptedException {
71+
Process process = Runtime.getRuntime().exec(new String[] { "sh", "-c", cmd });
72+
73+
try (Scanner stdoutScanner = new Scanner(process.getInputStream());
74+
Scanner stderrScanner = new Scanner(process.getErrorStream())) {
75+
// Echo all stdout first
76+
while (stdoutScanner.hasNextLine()) {
77+
System.out.println(stdoutScanner.nextLine());
78+
}
79+
// Then echo stderr
80+
while (stderrScanner.hasNextLine()) {
81+
System.err.println(stderrScanner.nextLine());
82+
}
83+
}
84+
85+
process.waitFor();
86+
return process.exitValue();
87+
}
88+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.