-
Notifications
You must be signed in to change notification settings - Fork 152
/
createManifest.ps1
65 lines (54 loc) · 1.71 KB
/
createManifest.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Used to create a container manifest.
# Prereq: you must login to $ContainerRegistery before running this script
# default scenarios is to build a `latest` tag which will point to the `ubuntu-16.04` tag for linux
# and the `windowsservercore` tag for windows
param(
[parameter(Mandatory)]
[string]
$ContainerRegistry,
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[abcdefghijklmnopqrstuvwxyz\-_0123456789\.]+$')]
[string]
$ManifestTag = 'latest',
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[abcdefghijklmnopqrstuvwxyz\-_0123456789\.]+$')]
[string]
$Image = 'powershell',
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[abcdefghijklmnopqrstuvwxyz\-_0123456789\.]+$')]
[string[]]
$TagList = ('ubuntu-16.04', 'windowsservercore'),
[switch]
$SkipPush
)
$first = $true
$manifestList = @()
foreach($tag in $TagList)
{
$arguments = @()
$amend = ""
if (!$first) {
$arguments += '--amend'
}
$arguments += @(
"$ContainerRegistry/${Image}:$ManifestTag"
"$ContainerRegistry/${Image}:$tag"
)
Write-Verbose -Message "running: docker manifest create $arguments" -Verbose
docker manifest create $arguments
$first = $false
}
# Create the manifest
# Inspect (print) the manifest
Write-Verbose -Verbose "capturing the manifest..."
docker manifest inspect $ContainerRegistry/${Image}:$ManifestTag
# push the manifest
if (-not $SkipPush) {
Write-Verbose -Message 'pushing manifest list...' -Verbose
docker manifest push --purge $ContainerRegistry/${Image}:$ManifestTag
}
else {
Write-Verbose -Message 'skipping manifest list push...' -Verbose
}