Repository navigation
Commit 35b354b
authored
fix(mutate): preserve config blob and layers for non-Docker OCI artifacts (#2286)
* fix(mutate): preserve config blob and layers for non-Docker OCI artifacts
compute() unconditionally parses the config as a Docker image config
and derives layers from RootFS.DiffIDs. For non-Docker OCI artifacts
(Helm charts, WASM modules), the config has no DiffIDs, causing
Layers() to return empty (remote.Write skips blob uploads) and
RawConfigFile() to corrupt the config digest via re-marshaling.
Detect non-image configs by checking the config media type. When it
is not DockerConfigJSON or OCIConfigJSON, delegate to computeArtifact
which preserves the original config blob and derives layers from the
base image and manifest descriptors.
Fixes #2251
Signed-off-by: Dayna Blackwell <[email protected]>
* test: replace no-op _ = layers with assertion per review
* fix: rename unused originalManifest parameter to _ (revive lint)
* fix: remove unused originalManifest parameter from computeArtifact per review
* refactor: inline artifact logic into compute(), remove computeArtifact
Per review feedback:
- Inline artifact-specific behavior as conditional blocks within
compute() instead of a separate computeArtifact() function
- Share manifest layer loop, annotations, mediaType, and subject
assignment between both paths
- Trim isImageConfig comment
- Layers() artifact fallback stays inline (no new abstractions)
Net -70 lines.
* Combine Layers() artifact check into compute error branch
Address review feedback:
- Remove comment at line 124
- Merge the !isImageConfig block into the ErrNotComputed condition
---------
Signed-off-by: Dayna Blackwell <[email protected]>1 parent e5983f2 commit 35b354b
2 files changed
Lines changed: 131 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
| |||
70 | 98 | | |
71 | 99 | | |
72 | 100 | | |
73 | | - | |
74 | | - | |
75 | 101 | | |
76 | | - | |
77 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
78 | 107 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
85 | 117 | | |
86 | | - | |
87 | | - | |
88 | 118 | | |
89 | | - | |
90 | 119 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 120 | + | |
| 121 | + | |
94 | 122 | | |
95 | | - | |
| 123 | + | |
96 | 124 | | |
97 | 125 | | |
98 | 126 | | |
99 | | - | |
100 | 127 | | |
101 | 128 | | |
102 | 129 | | |
| |||
105 | 132 | | |
106 | 133 | | |
107 | 134 | | |
108 | | - | |
109 | 135 | | |
110 | 136 | | |
111 | 137 | | |
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
115 | | - | |
116 | 141 | | |
117 | 142 | | |
118 | 143 | | |
119 | 144 | | |
120 | 145 | | |
121 | 146 | | |
122 | 147 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 148 | | |
128 | 149 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
139 | 164 | | |
140 | | - | |
141 | | - | |
142 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
143 | 168 | | |
144 | 169 | | |
145 | | - | |
146 | 170 | | |
147 | 171 | | |
148 | 172 | | |
149 | | - | |
150 | 173 | | |
151 | 174 | | |
152 | 175 | | |
153 | | - | |
154 | 176 | | |
155 | 177 | | |
156 | 178 | | |
157 | 179 | | |
158 | | - | |
159 | 180 | | |
160 | 181 | | |
161 | 182 | | |
| |||
173 | 194 | | |
174 | 195 | | |
175 | 196 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
180 | 201 | | |
181 | 202 | | |
182 | 203 | | |
183 | 204 | | |
184 | 205 | | |
185 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
186 | 209 | | |
187 | 210 | | |
188 | 211 | | |
| |||
220 | 243 | | |
221 | 244 | | |
222 | 245 | | |
223 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
224 | 249 | | |
225 | 250 | | |
226 | 251 | | |
227 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
228 | 258 | | |
229 | 259 | | |
230 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
622 | 676 | | |
623 | 677 | | |
624 | 678 | | |
| |||
0 commit comments