Skip to content

Commit

Permalink
Merge pull request #44 from max-ieremenko/build/cleanup
Browse files Browse the repository at this point in the history
small build cleanup
  • Loading branch information
max-ieremenko committed Mar 17, 2024
2 parents 5681289 + db2723f commit 63d4226
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
34 changes: 19 additions & 15 deletions Build/show-powershell-images.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'

function Get-ShortVersion {
[CmdletBinding()]
Expand All @@ -9,23 +9,27 @@ function Get-ShortVersion {
)

process {
$parts = $FullVersion -split "-"
$result = $parts[0]
# preview-7.5-ubuntu-20.04
# 7.4-ubuntu-22.04
# 7.3.0-preview.1-ubuntu-20.04
$parts = $FullVersion -split '-'
$version = $parts[0]
$tag = $parts[1]

if ($parts[1] -like "preview*") {
$result += "-" + $parts[1]
if ($version -like 'preview*') {
$version = $parts[1]
$tag = $parts[0]
}

return $result
if ($tag -like 'preview*') {
$version += '-' + $tag
}

return $version
}
}

(Invoke-RestMethod -Uri "https://mcr.microsoft.com/v2/powershell/tags/list").tags `
| Where-Object {$_ -Like "[0-9]*"} `
| Get-ShortVersion `
| Sort-Object -Unique

# (Invoke-RestMethod -Uri "https://mcr.microsoft.com/v2/powershell/tags/list").tags `
# | Where-Object {$_ -Like "7.2.0*"} `
# | Where-Object {($_ -Like "*ubuntu*") -or ($_ -Like "*alpine*")} `
# | Sort-Object
(Invoke-RestMethod -Uri 'https://mcr.microsoft.com/v2/powershell/tags/list').tags `
| Where-Object { ($_ -Like '[0-9]*') -or ($_ -Like 'preview-[0-9]*') } `
| Get-ShortVersion `
| Sort-Object -Unique
6 changes: 2 additions & 4 deletions Build/tasks/build-tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,10 @@ task PsCoreTest {
, "mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.3-ubuntu-20.04")

foreach ($image in $images) {
exec { docker pull $image }
}

$builds = @()
foreach ($image in $images) {
exec { docker pull -q $image }

foreach ($database in $databases) {
$builds += @{
File = "build-tasks.it-ps-core.ps1"
Expand Down
9 changes: 9 additions & 0 deletions Build/tasks/create-images-tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ task BuildMsSqlDatabase {
$dockerfile = Join-Path $context "image-mssql-2017.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/mssql:2017 `
$context
Expand All @@ -27,6 +28,7 @@ task BuildPgSqlDatabase {
$dockerfile = Join-Path $context "image-postgres-133.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/postgres:13.3 `
$context
Expand All @@ -37,6 +39,7 @@ task BuildMySqlDatabase {
$dockerfile = Join-Path $context "image-mysql-8025.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/mysql:8.0.25 `
$context
Expand All @@ -47,6 +50,7 @@ task BuildDotnetSdk60 {
$dockerfile = Join-Path $context "image-dotnet-sdk-6.0.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/dotnet_pwsh:6.0-sdk `
.
Expand All @@ -57,6 +61,7 @@ task BuildDotnetRuntime60 {
$dockerfile = Join-Path $context "image-dotnet-runtime-6.0.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/dotnet_pwsh:6.0-runtime `
.
Expand All @@ -67,6 +72,7 @@ task BuildDotnetSdk70 {
$dockerfile = Join-Path $context "image-dotnet-sdk-7.0.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/dotnet_pwsh:7.0-sdk `
.
Expand All @@ -77,6 +83,7 @@ task BuildDotnetRuntime70 {
$dockerfile = Join-Path $context "image-dotnet-runtime-7.0.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/dotnet_pwsh:7.0-runtime `
.
Expand All @@ -87,6 +94,7 @@ task BuildDotnetSdk80 {
$dockerfile = Join-Path $context "image-dotnet-sdk-8.0.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/dotnet_pwsh:8.0-sdk `
.
Expand All @@ -97,6 +105,7 @@ task BuildDotnetRuntime80 {
$dockerfile = Join-Path $context "image-dotnet-runtime-8.0.dockerfile"
exec {
docker build `
--pull `
-f $dockerfile `
-t sqldatabase/dotnet_pwsh:8.0-runtime `
.
Expand Down

0 comments on commit 63d4226

Please sign in to comment.