diff --git a/README.md b/README.md index 79ab5d0..525a60a 100644 --- a/README.md +++ b/README.md @@ -305,6 +305,7 @@ This allows you to manage the plugin configuration alongside your other Jenkins - **Note**: Claude Opus 4.7 and newer models have deprecated the `temperature` parameter. See [model deprecations](https://platform.claude.com/docs/en/about-claude/model-deprecations) for migration details. ### AWS Bedrock +- **Requires**: the [AWS SDK 2.x](https://plugins.jenkins.io/aws-java-sdk2/) plugin (`aws-java-sdk2-core`). This dependency is intentionally **optional** so installations that don't use Bedrock are not forced to carry the AWS SDK. As a result, **AWS Bedrock appears in the AI Provider list only after you install that plugin**. To enable it: **Manage Jenkins → Plugins → Available plugins**, search for `AWS SDK`, install the AWS SDK 2.x plugin, and restart Jenkins. - **Models**: `anthropic.claude-3-5-sonnet-20240620-v1:0`, `eu.anthropic.claude-3-5-sonnet-20240620-v1:0` (EU cross-region), `meta.llama3-8b-instruct-v1:0`, `us.amazon.nova-lite-v1:0`, etc. - **API Key**: Not required — uses AWS credential chain (instance profiles, environment variables, etc.) - **Region**: AWS region (e.g., `us-east-1`, `eu-west-1`). Optional — defaults to AWS SDK region resolution diff --git a/src/test/java/io/jenkins/plugins/explain_error/provider/BedrockProviderRegistrationTest.java b/src/test/java/io/jenkins/plugins/explain_error/provider/BedrockProviderRegistrationTest.java new file mode 100644 index 0000000..8ded251 --- /dev/null +++ b/src/test/java/io/jenkins/plugins/explain_error/provider/BedrockProviderRegistrationTest.java @@ -0,0 +1,31 @@ +package io.jenkins.plugins.explain_error.provider; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.jvnet.hudson.test.JenkinsRule; +import org.jvnet.hudson.test.junit.jupiter.WithJenkins; + +/** + * Guards that the AWS Bedrock provider is wired up as a selectable AI provider + * when its dependency is available. + * + *
The System configuration dropdown is populated by descriptor discovery over + * {@link BaseAIProvider}. The Bedrock descriptor is registered only when the + * {@code aws-java-sdk2-core} plugin is present — an intentionally optional + * dependency, so instances that do not use Bedrock are not forced to carry the + * AWS SDK. The test harness provides that dependency, so this test verifies the + * descriptor is correctly registered (via {@code @OptionalExtension} and + * {@code @Symbol}) whenever the AWS SDK plugin is installed. + */ +@WithJenkins +class BedrockProviderRegistrationTest { + + @Test + void bedrockProviderIsSelectable(JenkinsRule jenkins) { + boolean registered = jenkins.jenkins.getDescriptorList(BaseAIProvider.class).stream() + .anyMatch(descriptor -> descriptor instanceof BedrockProvider.DescriptorImpl); + assertTrue(registered, + "AWS Bedrock provider descriptor must be registered and selectable in the AI Provider list"); + } +}