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

Support testing package publishing workflows in forks #13153

Merged
merged 1 commit into from
Feb 3, 2025
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
6 changes: 4 additions & 2 deletions smoke-tests/images/early-jdk8/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ tasks {
from("Dockerfile")
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"
Copy link
Member Author

Choose a reason for hiding this comment

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

defaulting isn't needed in CI, but added in case someone is testing publishing locally with their own credentials(?) or maybe that's not good and I should just not default?

Copy link
Member Author

Choose a reason for hiding this comment

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

I realized these tags are also used when just building local docker image, so makes sense to keep the defaults I think


val imageBuild by registering(DockerBuildImage::class) {
dependsOn(imagePrepare)
inputDir.set(dockerWorkingDir)

images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:$extraTag")
images.add("ghcr.io/$repo/smoke-test-zulu-openjdk-8u31:$extraTag")
dockerFile.set(dockerWorkingDir.get().file("Dockerfile"))
}

val dockerPush by registering(DockerPushImage::class) {
group = "publishing"
description = "Push all Docker images"
dependsOn(imageBuild)
images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:$extraTag")
images.add("ghcr.io/$repo/smoke-test-zulu-openjdk-8u31:$extraTag")
}
}
10 changes: 7 additions & 3 deletions smoke-tests/images/fake-backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ dependencies {
val extraTag = findProperty("extraTag")
?: DateTimeFormatter.ofPattern("yyyyMMdd.HHmmSS").format(LocalDateTime.now())

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

jib {
from.image = "gcr.io/distroless/java-debian10:11"
to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:$extraTag"
to.image = "ghcr.io/$repo/smoke-test-fake-backend:$extraTag"
}

// windows containers are built manually since jib does not support windows containers yet
Expand Down Expand Up @@ -53,18 +55,20 @@ tasks {
}
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

val windowsBackendImageBuild by registering(DockerBuildImage::class) {
dependsOn(windowsBackendImagePrepare)
inputDir.set(backendDockerBuildDir)

images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:$extraTag")
images.add("ghcr.io/$repo/smoke-test-fake-backend-windows:$extraTag")
dockerFile.set(File(backendDockerBuildDir.get().asFile, "windows.dockerfile"))
}

val dockerPush by registering(DockerPushImage::class) {
group = "publishing"
description = "Push all Docker images for the test backend"
dependsOn(windowsBackendImageBuild)
images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:$extraTag")
images.add("ghcr.io/$repo/smoke-test-fake-backend-windows:$extraTag")
}
}
4 changes: 3 additions & 1 deletion smoke-tests/images/grpc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

jib {
from.image = "eclipse-temurin:$targetJDK"
to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-grpc:jdk$targetJDK-$tag"
to.image = "ghcr.io/$repo/smoke-test-grpc:jdk$targetJDK-$tag"
}
4 changes: 3 additions & 1 deletion smoke-tests/images/play/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

jib {
from.image = "eclipse-temurin:$targetJDK"
to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-play:jdk$targetJDK-$tag"
to.image = "ghcr.io/$repo/smoke-test-play:jdk$targetJDK-$tag"
container.mainClass = "play.core.server.ProdServerStart"
}
4 changes: 3 additions & 1 deletion smoke-tests/images/quarkus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

jib {
from.image = "eclipse-temurin:$targetJDK"
to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk$targetJDK-$tag"
to.image = "ghcr.io/$repo/smoke-test-quarkus:jdk$targetJDK-$tag"
container {
mainClass = "bogus" // to suppress Jib warning about missing main class
}
Expand Down
4 changes: 3 additions & 1 deletion smoke-tests/images/security-manager/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

jib {
from.image = "openjdk:$targetJDK"
to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-security-manager:jdk$targetJDK-$tag"
to.image = "ghcr.io/$repo/smoke-test-security-manager:jdk$targetJDK-$tag"
container.mainClass = "io.opentelemetry.smoketest.securitymanager.Main"
container.jvmFlags = listOf("-Djava.security.manager", "-Djava.security.policy=/app/resources/security.policy")
}
3 changes: 2 additions & 1 deletion smoke-tests/images/servlet/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ fun configureImage(
}
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"
val vmSuffix = if (vm == "hotspot") "" else "-$vm"
val image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-$server:$version-jdk$jdk$vmSuffix$platformSuffix-$extraTag"
val image = "ghcr.io/$repo/smoke-test-servlet-$server:$version-jdk$jdk$vmSuffix$platformSuffix-$extraTag"

val jdkImage = if (vm == "hotspot") {
if (jdk == "24") {
Expand Down
4 changes: 3 additions & 1 deletion smoke-tests/images/spring-boot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ springBoot {
}
}

val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"

jib {
from.image = "openjdk:$targetJDK"
to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk$targetJDK-$tag"
to.image = "ghcr.io/$repo/smoke-test-spring-boot:jdk$targetJDK-$tag"
container.ports = listOf("8080")
}

Expand Down