Make sure both tokenCache and tokenExpiryCache are initialized if needed #342
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is possible for users who have a
AbstractVaultTokenCredentialWithExpiration
that was created after #223 and has not been resaved since #325 to still have a non-nulltokenCache
field on disk (and a non-nulltokenExpiry
field).As of #336, this causes problems, because the following logic only checks for a non-null
tokenCache
to decide if the transient fields need to be initialized:hashicorp-vault-plugin/src/main/java/com/datapipe/jenkins/vault/credentials/AbstractVaultTokenCredentialWithExpiration.java
Line 110 in 946b535
We need to adjust this logic to check for both
tokenCache
and the newly-renamedtokenExpiryCache
to avoid issues for users who have gone through this upgrade path.Fixes #340.
Testing done
Untested.
The regression should be able to be reproduced in a
JenkinsRule
test if desired, but I do not see any existingJenkinsRule
tests for the credentials types that are subclasses ofAbstractVaultTokenCredentialWithExpiration
, so it might take some effort.Submitter checklist