Skip to content

Commit 19657f1

Browse files
authored
Make examples/instrumentation-quickstart a standalone gradle build (#289)
1 parent 0d70bb1 commit 19657f1

13 files changed

Lines changed: 440 additions & 641 deletions

File tree

examples/instrumentation-quickstart/.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/instrumentation-quickstart/Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,16 @@
1414

1515
# Adapted from https://spring.io/guides/topicals/spring-boot-docker/#_multi_stage_build
1616
# syntax=docker/dockerfile:experimental
17-
FROM eclipse-temurin:17.0.9_9-jdk-alpine as build
17+
FROM eclipse-temurin:17-jdk-alpine AS build
1818
WORKDIR /workspace/app
1919

20-
COPY mvnw .
21-
COPY .mvn .mvn
22-
COPY pom.xml .
23-
COPY src src
20+
COPY . /workspace/app
21+
RUN --mount=type=cache,target=/root/.gradle ./gradlew clean build
22+
RUN mkdir -p build/dependency && (cd build/dependency; jar -xf ../libs/*-SNAPSHOT.jar)
2423

25-
RUN --mount=type=cache,target=/root/.m2 ./mvnw install -DskipTests
26-
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
27-
28-
FROM eclipse-temurin:17.0.9_9-jdk-alpine
24+
FROM eclipse-temurin:17-jdk-alpine
2925
VOLUME /tmp
30-
ARG DEPENDENCY=/workspace/app/target/dependency
26+
ARG DEPENDENCY=/workspace/app/build/dependency
3127
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
3228
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
3329
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
id 'java'
19+
id 'org.springframework.boot' version '2.7.18'
20+
id 'io.spring.dependency-management' version '1.1.4'
21+
}
22+
23+
group = 'com.example'
24+
version = '0.0.1-SNAPSHOT'
25+
description = 'OpenTelemetry instrumentation quickstart using Spring Boot'
26+
27+
repositories {
28+
mavenCentral()
29+
}
30+
31+
dependencies {
32+
implementation 'org.springframework.boot:spring-boot-starter-webflux'
33+
34+
// Cannot be updated until logback is updated to 1.3+, probably in the next Spring Boot
35+
// major version
36+
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
37+
38+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
39+
testImplementation 'org.testcontainers:testcontainers:1.19.4'
40+
testImplementation 'com.google.truth:truth:1.4.0'
41+
testImplementation "org.testcontainers:junit-jupiter:1.19.4"
42+
}
43+
44+
tasks.named('test') {
45+
useJUnitPlatform {
46+
// Individual integration tests are annotated with @Tag('integrationTest')
47+
excludeTags 'integrationTest'
48+
}
49+
}
50+
51+
tasks.register("integrationTest", Test) {
52+
useJUnitPlatform {
53+
includeTags 'integrationTest'
54+
}
55+
}
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

examples/instrumentation-quickstart/gradlew

Lines changed: 249 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)