Skip to content

Commit

Permalink
✨ Support apptainer sif (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Jan 13, 2024
1 parent 732c251 commit 264c79c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 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 @@ -191,7 +191,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', 'Cosign', 'Unknown') NOT NULL DEFAULT 'Unknown',
`type` ENUM ('Image', 'ImageIndex', 'Chart', 'Cnab', 'Wasm', 'Provenance', 'Cosign', 'Sif', '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 @@ -274,6 +274,7 @@ CREATE TYPE artifact_type AS ENUM (
'Wasm',
'Provenance',
'Cosign',
'Sif',
'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 @@ -224,7 +224,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', 'Cosign', 'Unknown')) NOT NULL DEFAULT 'Unknown',
`type` text CHECK (`type` IN ('Image', 'ImageIndex', 'Chart', 'Cnab', 'Wasm', 'Provenance', 'Cosign', 'Sif', 'Unknown')) NOT NULL DEFAULT 'Unknown',
`pushed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_pull` timestamp,
`referrer_id` integer,
Expand Down
4 changes: 3 additions & 1 deletion pkg/handlers/distribution/manifest/manifest_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (h *handler) PutManifest(c echo.Context) error {
}
} else {
for _, reference := range manifest.References() {
if reference.MediaType == "application/vnd.oci.image.config.v1+json" || reference.MediaType == "application/vnd.docker.container.image.v1+json" || reference.MediaType == "application/vnd.cncf.helm.config.v1+json" {
if reference.MediaType == "application/vnd.oci.image.config.v1+json" || reference.MediaType == "application/vnd.docker.container.image.v1+json" || reference.MediaType == "application/vnd.cncf.helm.config.v1+json" || reference.MediaType == "application/vnd.sylabs.sif.config.v1+json" {
configRawReader, err := storage.Driver.Reader(ctx, path.Join(consts.Blobs, utils.GenPathByDigest(reference.Digest)), 0)
if err != nil {
log.Error().Err(err).Str("digest", reference.Digest.String()).Msg("Get image config raw layer failed")
Expand Down Expand Up @@ -451,6 +451,8 @@ func (h *handler) getArtifactType(descriptor distribution.Descriptor, manifest d
return enums.ArtifactTypeWasm
case "application/vnd.cncf.helm.config.v1+json":
return enums.ArtifactTypeChart
case "application/vnd.sylabs.sif.config.v1+json":
return enums.ArtifactTypeSif
}
return enums.ArtifactTypeUnknown
}
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 @@ -141,6 +141,7 @@ type SortMethod string
// Wasm,
// Provenance,
// Cosign,
// Sif,
// Unknown,
// )
type ArtifactType string
Expand Down
9 changes: 6 additions & 3 deletions pkg/types/enums/enums_enum.go

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

4 changes: 2 additions & 2 deletions web/src/pages/Tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function Tag({ localServer }: { localServer: string }) {
}, [namespace, repository])

const fetchTags = () => {
let url = localServer + `/api/v1/namespaces/${namespaceId}/repositories/${repositoryId}/tags/?repository=${repository}&limit=${Settings.PageSize}&page=${page}&type=Image&type=ImageIndex&type=Chart`;
let url = localServer + `/api/v1/namespaces/${namespaceId}/repositories/${repositoryId}/tags/?repository=${repository}&limit=${Settings.PageSize}&page=${page}&type=Image&type=ImageIndex&type=Chart&type=Sif`;
if (searchTag !== "") {
url += `&name=${searchTag}`;
}
Expand Down Expand Up @@ -272,7 +272,7 @@ export default function Tag({ localServer }: { localServer: string }) {

{/* second row begin */}
<div className="text-xs text-gray-600">
Last pushed <span className="font-semibold">{dayjs().to(dayjs(tag.pushed_at))}</span>
Last pushed <span className="font-semibold">{dayjs().to(dayjs.utc(tag.pushed_at).tz(dayjs.tz.guess()))}</span>
</div>
<div className="mt-2 text-xs text-gray-600">
Pull times <span className="font-semibold">{tag.pull_times === undefined ? 0 : tag.pull_times}</span>
Expand Down

0 comments on commit 264c79c

Please sign in to comment.