@@ -23,6 +23,85 @@ def cli() -> None:
2323 pass
2424
2525
26+ @cli .command ()
27+ @click .option (
28+ "--index" ,
29+ required = True ,
30+ help = "OCI image index" ,
31+ )
32+ @click .option (
33+ "--index-tag" ,
34+ required = True ,
35+ help = "OCI image index tag" ,
36+ )
37+ @click .option (
38+ "--manifest_folder" ,
39+ default = "manifests" ,
40+ help = "A folder where the index entries are read from." ,
41+ )
42+ @click .option (
43+ "--insecure" ,
44+ default = False ,
45+ help = "Use HTTP to communicate with the registry" ,
46+ )
47+ @click .option (
48+ "--additional_tag" ,
49+ required = False ,
50+ multiple = True ,
51+ help = "Additional tag to push the index with" ,
52+ )
53+ def push_index_from_directory (
54+ index : str ,
55+ index_tag : str ,
56+ manifest_folder : str ,
57+ insecure : bool ,
58+ additional_tag : List [str ],
59+ ) -> None :
60+ """
61+ Push a list of files from the `manifest_folder` to an index.
62+
63+ :since: 0.10.9
64+ """
65+
66+ index = Container (f"{ index } :{ index_tag } " , insecure = insecure )
67+ index .push_index_from_directory (manifest_folder , additional_tag )
68+
69+
70+ @cli .command ()
71+ @click .option (
72+ "--index" ,
73+ required = True ,
74+ help = "OCI image index" ,
75+ )
76+ @click .option (
77+ "--index-tag" ,
78+ required = True ,
79+ help = "OCI image index tag" ,
80+ )
81+ @click .option (
82+ "--insecure" ,
83+ default = False ,
84+ help = "Use HTTP to communicate with the registry" ,
85+ )
86+ @click .option (
87+ "--tag" ,
88+ required = True ,
89+ multiple = True ,
90+ help = "Tag to push the OCI image index with" ,
91+ )
92+ def push_index_tags (index : str , index_tag : str , insecure : bool , tag : List [str ]) -> None :
93+ """
94+ Push OCI image index tags to a registry.
95+
96+ :since: 0.10.9
97+ """
98+
99+ index = Container (f"{ index } :{ index_tag } " , insecure = insecure )
100+
101+ image_index = index .read_or_generate_index ()
102+ index .push_index_for_tags (image_index , tag )
103+
104+
26105@cli .command ()
27106@click .option (
28107 "--container" ,
@@ -94,10 +173,7 @@ def push_manifest(
94173 :since: 0.7.0
95174 """
96175
97- container = Container (
98- f"{ container } :{ version } " ,
99- insecure = insecure ,
100- )
176+ container = Container (f"{ container } :{ version } " , insecure = insecure )
101177
102178 manifest = container .read_or_generate_manifest (cname , arch , version , commit )
103179
@@ -173,67 +249,12 @@ def push_manifest_tags(
173249 :since: 0.10.0
174250 """
175251
176- container = Container (
177- f"{ container } :{ version } " ,
178- insecure = insecure ,
179- )
252+ container = Container (f"{ container } :{ version } " , insecure = insecure )
180253
181254 manifest = container .read_or_generate_manifest (cname , arch , version , commit )
182255 container .push_manifest_for_tags (manifest , tag )
183256
184257
185- @cli .command ()
186- @click .option (
187- "--container" ,
188- "container" ,
189- required = True ,
190- type = click .Path (),
191- help = "Container Name" ,
192- )
193- @click .option (
194- "--version" ,
195- "version" ,
196- required = True ,
197- type = click .Path (),
198- help = "Version of image" ,
199- )
200- @click .option (
201- "--manifest_folder" ,
202- default = "manifests" ,
203- help = "A folder where the index entries are read from." ,
204- )
205- @click .option (
206- "--insecure" ,
207- default = False ,
208- help = "Use HTTP to communicate with the registry" ,
209- )
210- @click .option (
211- "--additional_tag" ,
212- required = False ,
213- multiple = True ,
214- help = "Additional tag to push the index with" ,
215- )
216- def update_index (
217- container : str ,
218- version : str ,
219- manifest_folder : str ,
220- insecure : bool ,
221- additional_tag : List [str ],
222- ) -> None :
223- """
224- Push a list of files from the `manifest_folder` to an index.
225-
226- :since: 0.7.0
227- """
228-
229- container = Container (
230- f"{ container } :{ version } " ,
231- insecure = insecure ,
232- )
233-
234- container .push_index_from_directory (manifest_folder , additional_tag )
235-
236-
237258def main () -> None :
238259 """
239260 gl-oci main()
0 commit comments