-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
|
||
export async function listImageTags(user: UserDoc, imageRef: RepoRef) { | ||
const repo = `${imageRef.namespace}/${imageRef.model}` | ||
const token = await getAccessToken({ id: user.dn, _id: user.dn }, [ |
There was a problem hiding this comment.
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' ?
There was a problem hiding this comment.
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('/') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, :(.
No description provided.