@@ -17,7 +17,7 @@ type listBuilderOptions struct {
17
17
cleanup bool
18
18
iidFile string
19
19
authfile string
20
- skipTLSVerify bool
20
+ skipTLSVerify * bool
21
21
}
22
22
23
23
type listLocal struct {
@@ -39,13 +39,19 @@ func newManifestListBuilder(listName string, localEngine entities.ImageEngine, o
39
39
// Build retrieves images from the build reports and assembles them into a
40
40
// manifest list in local container storage.
41
41
func (l * listLocal ) build (ctx context.Context , images map [entities.BuildReport ]entities.ImageEngine ) (string , error ) {
42
+ // Set skipTLSVerify based on whether it was changed by the caller
43
+ skipTLSVerify := types .OptionalBoolUndefined
44
+ if l .options .skipTLSVerify != nil {
45
+ skipTLSVerify = types .NewOptionalBool (* l .options .skipTLSVerify )
46
+ }
47
+
42
48
exists , err := l .localEngine .ManifestExists (ctx , l .listName )
43
49
if err != nil {
44
50
return "" , err
45
51
}
46
52
// Create list if it doesn't exist
47
53
if ! exists .Value {
48
- _ , err = l .localEngine .ManifestCreate (ctx , l .listName , []string {}, entities.ManifestCreateOptions {SkipTLSVerify : types . NewOptionalBool ( l . options . skipTLSVerify ) })
54
+ _ , err = l .localEngine .ManifestCreate (ctx , l .listName , []string {}, entities.ManifestCreateOptions {SkipTLSVerify : skipTLSVerify })
49
55
if err != nil {
50
56
return "" , fmt .Errorf ("creating manifest list %q: %w" , l .listName , err )
51
57
}
@@ -63,7 +69,7 @@ func (l *listLocal) build(ctx context.Context, images map[entities.BuildReport]e
63
69
logrus .Infof ("pushing image %s" , image .ID )
64
70
defer logrus .Infof ("pushed image %s" , image .ID )
65
71
// Push the image to the registry
66
- report , err := engine .Push (ctx , image .ID , l .listName + docker .UnknownDigestSuffix , entities.ImagePushOptions {Authfile : l .options .authfile , Quiet : false , SkipTLSVerify : types . NewOptionalBool ( l . options . skipTLSVerify ) })
72
+ report , err := engine .Push (ctx , image .ID , l .listName + docker .UnknownDigestSuffix , entities.ImagePushOptions {Authfile : l .options .authfile , Quiet : false , SkipTLSVerify : skipTLSVerify })
67
73
if err != nil {
68
74
return fmt .Errorf ("pushing image %q to registry: %w" , image , err )
69
75
}
@@ -111,11 +117,11 @@ func (l *listLocal) build(ctx context.Context, images map[entities.BuildReport]e
111
117
}
112
118
113
119
// Add the images to the list
114
- listID , err := l .localEngine .ManifestAdd (ctx , l .listName , refs , entities.ManifestAddOptions {Authfile : l .options .authfile , SkipTLSVerify : types . NewOptionalBool ( l . options . skipTLSVerify ) })
120
+ listID , err := l .localEngine .ManifestAdd (ctx , l .listName , refs , entities.ManifestAddOptions {Authfile : l .options .authfile , SkipTLSVerify : skipTLSVerify })
115
121
if err != nil {
116
122
return "" , fmt .Errorf ("adding images %q to list: %w" , refs , err )
117
123
}
118
- _ , err = l .localEngine .ManifestPush (ctx , l .listName , l .listName , entities.ImagePushOptions {Authfile : l .options .authfile , SkipTLSVerify : types . NewOptionalBool ( l . options . skipTLSVerify ) })
124
+ _ , err = l .localEngine .ManifestPush (ctx , l .listName , l .listName , entities.ImagePushOptions {Authfile : l .options .authfile , SkipTLSVerify : skipTLSVerify })
119
125
if err != nil {
120
126
return "" , err
121
127
}
0 commit comments