Skip to content

Commit

Permalink
✨ Filter the cosign (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Oct 16, 2023
1 parent 90b819e commit 6b83faf
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/dal/migrations/mysql/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ CREATE TABLE IF NOT EXISTS `artifacts` (
`raw` MEDIUMBLOB NOT NULL,
`config_raw` MEDIUMBLOB,
`config_media_type` varchar(256),
`type` ENUM ('image', 'imageIndex', 'chart', 'cnab', 'wasm', 'provenance', 'unknown') NOT NULL DEFAULT 'unknown',
`type` ENUM ('image', 'imageIndex', 'chart', 'cnab', 'wasm', 'provenance', 'cosign', 'unknown') NOT NULL DEFAULT 'unknown',
`pushed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_pull` timestamp,
`pull_times` bigint NOT NULL DEFAULT 0,
Expand Down
1 change: 1 addition & 0 deletions pkg/dal/migrations/postgresql/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ CREATE TYPE artifact_type AS ENUM (
'cnab',
'wasm',
'provenance',
'cosign',
'unknown'
);

Expand Down
2 changes: 1 addition & 1 deletion pkg/dal/migrations/sqlite3/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ CREATE TABLE IF NOT EXISTS `artifacts` (
`raw` BLOB NOT NULL,
`config_raw` BLOB,
`config_media_type` varchar(256),
`type` text CHECK (`type` IN ('image', 'imageIndex', 'chart', 'cnab', 'wasm', 'provenance', 'unknown')) NOT NULL DEFAULT 'unknown',
`type` text CHECK (`type` IN ('image', 'imageIndex', 'chart', 'cnab', 'wasm', 'provenance', 'cosign', 'unknown')) NOT NULL DEFAULT 'unknown',
`pushed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_pull` timestamp,
`pull_times` bigint NOT NULL DEFAULT 0,
Expand Down
2 changes: 2 additions & 0 deletions pkg/handlers/distribution/manifest/manifest_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ func (h *handler) getArtifactType(descriptor distribution.Descriptor, manifest d
for _, descriptor := range references {
if descriptor.MediaType == "application/vnd.in-toto+json" {
return enums.ArtifactTypeProvenance
} else if descriptor.MediaType == "application/vnd.dev.cosign.simplesigning.v1+json" {
return enums.ArtifactTypeCosign
}
}
var mediaType string
Expand Down
1 change: 1 addition & 0 deletions pkg/types/enums/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ type SortMethod string
// cnab,
// wasm,
// provenance,
// cosign,
// unknown,
// )
type ArtifactType string
Expand Down
3 changes: 3 additions & 0 deletions pkg/types/enums/enums_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export interface IArtifact {
raw: string;
config_media_type: string;
config_raw: string;
type: string;
size: number;
blob_size: number;
last_pull: string;
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default function Tag({ localServer }: { localServer: string }) {
<div className="flex flex-col border-b border-gray-200">
{
tagList.items?.map((tag, index) => {
return (
return tag.artifact.type === "cosign" ? null : (
<div key={tag.id} className="p-4 border-t border-gray-200 hover:shadow-md last:hover:shadow-none">
{/* first row begin */}
<div className="flex">
Expand Down

0 comments on commit 6b83faf

Please sign in to comment.