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

[chore] Build and publish application hosted in the repository for the Java instrumentation E2E test #2094

Merged
merged 16 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
with:
language: golang
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
java:
uses: ./.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml
with:
language: java
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
apache-httpd:
uses: ./.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml
with:
Expand Down
23 changes: 23 additions & 0 deletions tests/instrumentation-e2e-apps/java/DemoApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@SpringBootApplication
public class DemoApplication {

@RequestMapping("/")
String home() {
return "Hello World!";
}

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

}
jaronoff97 marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions tests/instrumentation-e2e-apps/java/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM --platform=$BUILDPLATFORM eclipse-temurin:17-jdk-focal as builder

RUN apt update
RUN apt install zip unzip -y

RUN mkdir /app

# In some archs, there could be probems setting the executable permissions
RUN mkdir /app/.gradle
RUN chmod -R +x /root/

RUN curl -s "https://get.sdkman.io" | bash
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install springboot && spring init /app"

WORKDIR /app
COPY DemoApplication.java /app/src/main/java/com/example/app/
COPY build.gradle .
RUN ./gradlew bootJar --no-daemon

FROM eclipse-temurin:17.0.8.1_1-jre

COPY --from=builder /app/build/libs/app-0.0.1-SNAPSHOT.jar .
ENTRYPOINT ["java", "-jar", "app-0.0.1-SNAPSHOT.jar"]
25 changes: 25 additions & 0 deletions tests/instrumentation-e2e-apps/java/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.3'
id 'io.spring.dependency-management' version '1.1.3'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-web-test'
}

tasks.named('test') {
useJUnitPlatform()
}
Loading