Skip to content

Conversation

migmartri
Copy link
Member

@migmartri migmartri commented Nov 10, 2023

This PR

  • Improves the ingestion code to allow storing two referrers with the same digest but different kinds. it includes some refactoring too.
  • Updates the retrieval code to return a well-known error that:
    • makes the API return a validation error instead of a server error
    • shows actionable information to the user of what's available.

For example, now, on retrieval we get.

$ chainloop discover -d sha256:ebe2e6ffab93f4b2e2743d3557bd094427ea059adc78cfe2cd330a72f61731e8
ERR validation error: please provide the referrer kind: failed to get referrer: digest sha256:ebe2e6ffab93f4b2e2743d3557bd094427ea059adc78cfe2cd330a72f61731e8
 present in two kinds ["SBOM_CYCLONEDX_JSON" "ARTIFACT"]

In a future patch, the user will be able to filter out by kind.

Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri migmartri changed the title enhancement(referrer): handle same artifact digest feat(referrer): handle same artifact digest Nov 10, 2023
@migmartri migmartri changed the title feat(referrer): handle same artifact digest feat(referrer): support same digest for two different kinds Nov 10, 2023
Copy link
Member

@danlishka danlishka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Downloadable bool
CreatedAt *time.Time
*Referrer
ID uuid.UUID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need uuid?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In favor of another format? or having a primary ID at all?

@migmartri migmartri merged commit d5d0728 into chainloop-dev:main Nov 13, 2023
@migmartri migmartri deleted the same-referrer branch November 13, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants