Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fix OCI Version handling + passing entrypoint #124

Merged
merged 1 commit into from
Aug 8, 2023
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
8 changes: 8 additions & 0 deletions src/batou_ext/oci.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import hashlib
import os
import re
import shlex
from typing import Optional

import pkg_resources
Expand Down Expand Up @@ -31,6 +32,7 @@ class Container(Component):

# specific options
entrypoint: Optional[str] = None
docker_cmd: Optional[str] = None
envfile: Optional[str] = None
mounts: dict = {}
ports: dict = {}
Expand Down Expand Up @@ -66,6 +68,9 @@ def configure(self):
# spec version overrides the argument provided or default version
if spec_tag:
self.version = spec_tag
else:
# append version to image string when passed seperately
self.image = f"{self.image}:{self.version}"
else:
raise RuntimeError(
f"could not match the docker spec against the provided container image string: '{self.image}'"
Expand All @@ -87,6 +92,9 @@ def configure(self):
)
self.envfile = self._

if self.docker_cmd:
self._docker_cmd_list = shlex.split(self.docker_cmd)

self += File(
f"/etc/local/nixos/docker_{self.container_name}.nix",
sensitive_data=True,
Expand Down
6 changes: 5 additions & 1 deletion src/batou_ext/resources/oci-template.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
virtualisation.oci-containers = {
backend = "docker";
containers."{{component.container_name}}" = {
# {% if component.entrypoint != None %}
# {% if component.entrypoint %}
entrypoint = "{{component.entrypoint}}";
# {% endif %}

# {% if component.docker_cmd %}
cmd = [ {% for cmd in component._docker_cmd_list %} "{{cmd}}" {% endfor %} ];
# {% endif %}

# {% if component.registry_address %}
login = {
registry = "{{component.registry_address}}";
Expand Down
8 changes: 7 additions & 1 deletion src/batou_ext/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@


class S3(batou.component.Component):
"""Configuration for an S3 connection and its credentials."""
"""Configuration for an S3 connection and its credentials.

Keyword arguments:
access_key_id -- The S3 access key ID
secret_access_key -- The S3 secret access key
endpoint_url -- The S3 enpoint's URL
"""

_required_params_ = {
"access_key_id": "value",
Expand Down
Loading