From b326801306058663cf3b165f590e41214aad7e89 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 5 Nov 2020 12:43:41 +0500 Subject: [PATCH] Print more informantion about cached Docker images on Windows (#1905) * Add docker full info * make tabular output * remove created at time Co-authored-by: Sergey Dolin --- .../SoftwareReport/SoftwareReport.Common.psm1 | 13 ++++++++++++- .../SoftwareReport/SoftwareReport.Generator.ps1 | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 0ca95ee7..ea56e1ff 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -262,6 +262,17 @@ function Get-CachedDockerImages { return (docker images --digests --format "* {{.Repository}}:{{.Tag}}").Split("*") | Where-Object { $_ } } +function Get-CachedDockerImagesTableData { + return (docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}").Split("*") | Where-Object { $_ } | ForEach-Object { + $parts=$_.Split("|") + [PSCustomObject] @{ + "Repository:Tag" = $parts[0] + "Digest" = $parts[1] + "Created" = $parts[2].split(' ')[0] + } + } +} + function Get-PacmanVersion { $msys2BinDir = "C:\msys64\usr\bin" $pacmanPath = Join-Path $msys2BinDir "pacman.exe" @@ -280,4 +291,4 @@ function Get-ShellTarget { function Get-YAMLLintVersion { yamllint --version -} \ No newline at end of file +} diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 06e1054d..aba000b7 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -243,6 +243,7 @@ $markdown += New-MDNewLine # Docker images section $markdown += New-MDHeader "Cached Docker images" -Level 3 -$markdown += New-MDList -Style Unordered -Lines @(Get-CachedDockerImages) +$markdown += Get-CachedDockerImagesTableData | New-MDTable +$markdown += New-MDNewLine -$markdown | Out-File -FilePath "C:\InstalledSoftware.md" \ No newline at end of file +$markdown | Out-File -FilePath "C:\InstalledSoftware.md"