-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest.go
135 lines (108 loc) · 2.54 KB
/
manifest.go
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package ctrctl
import (
"fmt"
"os/exec"
)
type ManifestAnnotateOpts struct {
// Base exec.Cmd.
Cmd *exec.Cmd
// Set architecture.
Arch string
// Print usage.
Help bool
// Set operating system.
Os string
// Set operating system feature.
OsFeatures string
// Set operating system version.
OsVersion string
// Set architecture variant.
Variant string
}
// Add additional information to a local image manifest.
func ManifestAnnotate(opts *ManifestAnnotateOpts, manifestList string, manifest string) (string, error) {
return runCtrCmd(
[]string{"manifest", "annotate"},
[]string{manifestList, manifest},
opts,
0,
)
}
type ManifestCreateOpts struct {
// Base exec.Cmd.
Cmd *exec.Cmd
// Amend an existing manifest list.
Amend bool
// Print usage.
Help bool
// Allow communication with an insecure registry.
Insecure bool
}
// Create a local manifest list for annotating and pushing to a registry.
func ManifestCreate(opts *ManifestCreateOpts, manifestList string, manifest ...string) (string, error) {
if len(manifest) == 0 {
return "", fmt.Errorf("manifest must have at least one value")
}
return runCtrCmd(
[]string{"manifest", "create"},
append([]string{manifestList}, manifest...),
opts,
-1,
)
}
type ManifestInspectOpts struct {
// Base exec.Cmd.
Cmd *exec.Cmd
// Print usage.
Help bool
// Allow communication with an insecure registry.
Insecure bool
// Output additional info including layers and platform.
Verbose bool
}
// Display an image manifest, or manifest list.
func ManifestInspect(opts *ManifestInspectOpts, manifestList string, manifest string) (string, error) {
return runCtrCmd(
[]string{"manifest", "inspect"},
[]string{manifestList, manifest},
opts,
0,
)
}
type ManifestPushOpts struct {
// Base exec.Cmd.
Cmd *exec.Cmd
// Print usage.
Help bool
// Allow push to an insecure registry.
Insecure bool
// Remove the local manifest list after push.
Purge bool
}
// Push a manifest list to a repository.
func ManifestPush(opts *ManifestPushOpts, manifestList string) (string, error) {
return runCtrCmd(
[]string{"manifest", "push"},
[]string{manifestList},
opts,
0,
)
}
type ManifestRmOpts struct {
// Base exec.Cmd.
Cmd *exec.Cmd
// Print usage.
Help bool
}
// Delete one or more manifest lists from local storage.
func ManifestRm(opts *ManifestRmOpts, manifestList ...string) (string, error) {
if len(manifestList) == 0 {
return "", fmt.Errorf("manifestList must have at least one value")
}
return runCtrCmd(
[]string{"manifest", "rm"},
manifestList,
opts,
-1,
)
}