Skip to content

Commit 954b662

Browse files
authored
fix fedora subimage build (#258)
1 parent ca72a49 commit 954b662

File tree

4 files changed

+58
-29
lines changed

4 files changed

+58
-29
lines changed

build.ps1

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ End {
199199
$dupeTagIssues = @()
200200

201201
$toBuild = @()
202-
$builtSubImages = @()
203202
foreach ($actualChannel in $Channels) {
204203
if ($PSCmdlet.ParameterSetName -match '.*ByName')
205204
{
@@ -265,31 +264,23 @@ End {
265264
{
266265
$actualTagData = $allMeta.ActualTagDataByGroup.$tagGroup
267266
$SubImagePath = Join-Path -Path $dockerFileName -ChildPath $allMeta.Meta.SubImage
268-
if($builtSubImages -notcontains $SubImagePath)
269-
{
270-
Write-Verbose -Message "getting subimage - fromtag: $($tagGroup.Name) - subimage: $($allMeta.Meta.SubImage)"
271-
$subImageAllMeta = Get-DockerImageMetaDataWrapper `
272-
-DockerFileName $SubImagePath `
273-
-CI:$CI.IsPresent `
274-
-IncludeKnownIssues:$IncludeKnownIssues.IsPresent `
275-
-ChannelPath $channelPath `
276-
-TagFilter $TagFilter `
277-
-Version $windowsVersion `
278-
-ImageName $ImageName `
279-
-LinuxVersion $linuxVersion `
280-
-TagData $allMeta.TagData `
281-
-BaseImage $actualTagData.ActualTags[0] `
282-
-BaseRepositry $Repository `
283-
-Strict:$CheckForDuplicateTags.IsPresent
284-
285-
286-
$toBuild += $subImageAllMeta
287-
$builtSubImages += $SubImagePath
288-
}
289-
else
290-
{
291-
Write-Verbose -Message "already got subimage - fromtag: $($tagGroup.Name) - subimage: $($allMeta.Meta.SubImage)"
292-
}
267+
Write-Verbose -Message "getting subimage - fromtag: $($tagGroup.Name) - subimage: $($allMeta.Meta.SubImage)"
268+
$subImageAllMeta = Get-DockerImageMetaDataWrapper `
269+
-DockerFileName $SubImagePath `
270+
-CI:$CI.IsPresent `
271+
-IncludeKnownIssues:$IncludeKnownIssues.IsPresent `
272+
-ChannelPath $channelPath `
273+
-TagFilter $TagFilter `
274+
-Version $windowsVersion `
275+
-ImageName $ImageName `
276+
-LinuxVersion $linuxVersion `
277+
-TagData $allMeta.TagData `
278+
-BaseImage $actualTagData.ActualTags[0] `
279+
-BaseRepositry $Repository `
280+
-Strict:$CheckForDuplicateTags.IsPresent `
281+
-FromTag $tagGroup.Name
282+
283+
$toBuild += $subImageAllMeta
293284
}
294285
}
295286
}

release/preview/alpine39/test-deps/meta.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
"SkipGssNtlmSspTests": true,
55
"osVersion": "Alpine ${fromTag}",
66
"tagTemplates": [
7-
"preview-alpine-#shorttag#"
7+
"#tag#"
88
],
99
"OptionalTests": [
1010
"test-deps",
1111
"test-deps-musl"
1212
],
1313
"TestProperties": {
1414
"size": 212
15+
},
16+
"TagMapping": {
17+
"^.*-alpine-3.9$" : "preview-alpine-3.9",
18+
"^.*-alpine-3.10$" : "preview-alpine-3.10"
1519
}
1620
}

release/preview/fedora/test-deps/meta.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
"osVersion": "Fedora ${fromTag}",
55
"SkipGssNtlmSspTests": false,
66
"tagTemplates": [
7-
"preview-fedora-#shorttag#"
7+
"#tag#"
88
],
99
"SubRepository": "test-deps",
1010
"OptionalTests": [
1111
"test-deps"
1212
],
1313
"TestProperties": {
1414
"size": 602
15+
},
16+
"TagMapping": {
17+
"^.*-fedora-28$" : "preview-fedora-28",
18+
"^.*-fedora-29$" : "preview-fedora-29",
19+
"^.*-fedora-30$" : "preview-fedora-30"
1520
}
1621
}

tools/buildHelper/buildHelper.psm1

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ class DockerImageMetaData {
162162

163163
[PSCustomObject]
164164
$TestProperties = ([PSCustomObject]@{})
165+
166+
[PSCustomObject]
167+
$TagMapping
165168
}
166169

167170
class ShortTagMetaData {
@@ -333,6 +336,13 @@ class DockerImageFullMetaData
333336
[string] $FullRepository
334337
}
335338

339+
class UpstreamImageTagData
340+
{
341+
[string] $Type
342+
[string] $Tag
343+
[string] $FromTag
344+
}
345+
336346
# Get the meta data and the tag data for an image
337347
function Get-DockerImageMetaDataWrapper
338348
{
@@ -373,7 +383,10 @@ function Get-DockerImageMetaDataWrapper
373383
$BaseRepositry,
374384

375385
[switch]
376-
$Strict
386+
$Strict,
387+
388+
[string]
389+
$FromTag
377390
)
378391

379392
$imagePath = Join-Path -Path $ChannelPath -ChildPath $dockerFileName
@@ -419,6 +432,22 @@ function Get-DockerImageMetaDataWrapper
419432
$tagDataFromScript = @($tagDataFromScript | Where-Object { $_.FromTag -match $TagFilter })
420433
}
421434
}
435+
elseif ($meta.TagMapping) {
436+
foreach($regex in $meta.TagMapping.PSObject.Properties.Name)
437+
{
438+
if($BaseImage -match $regex)
439+
{
440+
$tagName = $meta.TagMapping.$regex
441+
$tagDataFromScript = @(
442+
[UpstreamImageTagData]@{
443+
Type='Full'
444+
Tag=$tagName
445+
FromTag = $FromTag
446+
}
447+
)
448+
}
449+
}
450+
}
422451
else
423452
{
424453
$tagDataFromScript = $TagData

0 commit comments

Comments
 (0)