Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get docker images endpoint #740

Merged
merged 1 commit into from
Sep 27, 2023
Merged

Add get docker images endpoint #740

merged 1 commit into from
Sep 27, 2023

Conversation

a3957273
Copy link
Member

No description provided.


export async function listImageTags(user: UserDoc, imageRef: RepoRef) {
const repo = `${imageRef.namespace}/${imageRef.model}`
const token = await getAccessToken({ id: user.dn, _id: user.dn }, [
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference between 'id' and '_id' ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We used to have the _id field represent the internal MongoDB ID and the 'id' field represent the public identifier of a user. This was confusing, so we now only use the 'dn' field to represent a user.

This id and _id is to make sure our registry continues working during the beta, as our registryAuth is still using the v1 authentication system.

const repos = await listModelRepos(user, modelId)
const versions = await Promise.all(
repos.map(async (repo) => {
const [namespace, model] = repo.split('/')
Copy link
Member

Choose a reason for hiding this comment

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

Is the .split() used to keep a division between namespace and model?

Copy link
Member Author

Choose a reason for hiding this comment

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

The repository is in the form x/y. We want to separate x, the namespace with y, the model. So we split it into two.

images: Array<ImageInterface>
images: Array<{
namespace: string
model: string
Copy link
Member

Choose a reason for hiding this comment

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

Is this the modelId? If so, is this necessary considering the model ID is included in the endpoint?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is the model artefact name in Docker.

@@ -212,7 +213,7 @@ if (config.experimental.v2) {
server.post('/api/v2/model/:modelId/files/upload/multipart/finish', ...postFinishMultipartUpload)
server.delete('/api/v2/model/:modelId/files/:fileId', ...deleteFile)

// *server.get('/api/v2/model/:modelId/images', ...getImages)
server.get('/api/v2/model/:modelId/images', ...getImages)
Copy link
Member

Choose a reason for hiding this comment

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

Is this obvious enough we are referring to Docker images?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could rename it getOCIImages, but that looks weird!

import fetch from 'node-fetch'

import { UserDoc } from '../../models/v2/User.js'
import { getAccessToken } from '../../routes/v1/registryAuth.js'
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing a V2 version of this will be added at some point?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes but we can only run one simultaneously, :(.

@a3957273 a3957273 merged commit 9737bc9 into main Sep 27, 2023
@a3957273 a3957273 deleted the feature/registry-list branch September 27, 2023 12:12
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.

4 participants