From 26bce3baede3af4505fa1f28b6be5e97f9fdc5ad Mon Sep 17 00:00:00 2001
From: Chris Kilding <590569+chriskilding@users.noreply.github.com>
Date: Wed, 9 Mar 2022 10:49:20 +0000
Subject: [PATCH] Remove aws-secrets-manager-secret-source dependency (#187)
---
docs/README.md | 4 +-
docs/filters/index.md | 2 -
pom.xml | 5 --
.../secretsmanager/SecretSourceIT.java | 60 -------------------
4 files changed, 2 insertions(+), 69 deletions(-)
delete mode 100644 src/test/java/io/jenkins/plugins/credentials/secretsmanager/SecretSourceIT.java
diff --git a/docs/README.md b/docs/README.md
index 3370d9df..1bbe757a 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -5,7 +5,7 @@
Access credentials from AWS Secrets Manager in your Jenkins jobs.
-This plugin is the high-level counterpart of the [AWS Secrets Manager SecretSource](https://github.com/jenkinsci/aws-secrets-manager-secret-source-plugin) plugin. It pulls in that plugin as a dependency, so by installing the CredentialsProvider on Jenkins you get the SecretSource 'for free'. This dependency will be removed in future, at which point you will need to install the SecretSource plugin separately.
+This plugin is the high-level counterpart of the [AWS Secrets Manager SecretSource](https://github.com/jenkinsci/aws-secrets-manager-secret-source-plugin) plugin. You can use either plugin individually, or use both of them.
## Contents
@@ -23,7 +23,7 @@ This plugin is the high-level counterpart of the [AWS Secrets Manager SecretSour
## Features
- Read-only view of Secrets Manager.
-- `CredentialsProvider` and `SecretSource` API support.
+- `CredentialsProvider` API support.
- Credential metadata caching (duration: 5 minutes).
## Setup
diff --git a/docs/filters/index.md b/docs/filters/index.md
index 91f2d35d..4ef205f3 100644
--- a/docs/filters/index.md
+++ b/docs/filters/index.md
@@ -14,8 +14,6 @@ Multiple filters combine with an **implicit AND** operator. Multiple values for
Filters are applied server-side by Secrets Manager, and use the Amazon syntax. For full instructions on constructing filters, read the [ListSecrets API documentation](https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_ListSecrets.html).
-Note: The `SecretSource` implementation does not use the filters, as they are not relevant to it.
-
## Examples
Show credentials with the tag `foo` = [any value]:
diff --git a/pom.xml b/pom.xml
index 285169f3..765f2c03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,11 +77,6 @@
aws-java-sdk
1.12.131-302.vbef9650c6521
-
- io.jenkins.plugins
- aws-secrets-manager-secret-source
- 0.0.2
-
io.jenkins
configuration-as-code
diff --git a/src/test/java/io/jenkins/plugins/credentials/secretsmanager/SecretSourceIT.java b/src/test/java/io/jenkins/plugins/credentials/secretsmanager/SecretSourceIT.java
deleted file mode 100644
index 6da17322..00000000
--- a/src/test/java/io/jenkins/plugins/credentials/secretsmanager/SecretSourceIT.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.jenkins.plugins.credentials.secretsmanager;
-
-import com.amazonaws.services.secretsmanager.model.CreateSecretRequest;
-import com.amazonaws.services.secretsmanager.model.CreateSecretResult;
-import io.jenkins.plugins.casc.ConfigurationContext;
-import io.jenkins.plugins.casc.ConfiguratorRegistry;
-import io.jenkins.plugins.casc.SecretSourceResolver;
-import io.jenkins.plugins.credentials.secretsmanager.util.AWSSecretsManagerRule;
-import io.jenkins.plugins.credentials.secretsmanager.util.CredentialNames;
-import io.jenkins.plugins.credentials.secretsmanager.util.Rules;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.jvnet.hudson.test.JenkinsRule;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SecretSourceIT {
-
- private static final String SECRET_STRING = "supersecret";
-
- public final AWSSecretsManagerRule secretsManager = new AWSSecretsManagerRule();
- public final JenkinsRule jenkins = new JenkinsRule();
-
- @Rule
- public final TestRule chain = Rules.jenkinsWithSecretsManager(jenkins, secretsManager);
-
- private ConfigurationContext context;
-
- @Before
- public void refreshConfigurationContext() {
- final ConfiguratorRegistry registry = ConfiguratorRegistry.get();
- context = new ConfigurationContext(registry);
- }
-
- @Test
- public void shouldRevealSecret() {
- // Given
- final CreateSecretResult foo = createSecret(SECRET_STRING);
-
- // When
- final String secret = revealSecret(foo.getName());
-
- // Then
- assertThat(secret).isEqualTo(SECRET_STRING);
- }
-
- private CreateSecretResult createSecret(String secretString) {
- final CreateSecretRequest request = new CreateSecretRequest()
- .withName(CredentialNames.random())
- .withSecretString(secretString);
-
- return secretsManager.getClient().createSecret(request);
- }
-
- private String revealSecret(String id) {
- return SecretSourceResolver.resolve(context, "${" + id + "}");
- }
-}