Add support for secrets in package configurations#8558
Merged
kritika-singh3 merged 5 commits intogocd:masterfrom Sep 18, 2020
Merged
Add support for secrets in package configurations#8558kritika-singh3 merged 5 commits intogocd:masterfrom
kritika-singh3 merged 5 commits intogocd:masterfrom
Conversation
This was referenced Sep 15, 2020
maheshp
reviewed
Sep 16, 2020
Contributor
maheshp
left a comment
There was a problem hiding this comment.
Mostly looks ok to me, I will test it before merging once the changes are made.
| return this.getRepository().hasSecretParams() | ||
| || this.getConfiguration() | ||
| .stream() | ||
| .anyMatch(ConfigurationProperty::hasSecretParams); |
Contributor
There was a problem hiding this comment.
The logic for hasSecretParams and getSecretParams is repeated across classes. Is it ok to move it to Configuration class?
| } | ||
|
|
||
| protected Map<CaseInsensitiveString, StringBuilder> validate(SecretParams secretParams, Class<? extends Validatable> entityClass, String entityName, String entityNameOrErrorMessagePrefix) { | ||
| HashMap<CaseInsensitiveString, StringBuilder> pipelinesWithErrors = new HashMap<>(); |
Contributor
There was a problem hiding this comment.
Map<CaseInsensitiveString, StringBuilder> errors = new HashMap<>();
60ef3c9 to
8690aee
Compare
Contributor
|
@kritika-singh3 came across couple of issues,
|
8690aee to
9594f44
Compare
Contributor
Author
|
@maheshp Pushed the fix for the scenarios you mentioned. 👍 |
- Validate secrets in package materials wrt to rules for `package_repository` - resolve rules for mdu and before sending the values to the plugin
- check connection of package repo and package def - isValid call for package repo and package def
9594f44 to
7d81c34
Compare
maheshp
approved these changes
Sep 18, 2020
| if (e instanceof GoConfigInvalidException && !result.hasMessage()) { | ||
| result.unprocessableEntity(entityConfigValidationFailed(packageDeinition.getClass().getAnnotation(ConfigTag.class).value(), packageDeinition.getId(), e.getMessage())); | ||
| } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { | ||
| LOGGER.error(e.getMessage(), e); |
| if (e instanceof GoConfigInvalidException && !result.hasMessage()) { | ||
| result.unprocessableEntity(entityConfigValidationFailed(repository.getClass().getAnnotation(ConfigTag.class).value(), repository.getId(), e.getMessage())); | ||
| } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { | ||
| LOGGER.error(e.getMessage(), e); |
Resolve secrets for package material as part of build work For Package Repo And Def operations, check if RulesViolationException or Secret resolution fails is raised while saving. If yes, then return 422 else 500 - Same for check connection call as well Set error message on the modal itself for package operations
7d81c34 to
c7651f8
Compare
Contributor
|
Verified on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description: Added support to specify secrets in package configurations meaning both in package repository and the package.
package_repositoryas entity