Skip to content

fix fedora subimage build #258

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

Merged
merged 4 commits into from
Aug 2, 2019
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
43 changes: 17 additions & 26 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ End {
$dupeTagIssues = @()

$toBuild = @()
$builtSubImages = @()
foreach ($actualChannel in $Channels) {
if ($PSCmdlet.ParameterSetName -match '.*ByName')
{
Expand Down Expand Up @@ -265,31 +264,23 @@ End {
{
$actualTagData = $allMeta.ActualTagDataByGroup.$tagGroup
$SubImagePath = Join-Path -Path $dockerFileName -ChildPath $allMeta.Meta.SubImage
if($builtSubImages -notcontains $SubImagePath)
{
Write-Verbose -Message "getting subimage - fromtag: $($tagGroup.Name) - subimage: $($allMeta.Meta.SubImage)"
$subImageAllMeta = Get-DockerImageMetaDataWrapper `
-DockerFileName $SubImagePath `
-CI:$CI.IsPresent `
-IncludeKnownIssues:$IncludeKnownIssues.IsPresent `
-ChannelPath $channelPath `
-TagFilter $TagFilter `
-Version $windowsVersion `
-ImageName $ImageName `
-LinuxVersion $linuxVersion `
-TagData $allMeta.TagData `
-BaseImage $actualTagData.ActualTags[0] `
-BaseRepositry $Repository `
-Strict:$CheckForDuplicateTags.IsPresent


$toBuild += $subImageAllMeta
$builtSubImages += $SubImagePath
}
else
{
Write-Verbose -Message "already got subimage - fromtag: $($tagGroup.Name) - subimage: $($allMeta.Meta.SubImage)"
}
Write-Verbose -Message "getting subimage - fromtag: $($tagGroup.Name) - subimage: $($allMeta.Meta.SubImage)"
$subImageAllMeta = Get-DockerImageMetaDataWrapper `
-DockerFileName $SubImagePath `
-CI:$CI.IsPresent `
-IncludeKnownIssues:$IncludeKnownIssues.IsPresent `
-ChannelPath $channelPath `
-TagFilter $TagFilter `
-Version $windowsVersion `
-ImageName $ImageName `
-LinuxVersion $linuxVersion `
-TagData $allMeta.TagData `
-BaseImage $actualTagData.ActualTags[0] `
-BaseRepositry $Repository `
-Strict:$CheckForDuplicateTags.IsPresent `
-FromTag $tagGroup.Name

$toBuild += $subImageAllMeta
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion release/preview/alpine39/test-deps/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"SkipGssNtlmSspTests": true,
"osVersion": "Alpine ${fromTag}",
"tagTemplates": [
"preview-alpine-#shorttag#"
"#tag#"
],
"OptionalTests": [
"test-deps",
"test-deps-musl"
],
"TestProperties": {
"size": 212
},
"TagMapping": {
"^.*-alpine-3.9$" : "preview-alpine-3.9",
"^.*-alpine-3.10$" : "preview-alpine-3.10"
}
}
7 changes: 6 additions & 1 deletion release/preview/fedora/test-deps/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
"osVersion": "Fedora ${fromTag}",
"SkipGssNtlmSspTests": false,
"tagTemplates": [
"preview-fedora-#shorttag#"
"#tag#"
],
"SubRepository": "test-deps",
"OptionalTests": [
"test-deps"
],
"TestProperties": {
"size": 602
},
"TagMapping": {
"^.*-fedora-28$" : "preview-fedora-28",
"^.*-fedora-29$" : "preview-fedora-29",
"^.*-fedora-30$" : "preview-fedora-30"
}
}
31 changes: 30 additions & 1 deletion tools/buildHelper/buildHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ class DockerImageMetaData {

[PSCustomObject]
$TestProperties = ([PSCustomObject]@{})

[PSCustomObject]
$TagMapping
}

class ShortTagMetaData {
Expand Down Expand Up @@ -333,6 +336,13 @@ class DockerImageFullMetaData
[string] $FullRepository
}

class UpstreamImageTagData
{
[string] $Type
[string] $Tag
[string] $FromTag
}

# Get the meta data and the tag data for an image
function Get-DockerImageMetaDataWrapper
{
Expand Down Expand Up @@ -373,7 +383,10 @@ function Get-DockerImageMetaDataWrapper
$BaseRepositry,

[switch]
$Strict
$Strict,

[string]
$FromTag
)

$imagePath = Join-Path -Path $ChannelPath -ChildPath $dockerFileName
Expand Down Expand Up @@ -419,6 +432,22 @@ function Get-DockerImageMetaDataWrapper
$tagDataFromScript = @($tagDataFromScript | Where-Object { $_.FromTag -match $TagFilter })
}
}
elseif ($meta.TagMapping) {
foreach($regex in $meta.TagMapping.PSObject.Properties.Name)
{
if($BaseImage -match $regex)
{
$tagName = $meta.TagMapping.$regex
$tagDataFromScript = @(
[UpstreamImageTagData]@{
Type='Full'
Tag=$tagName
FromTag = $FromTag
}
)
}
}
}
else
{
$tagDataFromScript = $TagData
Expand Down