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

[ContainerRegistry] Update delete image sample #16002

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sdk/containerregistry/container-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ async function main() {
// Delete images older than the first three.
for await (const manifest of imageManifests) {
if (imageCount++ > imagesToKeep) {
const image = repository.getArtifact(manifest.digest);
console.log(`Deleting image with digest ${manifest.digest}`);
console.log(` This image has the following tags:`);
console.log(` Deleting the following tags from the image:`);
for (const tagName of manifest.tags) {
console.log(` ${manifest.repositoryName}:${tagName}`);
image.deleteTag(tagName);
}
await repository.getArtifact(manifest.digest).delete();
await image.delete();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ async function main() {
// Delete images older than the first three.
for await (const manifest of imageManifests) {
if (imageCount++ > imagesToKeep) {
const image = repository.getArtifact(manifest.digest);
console.log(`Deleting image with digest ${manifest.digest}`);
console.log(` This image has the following tags:`);
console.log(` Deleting the following tags from the image:`);
for (const tagName of manifest.tags) {
console.log(` ${manifest.repositoryName}:${tagName}`);
image.deleteTag(tagName);
}
await repository.getArtifact(manifest.digest).delete();
await image.delete();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ async function main() {
// Delete images older than the first three.
for await (const manifest of imageManifests) {
if (imageCount++ > imagesToKeep) {
const image = repository.getArtifact(manifest.digest);
console.log(`Deleting image with digest ${manifest.digest}`);
console.log(` This image has the following tags:`);
console.log(` Deleting the following tags from the image:`);
for (const tagName of manifest.tags) {
console.log(` ${manifest.repositoryName}:${tagName}`);
image.deleteTag(tagName);
}
await repository.getArtifact(manifest.digest).delete();
await image.delete();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ async function main() {
// Delete images older than the first three.
for await (const manifest of imageManifests) {
if (imageCount++ > imagesToKeep) {
const image = repository.getArtifact(manifest.digest);
console.log(`Deleting image with digest ${manifest.digest}`);
console.log(` This image has the following tags:`);
console.log(` Deleting the following tags from the image:`);
for (const tagName of manifest.tags) {
console.log(` ${manifest.repositoryName}:${tagName}`);
image.deleteTag(tagName);
}
await repository.getArtifact(manifest.digest).delete();
await image.delete();
}
}
}
Expand Down