-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Container registry/blob push pull support #20529
Container registry/blob push pull support #20529
Conversation
API changes have been detected in |
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
API changes have been detected in |
API changes have been detected in |
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
API changes have been detected in |
sdk/containerregistry/container-registry/review/container-registry.api.md
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/review/container-registry.api.md
Show resolved
Hide resolved
1ae7432
to
9372a95
Compare
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Show resolved
Hide resolved
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.
Looks good to me! I left some comments, but they can wait.
API change check for API changes have been detected in |
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.
A few more comments on some things I didn't notice before. I think the public shape looks great modulo the Options interface for the new client.
sdk/containerregistry/container-registry/review/container-registry.api.md
Show resolved
Hide resolved
} else if (typeof manifest === "function") { | ||
manifestBody = await readStreamToEnd(manifest()); | ||
} else { | ||
const serialized = serializer.serialize(Mappers.OCIManifest, manifest); |
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.
interesting, I don't think we've had to do this in convenience before. I wonder if this is a pattern we should think about how to generalize more.
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Outdated
Show resolved
Hide resolved
sdk/containerregistry/container-registry/src/blob/containerRegistryBlobClient.ts
Show resolved
Hide resolved
function withRequiredProperty<T, U extends keyof T>(property: U, obj: T): T & Required<Pick<T, U>> { | ||
if (!Object.prototype.hasOwnProperty.call(obj, property)) { | ||
throw new RestError(`Expected property ${property} to be defined.`); | ||
} | ||
|
||
return obj as T & Required<Pick<T, U>>; | ||
} |
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.
Small preference for
function withRequiredProperty<T, U extends keyof T>(property: U, obj: T): T & Required<Pick<T, U>> { | |
if (!Object.prototype.hasOwnProperty.call(obj, property)) { | |
throw new RestError(`Expected property ${property} to be defined.`); | |
} | |
return obj as T & Required<Pick<T, U>>; | |
} | |
function assertRequiredProperty<T, U extends keyof T>(property: U, obj: T): asserts obj is T & Required<Pick<T, U>> { | |
if (!Object.prototype.hasOwnProperty.call(obj, property)) { | |
throw new RestError(`Expected property ${property} to be defined.`); | |
} | |
} |
so you can use it like
const result = await this.client.containerRegistry.createManifest(
this.repositoryName,
tagOrDigest,
manifestBody,
{ contentType: KnownManifestMediaType.OciManifestMediaType, ...updatedOptions }
)
);
assertRequiredProperty("dockerContentDigest", result);
return { digest: result.dockerContentDigest };
Mostly because nesting the 'await' inside of a method call seems like an easy way to forget to do it later, and then we're asserting on a Promise object instead of the real result.
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.
Thanks for the updates!
Adding readme.java.md for agrifood (Azure#20529) * Adding readme.java.md for agrifood * update * Update readme.java.md * Update readme.java.md Co-authored-by: Weidong Xu <weidxu@microsoft.com>
Packages impacted by this PR
@azure/container-registry
Issues associated with this PR
Are there test cases added in this PR? (If not, why?)
Yes.
Checklists