Skip to content

Commit da79bfc

Browse files
committed
Restructure gardenlinux.oci to remove left-over code and clean up logic
Signed-off-by: Tobias Wolf <[email protected]>
1 parent a57efbd commit da79bfc

File tree

12 files changed

+814
-831
lines changed

12 files changed

+814
-831
lines changed

src/gardenlinux/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,4 @@
166166

167167
OCI_ANNOTATION_SIGNATURE_KEY = "io.gardenlinux.oci.signature"
168168
OCI_ANNOTATION_SIGNED_STRING_KEY = "io.gardenlinux.oci.signed-string"
169+
OCI_IMAGE_INDEX_MEDIA_TYPE = "application/vnd.oci.image.index.v1+json"

src/gardenlinux/features/cname.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from typing import Optional
44
import re
55

6+
from .parser import Parser
7+
68

79
class CName(object):
810
def __init__(self, cname, arch=None, version=None):
@@ -64,6 +66,10 @@ def commit_id(self) -> Optional[str]:
6466
def flavor(self) -> str:
6567
return self._flavor
6668

69+
@property
70+
def feature_set(self) -> str:
71+
return Parser().filter_as_string(self.flavor)
72+
6773
@property
6874
def version(self) -> Optional[str]:
6975
return self._version

src/gardenlinux/oci/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
# -*- coding: utf-8 -*-
2+
3+
from .container import Container
4+
from .index import Index
5+
from .layer import Layer
6+
from .manifest import Manifest
7+
8+
__all__ = ["Container", "Index", "Layer", "Manifest"]

src/gardenlinux/oci/__main__.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from pygments.lexer import default
77

8-
from .registry import GlociRegistry
8+
from .container import Container
99

1010

1111
@click.group()
@@ -71,16 +71,21 @@ def push_manifest(
7171
):
7272
"""push artifacts from a dir to a registry, get the index-entry for the manifest in return"""
7373
container_name = f"{container}:{version}"
74-
registry = GlociRegistry(
74+
75+
container = Container(
7576
container_name=container_name,
7677
token=os.getenv("GL_CLI_REGISTRY_TOKEN"),
7778
insecure=insecure,
7879
)
79-
digest = registry.push_from_dir(
80-
arch, version, cname, directory, manifest_file, commit=commit
80+
81+
manifest = container.read_or_generate_manifest(cname, arch, version, commit)
82+
83+
container.push_manifest_and_artifacts_from_directory(
84+
manifest, directory, manifest_file
8185
)
86+
8287
if cosign_file:
83-
print(digest, file=open(cosign_file, "w"))
88+
print(manifest["digest"], file=open(cosign_file, "w"))
8489

8590

8691
@cli.command()
@@ -111,12 +116,12 @@ def push_manifest(
111116
def update_index(container, version, manifest_folder, insecure):
112117
"""push a index entry from a list of files to an index"""
113118
container_name = f"{container}:{version}"
114-
registry = GlociRegistry(
119+
container = Container(
115120
container_name=container_name,
116121
token=os.getenv("GL_CLI_REGISTRY_TOKEN"),
117122
insecure=insecure,
118123
)
119-
registry.update_index(manifest_folder)
124+
container.push_index_from_directory(manifest_folder)
120125

121126

122127
def main():

0 commit comments

Comments
 (0)