Skip to content

Commit 6d0f85a

Browse files
authored
Merge branch 'main' into declarative-config-improvements
2 parents 7375716 + a9a330a commit 6d0f85a

File tree

7 files changed

+69
-5
lines changed

7 files changed

+69
-5
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ jobs:
100100
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
101101
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
102102
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
103-
run: ./gradlew assemble spdxSbom publishToSonatype closeAndReleaseSonatypeStagingRepository
103+
# run: ./gradlew assemble spdxSbom publishToSonatype closeAndReleaseSonatypeStagingRepository
104+
run: ./gradlew assemble spdxSbom publishAllPublicationToReleaseRepoRepository generateReleaseBundle uploadReleaseBundle
104105

105106
- name: Build and publish gradle plugins
106107
env:

benchmark-overhead/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies {
2222
testImplementation("org.testcontainers:postgresql:1.21.3")
2323
testImplementation("org.junit.jupiter:junit-jupiter-api")
2424
testImplementation("org.junit.jupiter:junit-jupiter-params")
25-
testImplementation("com.squareup.okhttp3:okhttp:5.0.0")
25+
testImplementation("com.squareup.okhttp3:okhttp:5.1.0")
2626
testImplementation("org.jooq:joox:2.0.1")
2727
testImplementation("com.jayway.jsonpath:json-path:2.9.0")
2828
testImplementation("org.slf4j:slf4j-simple:2.0.17")

build.gradle.kts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
import okhttp3.MediaType.Companion.toMediaType
2+
import okhttp3.OkHttpClient
3+
import okhttp3.RequestBody.Companion.asRequestBody
14
import java.time.Duration
5+
import java.util.Base64
26

37
plugins {
48
id("idea")
@@ -16,6 +20,12 @@ plugins {
1620
id("org.graalvm.buildtools.native") apply false
1721
}
1822

23+
buildscript {
24+
dependencies {
25+
classpath("com.squareup.okhttp3:okhttp:5.1.0")
26+
}
27+
}
28+
1929
apply(from = "version.gradle.kts")
2030

2131
nexusPublishing {
@@ -111,6 +121,8 @@ if (gradle.startParameter.taskNames.contains("listTestsInPartition")) {
111121
}
112122

113123
tasks {
124+
val stableVersion = version.toString().replace("-alpha", "")
125+
114126
val generateFossaConfiguration by registering {
115127
group = "Help"
116128
description = "Generate .fossa.yml configuration file"
@@ -141,4 +153,48 @@ tasks {
141153
}
142154
}
143155
}
156+
157+
val generateReleaseBundle by registering(Zip::class) {
158+
dependsOn(getTasksByName("publishAllPublicationToReleaseRepoRepository", true))
159+
from("releaseRepo")
160+
161+
exclude("**/maven-metadata.*")
162+
duplicatesStrategy = DuplicatesStrategy.FAIL
163+
includeEmptyDirs = false
164+
archiveFileName.set("release-bundle-$stableVersion.zip")
165+
}
166+
167+
val uploadReleaseBundle by registering {
168+
dependsOn(generateReleaseBundle)
169+
170+
val bundle = generateReleaseBundle.get().outputs.files.singleFile
171+
val httpClient = OkHttpClient()
172+
val username = System.getenv("SONATYPE_USER") ?: throw GradleException("Sonatype user not set")
173+
val password = System.getenv("SONATYPE_KEY") ?: throw GradleException("Sonatype key not set")
174+
val token = Base64.getEncoder().encodeToString("$username:$password".toByteArray())
175+
176+
var query = "?name=opentelemetry-java-instrumentation-$stableVersion"
177+
// uncomment to automatically publish the release
178+
// query += "&publishingType=AUTOMATIC"
179+
180+
val request = okhttp3.Request.Builder()
181+
.url("https://central.sonatype.com/api/v1/publisher/upload$query")
182+
.post(
183+
okhttp3.MultipartBody.Builder().addFormDataPart(
184+
"bundle",
185+
bundle.name,
186+
bundle.asRequestBody("application/zip".toMediaType())
187+
).build()
188+
)
189+
.header("authorization", "Bearer $token")
190+
.build()
191+
httpClient.newCall(request).execute().use { response ->
192+
response.body!!.string()
193+
}
194+
195+
httpClient.newCall(request).execute().use { response ->
196+
if (response.code != 201) throw GradleException("Unexpected response status ${response.code} while uploading the release bundle")
197+
println("Uploaded deployment ${response.body!!.string()}")
198+
}
199+
}
144200
}

conventions/src/main/kotlin/otel.publish-conventions.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ publishing {
6565
}
6666
}
6767
}
68+
69+
repositories {
70+
maven {
71+
name = "ReleaseRepo"
72+
url = File(project.rootDir.path, "releaseRepo").toURI()
73+
}
74+
}
6875
}
6976

7077
fun artifactPrefix(p: Project, archivesBaseName: String): String {

examples/distro/instrumentation/servlet-3/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies {
2727
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
2828
}
2929

30-
testImplementation "com.squareup.okhttp3:okhttp:5.0.0"
30+
testImplementation "com.squareup.okhttp3:okhttp:5.1.0"
3131
testImplementation "javax.servlet:javax.servlet-api:3.0.1"
3232
testImplementation "org.eclipse.jetty:jetty-server:8.2.0.v20160908"
3333
testImplementation "org.eclipse.jetty:jetty-servlet:8.2.0.v20160908"

examples/distro/smoke-tests/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies {
66
testImplementation("org.testcontainers:testcontainers:1.21.3")
77
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.19.1")
88
testImplementation("com.google.protobuf:protobuf-java-util:4.31.1")
9-
testImplementation("com.squareup.okhttp3:okhttp:5.0.0")
9+
testImplementation("com.squareup.okhttp3:okhttp:5.1.0")
1010
testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.7.0-alpha")
1111
testImplementation("io.opentelemetry:opentelemetry-api")
1212

examples/extension/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ dependencies {
100100
testImplementation("org.testcontainers:testcontainers:1.21.3")
101101
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.19.1")
102102
testImplementation("com.google.protobuf:protobuf-java-util:4.31.1")
103-
testImplementation("com.squareup.okhttp3:okhttp:5.0.0")
103+
testImplementation("com.squareup.okhttp3:okhttp:5.1.0")
104104
testImplementation("io.opentelemetry:opentelemetry-api")
105105
testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.7.0-alpha")
106106

0 commit comments

Comments
 (0)