feat(dependecy-track): interpolated project name - #282
Merged
Conversation
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
migmartri
commented
Jul 30, 2023
| // We currently support the following template variables: | ||
| // - material.annotations.<key> | ||
| // For example, project-name => {{ material.annotations.my_annotation }} | ||
| func resolveProjectName(projectNameTpl string, annotations map[string]string) (string, error) { |
migmartri
commented
Jul 30, 2023
|
|
||
| if ac.ProjectName != "" && !rc.AllowAutoCreate { | ||
| return errors.New("auto creation of projects is not supported in this integration") | ||
| if ac.ProjectName != "" { |
Member
Author
There was a problem hiding this comment.
and this validation at attachment time
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
danlishka
reviewed
Jul 30, 2023
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
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.
Enables annotations interpolation (#252) in the Dependency-Track plugin.
Now, during attachment, the project name can contain material annotations that will be resolved before pushing to the dep-track instance.
For example, let's say that you have the following contract with two SBOMs and a
componentannotation (note that the value of the annotation is set in the contract but it is also now possible to set it at runtime #281){ "schemaVersion": "v1", "materials": [ { "type": "SBOM_CYCLONEDX_JSON", "name": "controlplane-sbom", "annotations": [ { "name": "component", "value": "controlplane" } ] }, { "type": "SBOM_CYCLONEDX_JSON", "name": "cas-sbom", "annotations": [ { "name": "component", "value": "cas" } ] } ] }This annotation can then be set during attachment.
The result of this at execution time would be sending
controlplane-sbom=>miguel-test-controlplanecas-sbom=>miguel-test-casSome notes about the implementation