Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Installs the given GardenLinux Python library
inputs:
version:
description: GardenLinux Python library version
default: "1.0.2"
default: "1.0.3"
python_version:
description: Python version to setup
default: "3.14"
Expand Down
120 changes: 64 additions & 56 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gardenlinux"
version = "1.0.2"
version = "1.0.3"
description = "Contains tools to work with the features directory of gardenlinux, for example deducting dependencies from feature sets or validating cnames"
authors = ["Garden Linux Maintainers <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -27,7 +27,7 @@ bandit = "^1.9.4"
boto3-stubs = { extras = ["s3"], version = "^1.44.2" }
isort = "^8.0.1"
moto = "^5.2.5"
mypy = "2.1.0"
mypy = "2.4.1"
pre-commit = "^4.7.0"
python-dotenv = "^1.2.2"
pytest = "^9.2.0"
Expand Down
36 changes: 36 additions & 0 deletions src/gardenlinux/oci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import argparse
import json
from pathlib import Path
from os import getenv
from typing import Optional

from .image_manifest import ImageManifest
Expand Down Expand Up @@ -556,11 +557,16 @@ def main() -> None:
index_resource.push_index(image_index)
index_resource.push_index_for_tags(image_index, args.additional_tag)
case "pull-image":
_set_podman_auth_data_from_env(args.repository)

image_id = Podman(insecure=args.insecure).pull(
args.repository, oci_tag=args.tag, platform=args.platform
)

print(image_id)
case "push-image":
_set_podman_auth_data_from_env(args.repository)

Podman(insecure=args.insecure).push(
args.repository, oci_tag=args.tag, destination=args.destination
)
Expand Down Expand Up @@ -635,5 +641,35 @@ def main() -> None:
)


def _set_podman_auth_data_from_env(registry_url: str) -> None:
"""
Sets the default registry auth data for Podman.

:param registry_url: Registry URL

:since: 1.0.3
"""

if "/" not in registry_url:
return None

registry_host = registry_url.split("/", 1)[0]

password = getenv("GL_CLI_REGISTRY_PASSWORD", "")
token = getenv("GL_CLI_REGISTRY_TOKEN", "")
username = getenv("GL_CLI_REGISTRY_USERNAME", "gardenlinux")

auth_data = {
registry_host: {
"token": token,
"username": username,
"password": password,
}
}

if password:
PodmanContext.set_default_registry_auth_data(auth_data)


if __name__ == "__main__":
main()
Loading
Loading