-
Notifications
You must be signed in to change notification settings - Fork 145
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
[JENKINS-71788] Fix timing of SecretPatterns.getAggregateSecretPattern
#314
Conversation
@jetersen Can you please approve this. |
@jglick There seems to be errors when running the test on a higher version of Jenkins, I've updated the pom.xml with version 2.414. And I'm getting errors during tests:
|
OK, I can take a look soon; which test was that? hashicorp-vault-plugin/Jenkinsfile Lines 2 to 3 in 0a1c04c
|
It several of the tests, here are few of those that are failing for me: com.datapipe.jenkins.vault.it.VaultGCRLoginIT.shouldRetrieveCorrectCredentialsFromVault I've changed to following in the pom.xml:
Maybe we should at least update it to the version when this change was implemented (Jenkins 2.403) |
That is not related to this PR. I would advise avoiding Mockito generally, but if you must use it, diff --git src/test/java/com/datapipe/jenkins/vault/it/VaultStringCredentialIT.java src/test/java/com/datapipe/jenkins/vault/it/VaultStringCredentialIT.java
index b3515b0..61c164b 100644
--- src/test/java/com/datapipe/jenkins/vault/it/VaultStringCredentialIT.java
+++ src/test/java/com/datapipe/jenkins/vault/it/VaultStringCredentialIT.java
@@ -17,6 +17,7 @@ import org.jvnet.hudson.test.JenkinsRule;
import static com.datapipe.jenkins.vault.it.VaultConfigurationIT.getShellString;
import static com.datapipe.jenkins.vault.it.VaultConfigurationIT.getVariable;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -34,6 +35,7 @@ public class VaultStringCredentialIT {
VaultStringCredential up = mock(VaultStringCredential.class);
when(up.getId()).thenReturn(credentialsId);
when(up.getSecret()).thenReturn(Secret.fromString(secret));
+ when(up.forRun(any())).thenReturn(up);
CredentialsProvider.lookupStores(jenkins.getInstance()).iterator().next()
.addCredentials(Domain.global(), up);
WorkflowJob p = jenkins.createProject(WorkflowJob.class, jobId); (Apparently it does not handle |
@jglick In that case perfect :D Can we get this merged? |
I think @jetersen is the maintainer? |
@jetersen any update on approving this? |
@jetersen Can you merge this after approval? |
BTW https://plugins.jenkins.io/hashicorp-vault-plugin/ still warns https://www.jenkins.io/security/advisory/2023-05-16/#SECURITY-3077 which I think is obsolete? Can we get rid of this warning? |
@jglick Thanks, we didn't get notified as described in https://www.jenkins.io/security/plugins/#followup, I'll take care of this in a moment. |
Fixes #311, supersedes #309, triggered by jenkinsci/credentials-binding-plugin#260. Implementation is simpler than the
WeakHashMap
trick in jenkinsci/credentials-binding-plugin#28. Not tested other than whatever CI covers.