Skip to content

Commit 65188f5

Browse files
committed
Merge branch 'main' into kn-main-merge
2 parents e425de3 + 8db1eda commit 65188f5

File tree

13 files changed

+84
-33
lines changed

13 files changed

+84
-33
lines changed

.brazil.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"software.amazon.smithy:smithy-waiters:1.*": "Maven-software-amazon-smithy_smithy-waiters-1.x",
2727
"software.amazon.smithy:smithy-rules-engine:1.*": "Maven-software-amazon-smithy_smithy-rules-engine-1.x",
2828
"software.amazon.smithy:smithy-smoke-test-traits:1.*": "Maven-software-amazon-smithy_smithy-smoke-test-traits-1.x",
29-
"org.jsoup:jsoup:1.19.*": "Maven-jsoup-1.19.x"
29+
"org.jsoup:jsoup:1.*": "Maven-jsoup-1.x"
3030
},
3131
"packageHandlingRules": {
3232
"versioning": {

.github/workflows/artifact-size-metrics.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
- name: Put Artifact Size Metrics in CloudWatch
4141
run: ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }}
4242
size-check:
43-
if: github.event_name == 'pull_request_target'
4443
runs-on: ubuntu-latest
4544
steps:
4645
- name: Checkout Sources

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ jobs:
184184
working-directory: ./smithy-kotlin
185185
shell: bash
186186
run: |
187-
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
188-
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
189-
./gradlew -Paws.kotlin.native=false apiCheck
190-
./gradlew -Paws.kotlin.native=false test jvmTest
191-
187+
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
188+
./gradlew apiCheck
189+
./gradlew test jvmTest
192190
- name: Save Test Reports
193191
if: failure()
194192
uses: actions/upload-artifact@v4
@@ -243,7 +241,6 @@ jobs:
243241
# smithy-kotlin is checked out as a sibling dir which will automatically make it an included build
244242
path: 'aws-sdk-kotlin'
245243
repository: 'awslabs/aws-sdk-kotlin'
246-
247244
- name: Configure Gradle - smithy-kotlin
248245
uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
249246
with:
@@ -277,4 +274,4 @@ jobs:
277274
sed -i "s/smithy-kotlin-codegen-version = .*$/smithy-kotlin-codegen-version = \"$SMITHY_KOTLIN_CODEGEN_VERSION\"/" gradle/libs.versions.toml
278275
./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal
279276
./gradlew -Paws.kotlin.native=false test jvmTest
280-
./gradlew -Paws.kotlin.native=false testAllProtocols
277+
./gradlew -Paws.kotlin.native=false testAllProtocols

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
## [1.5.4] - 08/07/2025
4+
35
## [1.5.3] - 07/28/2025
46

57
### Features

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ buildscript {
1919
https://github.com/Kotlin/dokka/issues/3472#issuecomment-1929712374
2020
https://github.com/Kotlin/dokka/issues/3194#issuecomment-1929382630
2121
*/
22-
classpath(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.19.2"))
22+
classpath(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.15.3"))
2323
}
2424
}
2525

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ kotlinx.atomicfu.enableNativeIrTransformation=false
1414
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
1515

1616
# SDK
17-
sdkVersion=1.5.4-SNAPSHOT
17+
sdkVersion=1.5.5-SNAPSHOT
1818

1919
# codegen
20-
codegenVersion=0.35.4-SNAPSHOT
20+
codegenVersion=0.35.5-SNAPSHOT
2121

2222
# FIXME Remove after Dokka 2.0 Gradle plugin is stable
2323
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ atomicfu-version = "0.29.0"
1010
okhttp-version = "5.1.0"
1111
okhttp4-version = "4.12.0"
1212
okio-version = "3.16.0"
13-
otel-version = "1.45.0"
14-
slf4j-version = "2.0.16"
13+
otel-version = "1.52.0"
14+
slf4j-version = "2.0.17"
1515
slf4j-v1x-version = "1.7.36"
1616
crt-kotlin-version = "0.10.0"
1717
micrometer-version = "1.15.2"
@@ -27,8 +27,8 @@ junit-version = "5.13.4"
2727
kotest-version = "5.9.1"
2828
kotlin-compile-testing-version = "0.8.0"
2929
kotlinx-benchmark-version = "0.4.14"
30-
kotlinx-serialization-version = "1.7.3"
31-
docker-java-version = "3.4.0"
30+
kotlinx-serialization-version = "1.9.0"
31+
docker-java-version = "3.5.3"
3232
ktor-version = "3.2.3"
3333
kaml-version = "0.55.0"
3434
jsoup-version = "1.21.1"

runtime/auth/http-auth/api/http-auth.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public abstract interface class aws/smithy/kotlin/runtime/http/auth/CloseableBea
6262
public final class aws/smithy/kotlin/runtime/http/auth/EnvironmentBearerTokenProvider : aws/smithy/kotlin/runtime/http/auth/BearerTokenProvider {
6363
public fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;)V
6464
public synthetic fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
65+
public fun <init> (Ljava/lang/String;Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;)V
66+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6567
public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
6668
}
6769

runtime/auth/http-auth/common/src/aws/smithy/kotlin/runtime/http/auth/EnvironmentBearerTokenProvider.kt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,37 @@
44
*/
55
package aws.smithy.kotlin.runtime.http.auth
66

7+
import aws.smithy.kotlin.runtime.businessmetrics.SmithyBusinessMetric
8+
import aws.smithy.kotlin.runtime.businessmetrics.emitBusinessMetric
79
import aws.smithy.kotlin.runtime.collections.Attributes
8-
import aws.smithy.kotlin.runtime.collections.emptyAttributes
10+
import aws.smithy.kotlin.runtime.collections.mutableAttributes
911
import aws.smithy.kotlin.runtime.time.Instant
1012
import aws.smithy.kotlin.runtime.util.PlatformProvider
1113

1214
/**
13-
* A [BearerTokenProvider] that extracts the bearer token from the target environment variable.
15+
* A [BearerTokenProvider] that extracts the bearer token from JVM system properties or environment variables.
1416
*/
1517
public class EnvironmentBearerTokenProvider(
16-
private val key: String,
18+
private val sysPropKey: String,
19+
private val envKey: String,
1720
private val platform: PlatformProvider = PlatformProvider.System,
1821
) : BearerTokenProvider {
22+
@Deprecated("This constructor does not support a parameter for a system property key and will be removed in version 1.6.x")
23+
public constructor(
24+
envKey: String,
25+
platform: PlatformProvider = PlatformProvider.System,
26+
) : this("", envKey, platform)
27+
1928
override suspend fun resolve(attributes: Attributes): BearerToken {
20-
val bearerToken = platform.getenv(key)
21-
?: error("$key environment variable is not set")
29+
val bearerToken = sysPropKey.takeUnless(String::isBlank)?.let(platform::getProperty)
30+
?: platform.getenv(envKey)
31+
if (bearerToken.isNullOrBlank()) throw IllegalStateException("""Missing values for system property "$sysPropKey" and environment variable "$envKey"""")
2232

2333
return object : BearerToken {
2434
override val token: String = bearerToken
25-
override val attributes: Attributes = emptyAttributes()
35+
override val attributes: Attributes = mutableAttributes().apply {
36+
emitBusinessMetric(SmithyBusinessMetric.BEARER_SERVICE_ENV_VARS)
37+
}
2638
override val expiration: Instant? = null
2739
}
2840
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package aws.smithy.kotlin.runtime.http.auth
22

3-
import aws.smithy.kotlin.runtime.collections.emptyAttributes
43
import aws.smithy.kotlin.runtime.util.TestPlatformProvider
54
import kotlinx.coroutines.test.runTest
65
import kotlin.test.Test
@@ -9,27 +8,65 @@ import kotlin.test.assertFailsWith
98

109
class EnvironmentBearerTokenProviderTest {
1110
@Test
12-
fun testResolveWithValidToken() = runTest {
11+
fun testResolveFromEnvVar() = runTest {
1312
val provider = EnvironmentBearerTokenProvider(
14-
"TEST_TOKEN",
15-
TestPlatformProvider(mutableMapOf("TEST_TOKEN" to "test-bearer-token")),
13+
"TEST_SYS_PROPS_TOKEN",
14+
"TEST_ENV_TOKEN",
15+
TestPlatformProvider(
16+
env = mapOf("TEST_ENV_TOKEN" to "test-env-bearer-token"),
17+
),
1618
)
1719

1820
val token = provider.resolve()
1921

20-
assertEquals("test-bearer-token", token.token)
22+
assertEquals("test-env-bearer-token", token.token)
23+
}
24+
25+
@Test
26+
fun testResolveFromSysProps() = runTest {
27+
val provider = EnvironmentBearerTokenProvider(
28+
"TEST_SYS_PROPS_TOKEN",
29+
"TEST_ENV_TOKEN",
30+
TestPlatformProvider(
31+
props = mapOf("TEST_SYS_PROPS_TOKEN" to "test-sys-props-bearer-token"),
32+
),
33+
)
34+
35+
val token = provider.resolve()
36+
37+
assertEquals("test-sys-props-bearer-token", token.token)
38+
}
39+
40+
@Test
41+
fun testResolutionOrder() = runTest {
42+
val provider = EnvironmentBearerTokenProvider(
43+
"TEST_SYS_PROPS_TOKEN",
44+
"TEST_ENV_TOKEN",
45+
TestPlatformProvider(
46+
props = mapOf("TEST_SYS_PROPS_TOKEN" to "test-sys-props-bearer-token"),
47+
env = mapOf("TEST_ENV_TOKEN" to "test-env-bearer-token"),
48+
),
49+
)
50+
51+
val token = provider.resolve()
52+
53+
assertEquals("test-sys-props-bearer-token", token.token)
2154
}
2255

2356
@Test
2457
fun testResolveWithMissingToken() = runTest {
2558
val provider = EnvironmentBearerTokenProvider(
2659
"MISSING_TEST_TOKEN",
27-
TestPlatformProvider(mutableMapOf()),
60+
"MISSING_TEST_TOKEN",
61+
TestPlatformProvider(
62+
env = mapOf("TEST_TOKEN" to "test-env-bearer-token"),
63+
props = mapOf("TEST_TOKEN" to "test-sys-props-bearer-token"),
64+
),
2865
)
2966

3067
val exception = assertFailsWith<IllegalStateException> {
31-
provider.resolve(emptyAttributes())
68+
provider.resolve()
3269
}
33-
assertEquals("MISSING_TEST_TOKEN environment variable is not set", exception.message)
70+
assertEquals("Missing values for system property \"MISSING_TEST_TOKEN\" and environment variable \"MISSING_TEST_TOKEN\"", exception.message)
3471
}
3572
}

0 commit comments

Comments
 (0)